@@ -208,28 +208,33 @@ class Workflow extends AstNode instanceof WorkflowImpl {
208
208
209
209
predicate hasSingleTrigger ( string trigger ) {
210
210
this .getATriggerEvent ( ) = trigger and
211
- count ( string t | this .getATriggerEvent ( ) = t | t ) = 1
211
+ count ( this .getATriggerEvent ( ) ) = 1
212
212
}
213
213
214
214
predicate isPrivileged ( ) {
215
215
// The Workflow has a permission to write to some scope
216
- this .getPermissions ( ) .getAPermission ( ) = "write" and
216
+ this .getPermissions ( ) .getAPermission ( ) = "write"
217
+ or
217
218
// The Workflow accesses a secret
218
219
exists ( SecretsExpression expr |
219
220
expr .getEnclosingWorkflow ( ) = this and not expr .getFieldName ( ) = "GITHUB_TOKEN"
220
221
)
221
222
or
222
223
// The Workflow is triggered by an event other than `pull_request`
223
- not this .hasSingleTrigger ( "pull_request" )
224
+ count ( this .getATriggerEvent ( ) ) = 1 and
225
+ not this .getATriggerEvent ( ) = [ "pull_request" , "workflow_call" ]
224
226
or
225
227
// The Workflow is only triggered by `workflow_call` and there is
226
228
// a caller workflow triggered by an event other than `pull_request`
227
229
this .hasSingleTrigger ( "workflow_call" ) and
228
230
exists ( ExternalJob call , Workflow caller |
229
231
call .getCallee ( ) = this .getLocation ( ) .getFile ( ) .getRelativePath ( ) and
230
232
caller = call .getWorkflow ( ) and
231
- not caller .hasSingleTrigger ( "pull_request" )
233
+ caller .isPrivileged ( )
232
234
)
235
+ or
236
+ // The Workflow has multiple triggers so at least one is ont "pull_request"
237
+ count ( this .getATriggerEvent ( ) ) > 1
233
238
}
234
239
}
235
240
0 commit comments