fix(security): derive the commit-privacy script path from the file location, not argv - #1230
Merged
Merged
Conversation
…cation, not argv Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
…g under Unreleased Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
|
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.



The helper introduced in #1229 resolved the check-state-leak.js path from process.argv[2], letting an externally influenced string reach the git-config command that memory-filters.js executes. The repo root is fixed relative to the helper file, so it is now derived from __dirname (the same resolution mcp-register-cli and dashboard-launch settled on) and the installer no longer passes the argument.
Verified live: running the helper configures the filter with the correct absolute path and exit 0, and the install test suites pass (install-ps1 9/9, install-sh 6/6).
Summary by cubic
Hardened commit-privacy setup by deriving the
check-state-leak.jspath from this file’s location (__dirname) instead ofargv, preventing untrusted input from reachinggit-config. The installer no longer passes a repo path argument, anddocs/ROADMAP.mdrecords this under Unreleased.rootDirfrom__dirnameinapply-commit-privacy.jsand setscriptPathviapath.join(rootDir, 'scripts', 'check-state-leak.js').install.ps1to call the helper without$RootDir.install-ps1(9/9) andinstall-sh(6/6) tests pass.Written for commit cd3a443. Summary will update on new commits.