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@v4
- 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.

🟠 High · Pull requests can expose workflow token

When an untrusted PR supplies files that trigger code execution or an exploitable path while the Cppcheck action processes its checkout, a malicious PR can make the privileged pull_request_target job check out and process attacker-controlled files with linuxdeepin/action-cppcheck@main; if that processing executes attacker-controlled code or is exploited, the action's ${{ secrets.GITHUB_TOKEN }} is exposed. The token can then be used with the permissions granted to this workflow.

Run analysis of untrusted PR contents without a privileged token, and perform any token-bearing reporting in a separate trusted job that does not check out or execute the PR head.

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

**Pull requests can expose workflow token**

When an untrusted PR supplies files that trigger code execution or an exploitable path while the Cppcheck action processes its checkout, a malicious PR can make the privileged `pull_request_target` job check out and process attacker-controlled files with `linuxdeepin/action-cppcheck@main`; if that processing executes attacker-controlled code or is exploited, the action's `${{ secrets.GITHUB_TOKEN }}` is exposed. The token can then be used with the permissions granted to this workflow.

Run analysis of untrusted PR contents without a privileged token, and perform any token-bearing reporting in a separate trusted job that does not check out or execute the PR head.

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