Skip to content

Potential fix for code scanning alert no. 3: Shell command built from environment values - #6

Merged
danielhaim1 merged 1 commit into
mainfrom
alert-autofix-3
Aug 19, 2026
Merged

Potential fix for code scanning alert no. 3: Shell command built from environment values#6
danielhaim1 merged 1 commit into
mainfrom
alert-autofix-3

Conversation

@danielhaim1

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/danielhaim1/packr/security/code-scanning/3

Use execFileSync (or spawnSync with shell: false) so the executable and arguments are passed separately and never parsed by a shell. This preserves behavior while removing command-injection/shell-metacharacter risk and also handles spaces in paths correctly.

In __tests__/test.js:

  • Update the child_process import to include execFileSync instead of execSync.
  • Replace the execSync(${packrBin} build --config ${configPath}, { ... }) call with execFileSync(packrBin, ['build', '--config', configPath], { ... }).
  • Keep existing stdio and env options unchanged.

This single change addresses all listed alert variants at the same sink location.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@danielhaim1
danielhaim1 marked this pull request as ready for review August 19, 2026 12:26
@danielhaim1
danielhaim1 merged commit e9491e8 into main Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant