Fix script injection (S7630) in maintenance workflow Record outputs steps#39578
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix injection warnings from Sonar in generated maintenance workflow
Fix script injection (S7630) in maintenance workflow Jun 16, 2026
Record outputs steps
pelikhan
approved these changes
Jun 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR mitigates GitHub Actions expression/script injection sinks (Sonar githubactions:S7630 / CodeQL actions/expression-injection) in the generated maintenance workflow by avoiding direct interpolation of inputs.* values into shell run: blocks.
Changes:
- Updates two generated
Record outputssteps to passinputs.operation/inputs.run_urlviaenvand reference them as shell variables inrun:. - Applies the same
envindirection fix to the side-repo maintenance workflow generator. - Regenerates the
objective-impact-reportcompiled lock workflow metadata (body hash).
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/maintenance_workflow_yaml.go | Moves inputs.operation and inputs.run_url out of run: interpolation in Record outputs steps by introducing env variables. |
| pkg/workflow/side_repo_maintenance.go | Applies the same inputs.run_url → env indirection pattern in the generated Record outputs step. |
| .github/workflows/objective-impact-report.lock.yml | Updates generated metadata body_hash (appears unrelated to the maintenance workflow injection fix). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
| @@ -1,4 +1,4 @@ | |||
| # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e357ecaf2b1bac669b156ce98fc34afb31faf80acf85b19f4b1cd9069ab7aca6","body_hash":"24d3f0499ec3d16953e9b5b48edfdc9b9887e87b9de4c92c2955b04698b04122","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.60"}} | |||
| # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e357ecaf2b1bac669b156ce98fc34afb31faf80acf85b19f4b1cd9069ab7aca6","body_hash":"978c9220dcee75830e508fe03ceb61df8818787eac3aa9325c1624699a03a99c","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.60"}} | |||
Contributor
|
@copilot review all comments and address unresolved review feedback.
|
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.
${{ inputs.operation }}and${{ inputs.run_url }}were interpolated directly into shellrunblocks in the generated maintenance workflow, making them GitHub Actions script-injection sinks (Sonargithubactions:S7630/ CodeQLactions/expression-injection).Changes
pkg/workflow/maintenance_workflow_yaml.go— twoRecord outputssteps fixed:run_operationjob:inputs.operationmoved to env varapply_safe_outputsjob:inputs.run_urlmoved to env varpkg/workflow/side_repo_maintenance.go— sameapply_safe_outputspattern fixedApplies the env-indirection pattern already used by the adjacent
Run operationandApply Safe Outputssteps in both files:Downstream consumers of generated workflows receive the fix on their next
gh aw compile.