fix: guard resetSignTool against undefined backup path - #601
Merged
Conversation
BACKUP_SIGN_TOOL_PATH and ORIGINAL_SIGN_TOOL_PATH are module-level variables only assigned inside createSignTool. resetSignTool is called unconditionally (including on the no-sign path), so on its first call the paths are undefined and fs.existsSync(undefined) triggers Node's DEP0187 deprecation warning. Guard the existsSync/restore so it is skipped until the paths have been initialized. Fixes #576
MarshallOfSound
approved these changes
Jun 27, 2026
MarshallOfSound
marked this pull request as ready for review
June 27, 2026 21:41
VerteDinde
approved these changes
Jun 28, 2026
|
🎉 This PR is included in version 5.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Samuel Attard · Slack thread
Fixes #576
Before
resetSignTool()callsfs.existsSync(BACKUP_SIGN_TOOL_PATH), butBACKUP_SIGN_TOOL_PATHis a module-level variable that is only assigned insidecreateSignTool. SinceresetSignTool()is called unconditionally fromindex.ts(including on the no-sign path, before any signing branch), on its first call the path isundefined.fs.existsSync(undefined)emits Node'sDEP0187deprecation warning, and the restore silently becomes a no-op (correctly, but only by accident).After
resetSignTool()guards theexistsSync+ restore so it is skipped whileBACKUP_SIGN_TOOL_PATH/ORIGINAL_SIGN_TOOL_PATHare still undefined. No moreDEP0187warning, and the restore only runs once the paths have actually been initialized bycreateSignTool.How
The signtool paths are module-level
letbindings assigned only increateSignTool.resetSignToolis invoked unconditionally regardless of whether signing options were provided, so it can run before those bindings are set. The fix adds a truthiness check on the paths before touching the filesystem.Generated by Claude Code