Harden dynamic exec arguments in experiments/dependabot paths - #52905
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Hardens experiment-state Git access and Dependabot lockfile generation against unsafe dynamic execution.
Changes:
- Validates Git
showobject arguments. - Disables npm lifecycle scripts during lockfile generation.
- Adds focused regression tests.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/experiments_command.go |
Adds Git object-argument validation. |
pkg/cli/experiments_command_test.go |
Tests accepted and rejected Git arguments. |
pkg/workflow/dependabot.go |
Disables npm lifecycle scripts. |
pkg/workflow/dependabot_test.go |
Verifies npm arguments and environment. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
| // buildSafeGitShowObjectArg validates git show's "ref:path" object argument parts | ||
| // before joining them, preventing flag and path-traversal style injections. | ||
| func buildSafeGitShowObjectArg(ref, fileName string) (string, error) { | ||
| if !isSafeGitRevisionArg(ref) { |
|
Warning Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs for details. @copilot Quick triage for maintainer-ready follow-up: Please refresh the branch if needed, review the current security hardening changes with the Outstanding review items (newest first):
Failed checks from the compact candidate set:
Branch update was requested automatically for this run when GitHub allows it.
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in
Validation run:
|
|
🎉 This pull request is included in a new release. Release: |
Sighthound reported high-confidence command-injection findings around dynamic
exec.Commandarguments. Most call sites were already shell-safe; this change closes remaining gaps by enforcing strict argument validation and preventing npm lifecycle-script execution in lockfile generation.Git
showargument hardening (pkg/cli/experiments_command.go)buildSafeGitShowObjectArg(ref, fileName)to validate both components before buildingref:path.isSafeGitTreePath(fileName)to reject unsafe path forms (flag-like values, traversal, absolute paths, separators/characters not valid for git tree-path intent).Dependabot lockfile generation hardening (
pkg/workflow/dependabot.go)npm install --package-lock-only --ignore-scriptsNPM_CONFIG_IGNORE_SCRIPTS=trueFocused regression coverage
ref:fileconstruction inpkg/cli/experiments_command_test.go.pkg/workflow/dependabot_test.go.Warning
Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.
What happened
The threat detection engine failed to produce results.
Review the workflow run logs for details.
Branch refresh requested by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/31890765464> Generated by 👨🍳 PR Sous Chef · gpt54 · 11.2 AIC · ⊞ 8.7K · ◷
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output.
Review the workflow run logs for details.