Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: export
- uses: actions/checkout@v3
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
allow-unsafe-pr-checkout: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Untrusted PR code enters privileged job

When an attacker-controlled PR head is checked out and its content reaches an unsafe execution or interpretation path in the scanner, a malicious PR can supply the checked-out workspace to linuxdeepin/action-cppcheck@main, which also receives GITHUB_TOKEN; if crafted input is executed or interpreted unsafely by the analysis step, the token is exposed or abused. The caller sees a compromised token-bearing workflow run.

Avoid checking out untrusted PR code in a pull_request_target job that receives a token; run analysis in an unprivileged pull_request workflow or isolate it and restrict token permissions.

Prompt for AI agents
In `.github/workflows/cppcheck.yml` at line 21:

**Untrusted PR code enters privileged job**

When an attacker-controlled PR head is checked out and its content reaches an unsafe execution or interpretation path in the scanner, a malicious PR can supply the checked-out workspace to `linuxdeepin/action-cppcheck@main`, which also receives `GITHUB_TOKEN`; if crafted input is executed or interpreted unsafely by the analysis step, the token is exposed or abused. The caller sees a compromised token-bearing workflow run.

Avoid checking out untrusted PR code in a `pull_request_target` job that receives a token; run analysis in an unprivileged `pull_request` workflow or isolate it and restrict token permissions.

- uses: linuxdeepin/action-cppcheck@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading