Repository navigation
fix: 🔒 Avoid parsing comment body via shell - #1012
Conversation
Signed-off-by: Evaline Ju <[email protected]>
|
/run-e2e |
E2E HyperShift Tests StartedTriggered by: @evaline-ju Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes. To re-run tests after new commits, comment |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
pdettori
left a comment
There was a problem hiding this comment.
Clean, focused security fix that eliminates a shell injection vulnerability in the E2E workflow. The approach — replacing bash parsing with JavaScript via actions/github-script — is the recommended GitHub Actions pattern. SHA pinning is consistent with the rest of the file, and the regex produces functionally equivalent results.
Areas reviewed: CI/GitHub Actions, Security
Commits: 1 commit, signed-off: ✅
CI status: All pass except E2E HyperShift (the workflow being modified — may be unrelated)
Verdict: APPROVE with one optional suggestion
Signed-off-by: Evaline Ju <[email protected]>
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
|
/run-e2e --extensions-ref test/kind-e2e-workflow |
E2E HyperShift Tests StartedTriggered by: @evaline-ju Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes. To re-run tests after new commits, comment |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
|
e2e hypershift tests seem to be struggling, and also appear to be running old versions of the script anyway |
The bash-based comment parser used ${{ github.event.comment.body }}
in shell context, which is vulnerable to command injection (same issue
fixed by rossoctl#1012 for --extensions-ref).
Rewrite the entire parser using actions/github-script (JavaScript)
where comment body is accessed via context.payload.comment.body safely.
Add strict regex validation for repo names and ref patterns.
Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
build.yaml: Move github.ref_name into env var to prevent shell injection via crafted git tags (e.g., v$(malicious-command)). cleanup-stale-hypershift-clusters.yaml: Move github.event.inputs.* into env vars to prevent injection via workflow_dispatch inputs. Both follow the pattern from rossoctl#1012: never interpolate user-controlled GitHub context values directly into shell run: blocks. Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
The bash-based comment parser used ${{ github.event.comment.body }}
in shell context, which is vulnerable to command injection (same issue
fixed by rossoctl#1012 for --extensions-ref).
Rewrite the entire parser using actions/github-script (JavaScript)
where comment body is accessed via context.payload.comment.body safely.
Add strict regex validation for repo names and ref patterns.
Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
build.yaml: Move github.ref_name into env var to prevent shell injection via crafted git tags (e.g., v$(malicious-command)). cleanup-stale-hypershift-clusters.yaml: Move github.event.inputs.* into env vars to prevent injection via workflow_dispatch inputs. Both follow the pattern from rossoctl#1012: never interpolate user-controlled GitHub context values directly into shell run: blocks. Signed-off-by: Ladislav Smola <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Ladislav Smola <[email protected]>
Summary
Comment body was being parsed directly in shell script, making this vulnerable to shell injections via
/run-e2ecommandsFixes https://github.com/kagenti/kagenti/security/code-scanning/188