File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
actions/ql/src/Security/CWE-275 Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,23 @@ string permissionsForJob(Job job) {
2626 "{" + concat ( string permission | permission = jobNeedsPermission ( job ) | permission , ", " ) + "}"
2727}
2828
29+ predicate jobHasPermissions ( Job job ) {
30+ exists ( job .getPermissions ( ) )
31+ or
32+ exists ( job .getEnclosingWorkflow ( ) .getPermissions ( ) )
33+ or
34+ // The workflow is reusable and cannot be triggered in any other way; check callers
35+ exists ( ReusableWorkflow r | r = job .getEnclosingWorkflow ( ) |
36+ not exists ( Event e | e = r .getOn ( ) .getAnEvent ( ) | e .getName ( ) != "workflow_call" ) and
37+ forall ( Job caller | caller = job .getEnclosingWorkflow ( ) .( ReusableWorkflow ) .getACaller ( ) |
38+ jobHasPermissions ( caller )
39+ )
40+ )
41+ }
42+
2943from Job job , string permissions
3044where
31- not exists ( job .getPermissions ( ) ) and
32- not exists ( job .getEnclosingWorkflow ( ) .getPermissions ( ) ) and
45+ not jobHasPermissions ( job ) and
3346 // exists a trigger event that is not a workflow_call
3447 exists ( Event e |
3548 e = job .getATriggerEvent ( ) and
You can’t perform that action at this time.
0 commit comments