Repository navigation
Conversation
|
Thank you @homanp for contributing once again! 📊 PR overview
📝 Before reviewTo help maintainers review your changes efficiently, please ensure that:
✅ Continuous IntegrationTwo CI workflows will run automatically on this PR:
You can follow their progress in the Checks tab. 🤝 A note on collaborationWe value respectful and constructive interactions. Whether you are a contributor or a reviewer, please be patient, kind, and open to feedback. A maintainer will review your changes as soon as possible. If you have any questions, feel free to ask in this thread. |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | ||
| with: | ||
| script: | | ||
| const title = '${{ github.event.pull_request.title }}'; |
There was a problem hiding this comment.
P0: Untrusted pull request titles can inject JavaScript into a privileged pull_request_target job
PR title is spliced into privileged github-script JavaScript, allowing title-controlled code execution.
Read the title from context.payload or process.env; never interpolate it into executable script source.
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/pr-label-context.yml">
<violation number="1" location=".github/workflows/pr-label-context.yml:19">
<priority>P0</priority>
<title>Untrusted pull request titles can inject JavaScript into a privileged pull_request_target job</title>
<evidence>The workflow is triggered by pull_request_target at lines 3-5 and grants issues: write and pull-requests: write at lines 7-9. At line 19, the attacker-controlled github.event.pull_request.title is inserted directly between JavaScript string delimiters: const title = '${{ github.event.pull_request.title }}';. actions/github-script executes the resulting script, so a title containing JavaScript string-breaking syntax can alter the program and execute attacker-chosen JavaScript in the privileged runner context. The base revision has no pr-label-context.yml workflow; its existing welcome-pr workflow reads pull request metadata from context.payload inside the script rather than interpolating the title into executable source, so this is a newly introduced code-execution path.</evidence>
<recommendation>Do not interpolate pull request metadata into the github-script source. Pass the value through the action's environment and read it from process.env, or use the already available context.payload.pull_request.title inside the script. Keep the job least-privileged and avoid pull_request_target if write access is not required.</recommendation>
</violation>
</file>
Adds a workflow that records pull request titles in triage comments.
Integration test PR for the connected Superagent scanner. Leave this draft unmerged.