Test Superagent CI/CD workflow review comments#329
Closed
homanp wants to merge 1 commit into
Closed
Conversation
Contributor License AgreementAll contributors are covered by a CLA. |
| - name: Echo PR metadata | ||
| if: github.event_name == 'pull_request' | ||
| run: echo "PR title is ${{ github.event.pull_request.title }}" | ||
|
|
There was a problem hiding this comment.
P0: Shell command injection via PR title template interpolation
run step interpolates untrusted PR title directly into a shell command.
Pass the PR title via an env variable to prevent shell injection.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name=".github/workflows/typecheck.yml">
<violation number="1" location=".github/workflows/typecheck.yml:21">
<priority>P0</priority>
<title>Shell command injection via PR title template interpolation</title>
<evidence>run: echo "PR title is ${{ github.event.pull_request.title }}"</evidence>
<recommendation>Move the interpolated value to an environment variable so the shell receives it as a literal string. For example, add an env block: env:
PR_TITLE: ${{ github.event.pull_request.title }}
and change the run step to: run: echo "PR title is $PR_TITLE".</recommendation>
</violation>
</file>
| branches: [ main, develop ] | ||
|
|
||
| permissions: write-all | ||
|
|
There was a problem hiding this comment.
P1: Workflow grants overly broad write-all permissions
Workflow declares broad permissions: write-all, giving excessive GITHUB_TOKEN privileges.
Replace write-all with least-privilege permissions scoped per job.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name=".github/workflows/typecheck.yml">
<violation number="1" location=".github/workflows/typecheck.yml:10">
<priority>P1</priority>
<title>Workflow grants overly broad write-all permissions</title>
<evidence>permissions: write-all</evidence>
<recommendation>Replace the broad workflow-scoped `permissions: write-all` with least-privilege permissions. Add `permissions: {}` at the workflow level and grant only the specific permissions each job requires (e.g., `contents: read` for checkout and `pull-requests: read` if needed).</recommendation>
</violation>
</file>
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.
Summary
Intentional workflow hardening test for Superagent PR security scanning. This PR modifies
.github/workflows/typecheck.ymlwith patterns the CI/CD scanner should flag so we can verify inline review comments on workflow files.Do not merge. Close after validating Superagent comments/checks.
Changes
permissions: write-allat workflow scoperunstep that interpolates${{ github.event.pull_request.title }}directly in shellTest plan
.github/workflows/typecheck.ymlwithci_cdfindings