Skip to content

Commit 446765b

Browse files
author
Alvaro Muñoz
committed
Update Cache Poisoning rule
1 parent 731889b commit 446765b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ql/src/Security/CWE-349/CachePoisoning.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ import codeql.actions.security.PoisonableSteps
1818

1919
from LocalJob j, PRHeadCheckoutStep checkout, Step s
2020
where
21-
// Excluding privileged workflows since they can be easily exploited in similar circumstances
22-
not j.isPrivileged() and
2321
// The workflow runs in the context of the default branch
2422
runsOnDefaultBranch(j) and
2523
// The job checkouts untrusted code from a pull request
24+
// TODO: Consider adding artifact downloads as a potential source of cache poisoning
2625
j.getAStep() = checkout and
2726
(
2827
// The job writes to the cache
@@ -33,7 +32,9 @@ where
3332
// The job executes checked-out code
3433
// (The cache specific token can be leaked even for non-privileged workflows)
3534
checkout.getAFollowingStep() = s and
36-
s instanceof PoisonableStep
35+
s instanceof PoisonableStep and
36+
// Excluding privileged workflows since they can be easily exploited in similar circumstances
37+
not j.isPrivileged()
3738
)
3839
select checkout, "Potential cache poisoning in the context of the default branch on step $@.", s,
3940
s.toString()

0 commit comments

Comments
 (0)