Repository navigation
fix(sign): Excluded the artifacts directory from the signed package - #3834
MaxFreedomPollard wants to merge 6 commits into
Conversation
The sign command builds its package into a temporary directory, and build creates its default file filter from that temporary path. FileFilter only adds ignore rules for the artifacts directory when it sits inside the source directory, so a temporary path meant the rule was never added and everything under web-ext-artifacts that is not a .zip or .xpi ended up in the archive sent to AMO. Sign now builds the file filter itself from the real artifacts directory and passes it to build. The same ignoreFiles are still passed in, so --ignore-files is unaffected, and the existing isSubPath guard keeps behaviour unchanged when --artifacts-dir points outside the source directory.
Rob--W
left a comment
There was a problem hiding this comment.
This patch seems to fix the issue at the wrong layer. The build command should exclude the artifacts directory; sign should not exclude files that the build includes, because otherwise someone testing the output of build may get a result that differs from what users would encounter after signing the package.
Rob--W
left a comment
There was a problem hiding this comment.
The proposed change to make artifactsDir and artifactsDirToIgnore separate in build looks wrong. I realize that it is due to my previous review feedback, where I asked to move the logic to build. That feedback was wrong, as the code diff shows, build already took an artifactsDir parameter that served the purpose.
The original commit was correct because it added a specific file filter. Could you revert your last commit that implemented my review feedback?
And to avoid confusion, change the comment as follows:
Your current suggested comment
// The package is built into a temporary directory, so the filter has to
// be built here, where the real artifacts directory is known.My proposed version (format/copy-edit/wrap as needed):
build() is passed a custom artifactsDir, set to a temporary directory to avoid conflicts when attempting to write the unsigned zip file there. But fileFilter needs to be passed the original artifactsDir to make sure that ignoring still works.
|
Reverted 44de43b and used your wording for the comment. |
Fixes #1640.
web-ext buildleaves the artifacts directory out of its package, butweb-ext signcan include it. Files such as.crxpackages, unpacked extension copies, and screenshots underweb-ext-artifacts/can then end up in the archive uploaded to AMO. Existing.zipand.xpifiles are already excluded by the base ignore patterns.sign()builds into a temporary directory, sobuild()previously made its file filter from that temporary output path instead of the real artifacts directory inside the source tree.build()now acceptsartifactsDirToIgnorefor its own file filter, defaulting to its outputartifactsDir.sign()passes the real artifacts directory through this option while keeping the temporary build output. Build constructs the filter in both commands. The existing--ignore-fileshandling and the behavior when the artifacts directory is outside the source tree remain unchanged.A sign integration test checks that the archive contains
manifest.jsonbut excludes a prior.crxin the artifacts directory. A sign unit test checks that it passes the real directory to build. A build unit test checks that the directory used for filtering can differ from the output directory.Validation: all 45 tests in
test.build.jsandtest.sign.jspassed. ESLint and Prettier passed for the four changed files.