Skip to content

Commit dfeefe0

Browse files
author
Alvaro Muñoz
committed
Consider actor and association checks as bypassable checks ONLY for issueOps
1 parent 84d4c57 commit dfeefe0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUCritical.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import actions
1515
import codeql.actions.security.UntrustedCheckoutQuery
1616
import codeql.actions.security.PoisonableSteps
1717

18-
from LabelControlCheck check, MutableRefCheckoutStep checkout
18+
from ControlCheck check, MutableRefCheckoutStep checkout
1919
where
2020
// the mutable checkout step is protected by an access check
2121
check = [checkout.getIf(), checkout.getEnclosingJob().getIf()] and
2222
// the checked-out code may lead to arbitrary code execution
2323
checkout.getAFollowingStep() instanceof PoisonableStep and
2424
(
25+
// label gates do not depend on the triggering event
2526
check instanceof LabelControlCheck
2627
or
28+
// actor or Association gates apply to IssueOps only
2729
(check instanceof AssociationControlCheck or check instanceof ActorControlCheck) and
2830
check.getEnclosingJob().getATriggerEvent().getName().matches("%_comment")
2931
)

ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUHigh.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import actions
1515
import codeql.actions.security.UntrustedCheckoutQuery
1616
import codeql.actions.security.PoisonableSteps
1717

18-
from LabelControlCheck check, MutableRefCheckoutStep checkout
18+
from ControlCheck check, MutableRefCheckoutStep checkout
1919
where
2020
// the mutable checkout step is protected by an access check
2121
check = [checkout.getIf(), checkout.getEnclosingJob().getIf()] and
2222
// there are no evidences that the checked-out code can lead to arbitrary code execution
2323
not checkout.getAFollowingStep() instanceof PoisonableStep and
2424
(
25+
// label gates do not depend on the triggering event
2526
check instanceof LabelControlCheck
2627
or
28+
// actor or Association gates apply to IssueOps only
2729
(check instanceof AssociationControlCheck or check instanceof ActorControlCheck) and
2830
check.getEnclosingJob().getATriggerEvent().getName().matches("%_comment")
2931
)

0 commit comments

Comments
 (0)