Skip to content
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

Sequester issue_comment triggered untrusted checkout from other triggers #18838

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KyFaSt
Copy link
Contributor

@KyFaSt KyFaSt commented Feb 21, 2025

issue_comment triggered untrusted checkouts present a security risk but mitigating the risk cannot be done wholly in the workflow relying on the event and those mitigations cannot be detected by CodeQL so these triggers should be moved to separate alerts with level warning. See https://github.blog/security/application-security/how-to-secure-your-github-actions-workflows-with-codeql/#issueoops-security-pitfalls-with-issue_comment-trigger for more details.

I removed the issue_comment trigger from the untrusted checkout high and critical and created new alerts with mitigation advice more suited towards issue_comment. I think it's important to warn developers about the risks of this workflow trigger, but understand it may not be possible for projects that rely heavily on IssueOps

* issue_comment triggered untrusted checkouts present a security risk but
  mitigating the risk cannot be done wholly in the workflow relying on the event
  and those mitigations cannot be detected by CodeQL so these triggers should be
  moved to separate alerts with level warning
@Copilot Copilot bot review requested due to automatic review settings February 21, 2025 19:14
@KyFaSt KyFaSt requested a review from a team as a code owner February 21, 2025 19:14
@github-actions github-actions bot added documentation Actions Analysis of GitHub Actions labels Feb 21, 2025

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

}

string issueCommentTriggers() {
result = ["issue_comment"]

Check warning

Code scanning / CodeQL

Singleton set literal Warning

Singleton set literal can be replaced by its member.
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout")) and
not exists(ControlCheck check | check.protects(poisonable, event, "untrusted-checkout"))
select poisonable, checkout, poisonable,
"Potential execution of untrusted code on a privileged workflow ($@)", event, event.getName()

Check warning

Code scanning / CodeQL

Alert message style violation Warning

Alert message should end with a full stop.
inPrivilegedContext(checkout, event) and
event.getName() = issueCommentTriggers() and
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout"))
select checkout, "Potential execution of untrusted code on a privileged workflow ($@)", event,

Check warning

Code scanning / CodeQL

Alert message style violation Warning

Alert message should end with a full stop.
@@ -0,0 +1 @@
Security/CWE-829/UntrustedCheckoutIssueCommentCritical.ql

Check warning

Code scanning / CodeQL

Query test without inline test expectations Warning test

Query test does not use inline test expectations.
@@ -0,0 +1 @@
Security/CWE-829/UntrustedCheckoutIssueCommentHigh.ql

Check warning

Code scanning / CodeQL

Query test without inline test expectations Warning test

Query test does not use inline test expectations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Analysis of GitHub Actions documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant