@@ -17,24 +17,25 @@ import codeql.actions.security.UseOfUnversionedImmutableAction
1717bindingset [ version]
1818private predicate isPinnedCommit ( string version ) { version .regexpMatch ( "^[A-Fa-f0-9]{40}$" ) }
1919
20- bindingset [ repo]
21- private predicate isTrustedOrg ( string repo ) {
22- repo .matches ( [ "actions" , "github" , "advanced-security" ] + "/%" )
20+ bindingset [ nwo]
21+ private predicate isTrustedOwner ( string nwo ) {
22+ // Gets the segment before the first '/' in the name with owner(nwo) string
23+ trustedActionsOwner ( nwo .substring ( 0 , nwo .indexOf ( "/" ) ) )
2324}
2425
25- from UsesStep uses , string repo , string version , Workflow workflow , string name
26+ from UsesStep uses , string nwo , string version , Workflow workflow , string name
2627where
27- uses .getCallee ( ) = repo and
28+ uses .getCallee ( ) = nwo and
2829 uses .getEnclosingWorkflow ( ) = workflow and
2930 (
3031 workflow .getName ( ) = name
3132 or
3233 not exists ( workflow .getName ( ) ) and workflow .getLocation ( ) .getFile ( ) .getBaseName ( ) = name
3334 ) and
3435 uses .getVersion ( ) = version and
35- not isTrustedOrg ( repo ) and
36+ not isTrustedOwner ( nwo ) and
3637 not isPinnedCommit ( version ) and
37- not isImmutableAction ( uses , repo )
38+ not isImmutableAction ( uses , nwo )
3839select uses .getCalleeNode ( ) ,
39- "Unpinned 3rd party Action '" + name + "' step $@ uses '" + repo + "' with ref '" + version +
40+ "Unpinned 3rd party Action '" + name + "' step $@ uses '" + nwo + "' with ref '" + version +
4041 "', not a pinned commit hash" , uses , uses .toString ( )
0 commit comments