[AAASM-3439] 🔒 (sec): avoid shell interpolation in packaging test (CodeQL)#164
Merged
Chisanan232 merged 1 commit intoJun 19, 2026
Merged
Conversation
CodeQL js/shell-command-injection-from-environment flagged building the `tar`/`npm pack` shell commands from an absolute temp-dir path derived from process.cwd(). A path with spaces or shell metacharacters would corrupt the command. Pass the paths as discrete execFileSync arguments (no shell) instead of interpolating them into a shell string. Refs AAASM-3439
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
🟢 Review result — Claude Code (AAASM-3439)Verdict: APPROVED — ready for approval & merge. 1. CI status — all green
2. Scope vs ticket (AAASM-3439)
Scope delivered. Ready to merge (alert auto-closes on the next master CodeQL run post-merge). |
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.



Target
Task summary:
Resolve CodeQL code-scanning alert [AAASM-16] ✨ (architecture): Initialize node-sdk project architecture with pnpm #1 (
js/shell-command-injection-from-environment, MEDIUM) intests/packaging/npm-pack-content.test.ts. The packaging test built thetarandnpm packshell commands by interpolating an absolute temp-dir path (derived fromprocess.cwd()) into a shell-stringexecSynccall. An absolute path containing spaces or shell metacharacters would corrupt the command.Task tickets:
Key point change (optional):
Switch the two path-interpolating
execSync(\...`)calls toexecFileSync(cmd, [args])with discrete argument arrays — no shell, so the absolute paths are never re-parsed by a shell. Thepnpm run build` call (no interpolation) is left unchanged. Test behaviour and assertions are identical.Effecting Scope
Test-only change; no production code, public API, or build config affected.
Description
tests/packaging/npm-pack-content.test.ts: importexecFileSync; replaceexecSync(\npm pack ... ${packDir}`)andexecSync(`tar -tf ${tarballPath}`)withexecFileSync` + args arrays. Added why-comments explaining the shell-injection rationale.How to verify
pnpm test -- tests/packaging/npm-pack-content.test.ts— passes (target test green).pnpm lintandpnpm typecheck— clean.Closes AAASM-3439
🤖 Generated with Claude Code