--file-list ignored
Describe the bug
When using sign code azure-key-vault:
- we have to provide a list of files, even when a
--file-listparameter is provided - when we provide a list of files, the
--file-listparameter seems to be simply ignored - the example in the docs folder specify both a '*' as the list of files an a
--file-list - there is no documentation about the relationship between these two parameters
Repro steps
sign-list.txt:
myapp.exe
my.*.dll
dir:
myapp.exe
my.first.dll
my.second.dll
other.dll
Only file-list not accepted:
sign code azure-key-vault `
> -fl "D:\code\project1\sign-list.txt" `
> --base-directory "D:\code\project1\bin\Release\net10\" `
> --azure-key-vault-tenant-id "xxx" `
> --azure-key-vault-client-id "yyy" `
> --azure-key-vault-client-secret "zzz" `
> --azure-key-vault-url "https://xxx.vault.azure.net/" `
> --azure-key-vault-certificate "foo" `
> -d "My App" `
> -v Information `
Required argument missing for command: 'azure-key-vault'.
wildcard results in all files signed (file-list ignored):
sign code azure-key-vault `
> -fl "D:\code\project1\sign-list.txt" `
> --base-directory "D:\code\project1\bin\Release\net10\" `
> --azure-key-vault-tenant-id "xxx" `
> --azure-key-vault-client-id "yyy" `
> --azure-key-vault-client-secret "zzz" `
> --azure-key-vault-url "https://xxx.vault.azure.net/" `
> --azure-key-vault-certificate "foo" `
> -d "My App" `
> -v Information `
> *
Submitting D:\code\project1\bin\Release\net10\myapp.exe for signing.
Submitting D:\code\project1\bin\Release\net10\my.first.dll for signing.
Submitting D:\code\project1\bin\Release\net10\my.second.dll for signing.
Submitting D:\code\project1\bin\Release\net10\other.dll for signing.
single file results in only this file signed (file-list ignored):
sign code azure-key-vault `
> -fl "D:\code\project1\sign-list.txt" `
> --base-directory "D:\code\project1\bin\Release\net10\" `
> --azure-key-vault-tenant-id "xxx" `
> --azure-key-vault-client-id "yyy" `
> --azure-key-vault-client-secret "zzz" `
> --azure-key-vault-url "https://xxx.vault.azure.net/" `
> --azure-key-vault-certificate "foo" `
> -d "My App" `
> -v Information `
> myapp.exe
Submitting D:\code\project1\bin\Release\net10\myapp.exe for signing.
Expected behavior There should be a clear relationship between files and --file-list:
- should be combined
- no files should be allowed when file-list is set
- documented
Actual behavior --file-list seems to be ignored
Additional context version 0.9.1-beta.25379.1+ba6e717abf74a693f0f9c5e891c0e3ef624956b3
After reading the code, it seems the file-list is only used when scanning a IContainer, which can be a zip, an appx or a nupkg. That would explain the difference between the files argument and the file-list options.
Still, these kind of assumptions are hard to understand and should be documented: use files when you want to select which files should be signed, and use --file-list (which should be --container-file-list) to filter files to sign inside a container.
Hi @tbolon @kartheekp-ms, I'd like to work on this issue as my first contribution to this repo.
Based on tbolon's investigation above, it seems --file-list is only honored when scanning an IContainer (zip/appx/nupkg), and is silently ignored for regular file/folder signing — which is confusing since there's no error or warning.
My plan is to:
Locate where --file-list is parsed and used in the container-scanning path Add a clear validation/error message when --file-list is provided but the input isn't a container Update the documentation to clarify the relationship between files and --file-list
Please let me know if this direction sounds right, or if a different approach (e.g. making --file-list work for regular files too) is preferred. Happy to start on this soon.
Thanks @minahilatiqdev and @tbolon for investigating!
In the legacy client, --filelist was explicitly documented as filtering files “within an archive”. Selecting top-level inputs and filtering their contents were separate operations. The current CLI retains this distinction, which explains why --file-list does not filter standalone binaries selected by the positional arguments.
However, the option is not limited to IContainer processing. The current ClickOnce signer also applies it to .application/.vsto deployment contents directly and it doesn't implement IContainer. Please hold off on blanket non-IContainer validation: that would incorrectly flag or reject valid ClickOnce and mixed-input workflows.
Proposed direction
I propose retaining --file-list and applying its inclusion/exclusion filtering consistently to files discovered under the base directory, inside containers, and within ClickOnce deployments.
Existing pattern behavior
The current file-list parser supports inclusion patterns and exclusions prefixed with !. For archive contents, for example:
**/*.dll
**/*.exe
!**/test/**
!**/*.Tests.dll
!**/other.dll
In the current implementation, an exclusion-only file-list does not implicitly include everything: it selects no files through file-list-based content filtering. To select everything except excluded matches, add an include-all pattern such as **/*.
Thanks for the detailed explanation! I understand now. I will extend the existing file-list filtering (from FileListReader.cs) so it applies consistently to base-directory files too, alongside the existing container and ClickOnce filtering. I will start looking at the code and share a draft PR once I have something working.
Hi @kartheekp-ms, following up here. I opened PR #1076 a couple of weeks ago with a fix (extending the file-list filtering to standalone input files, as you outlined above) along with 6 new tests. CLA is signed, and all CI checks are passing. Still waiting on a review whenever you get a chance. Please let me know if any changes are needed. Thanks!
Hi guys, your comments helped me a lot.
I want to add one more container/archive type: VSIX packages for Visual Studio and Visual Studio Extensions packages.