Skip to content

Comments

fix(security): Replace execSync with execFileSync to prevent command injection#23

Merged
timfish merged 1 commit intomainfrom
fix/js-1460-command-injection
Feb 19, 2026
Merged

fix(security): Replace execSync with execFileSync to prevent command injection#23
timfish merged 1 commit intomainfrom
fix/js-1460-command-injection

Conversation

@fix-it-felix-sentry
Copy link
Contributor

Summary

This PR fixes a potential command injection vulnerability by replacing child_process.execSync() with child_process.execFileSync() in the clang-format script.

Changes

  • Replace execSync with execFileSync for clang-format execution
  • Replace execSync with execFileSync for git status execution
  • Pass arguments as arrays instead of shell command strings

Security Impact

While the original code used hardcoded arguments (making it a false positive in practice), using execFileSync with an array of arguments is a more secure approach that:

  • Prevents shell interpretation
  • Eliminates potential command injection vulnerabilities
  • Follows Node.js security best practices

Testing

The clang-format script has been tested and continues to work correctly with the new implementation.

References

…injection

Replace child_process.execSync() with child_process.execFileSync() to
eliminate potential command injection vulnerabilities. While the original
code used hardcoded arguments, using execFileSync with an array of
arguments is a more secure approach that prevents shell interpretation.

Changes:
- Replace execSync with execFileSync for clang-format execution
- Replace execSync with execFileSync for git status execution
- Pass arguments as arrays instead of shell command strings

Fixes: https://linear.app/getsentry/issue/VULN-1070
Fixes: https://linear.app/getsentry/issue/JS-1460
@linear
Copy link

linear bot commented Feb 18, 2026

@github-actions
Copy link

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (security) Replace execSync with execFileSync to prevent command injection by fix-it-felix-sentry[bot] in #23

Internal Changes 🔧

Release

  • Fix changelog-preview permissions by BYK in #22
  • Bump Craft version to fix issues by BYK in #20
  • Switch from action-prepare-release to Craft by BYK in #18

Other

  • Use pull_request_target for changelog preview by BYK in #21
  • macos-13 deprecation by timfish in #19
  • Build Linux in container for wider glibc support by timfish in #16

🤖 This preview updates automatically when you update the PR.

@timfish timfish enabled auto-merge (squash) February 19, 2026 10:59
@timfish timfish merged commit 593922b into main Feb 19, 2026
65 checks passed
@timfish timfish deleted the fix/js-1460-command-injection branch February 19, 2026 10:59
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