Repository navigation
ci: update status when action triggered by issue comment #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: linux-system-roles/certificate
Length of output: 16262
🤖 get_repo_knowledge executed:
get_repo_knowledge linux-system-roles/certificate /tmp/coderabbit-repo-knowledge/linux-system-roles-certificate-d4f1c4a0/conventionsLength of output: 2270
🌐 Web query:
GitHub Actions issue_comment workflow checkout pull request fork GITHUB_TOKEN write permissions untrusted code compromised runners persist-credentials false💡 Result:
Using the issue_comment trigger in GitHub Actions to handle pull request interactions from forks presents a significant security risk, often referred to as a pwn request [1][2][3]. Because issue_comment workflows run in the context of the base repository, they are granted a read/write GITHUB_TOKEN and access to repository secrets by default [4][5]. When such a workflow checks out code from an untrusted fork and executes it (e.g., via scripts or local actions), an attacker can compromise the runner, steal secrets, or exfiltrate the GITHUB_TOKEN to gain unauthorized write access to the repository [1][6][7]. To secure these workflows, apply the following defenses: 1. Use explicit, minimal permissions: Never rely on default permissions. Define a permissions block at the workflow or job level that strictly limits the GITHUB_TOKEN to the minimum required scopes (e.g., only issues: write or contents: read if applicable) [8][6][9]. 2. Set persist-credentials: false: When using actions/checkout, set persist-credentials: false unless the job explicitly requires performing Git operations (like pushing commits) [10][9][11]. This prevents the GITHUB_TOKEN from being written to the local.git/config, which mitigates the risk of credential exposure if the runner environment is compromised [12][10][9]. 3. Isolate privileged operations: Follow the unprivileged-to-privileged pattern. Use an unprivileged workflow (e.g., triggered by pull_request) to process untrusted code and store results in artifacts [13][5]. Then, use a separate, privileged workflow (e.g., triggered by workflow_run) to consume those artifacts and perform tasks requiring secrets or write access [13][5]. 4. Avoid executing untrusted code: If a workflow must run on a privileged trigger like issue_comment, avoid checking out and executing code from the PR or fork [4][7]. If you must interact with PR metadata, validate the actor's authority or use hardened logic that does not interpret user-supplied content as executable code [9][11]. By combining these practices, you limit the blast radius of a potential compromise and prevent attackers from weaponizing privileged triggers [2][9].
Citations:
Security Misconfiguration (CWE-250)
Reachability: External · Exploitability: Moderate
Separate commit-status writes from PR-code execution.
These
issue_commentjobs execute fork PR code withstatuses: write. Remove this permission from the execution jobs. Run status reporting in separate jobs that do not check out PR code..github/workflows/ansible-lint.yml.github/workflows/ansible-managed-var-comment.yml.github/workflows/ansible-test.yml📍 Affects 3 files
.github/workflows/ansible-lint.yml#L27-L28(this comment).github/workflows/ansible-managed-var-comment.yml#L24-L25.github/workflows/ansible-test.yml#L27-L28🤖 Prompt for AI Agents