@@ -125,8 +125,6 @@ class LegitLabsDownloadArtifactActionStep extends UntrustedArtifactDownloadStep,
125125}
126126
127127class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep , UsesStep {
128- string script ;
129-
130128 ActionsGitHubScriptDownloadStep ( ) {
131129 // eg:
132130 // - uses: actions/github-script@v6
@@ -149,12 +147,14 @@ class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep, Use
149147 // var fs = require('fs');
150148 // fs.writeFileSync('${{github.workspace}}/test-results.zip', Buffer.from(download.data));
151149 this .getCallee ( ) = "actions/github-script" and
152- this .getArgument ( "script" ) = script and
153- script .matches ( "%listWorkflowRunArtifacts(%" ) and
154- script .matches ( "%downloadArtifact(%" ) and
155- script .matches ( "%writeFileSync(%" ) and
156- // Filter out artifacts that were created by pull-request.
157- not script .matches ( "%exclude_pull_requests: true%" )
150+ exists ( string script |
151+ this .getArgument ( "script" ) = script and
152+ script .matches ( "%listWorkflowRunArtifacts(%" ) and
153+ script .matches ( "%downloadArtifact(%" ) and
154+ script .matches ( "%writeFileSync(%" ) and
155+ // Filter out artifacts that were created by pull-request.
156+ not script .matches ( "%exclude_pull_requests: true%" )
157+ )
158158 }
159159
160160 override string getPath ( ) {
@@ -171,10 +171,10 @@ class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep, Use
171171 .getScript ( )
172172 .getACommand ( )
173173 .regexpCapture ( unzipRegexp ( ) + unzipDirArgRegexp ( ) , 3 ) ) )
174- else
175- if this .getAFollowingStep ( ) .( Run ) .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) )
176- then result = "GITHUB_WORKSPACE/"
177- else none ( )
174+ else (
175+ this .getAFollowingStep ( ) .( Run ) .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) ) and
176+ result = "GITHUB_WORKSPACE/"
177+ )
178178 }
179179}
180180
@@ -207,12 +207,13 @@ class GHRunArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
207207 .getScript ( )
208208 .getACommand ( )
209209 .regexpCapture ( unzipRegexp ( ) + unzipDirArgRegexp ( ) , 3 ) ) )
210- else
211- if
210+ else (
211+ (
212212 this .getAFollowingStep ( ) .( Run ) .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) ) or
213213 this .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) )
214- then result = "GITHUB_WORKSPACE/"
215- else none ( )
214+ ) and
215+ result = "GITHUB_WORKSPACE/"
216+ )
216217 }
217218}
218219
@@ -259,15 +260,15 @@ class DirectArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
259260
260261class ArtifactPoisoningSink extends DataFlow:: Node {
261262 UntrustedArtifactDownloadStep download ;
262- PoisonableStep poisonable ;
263263
264264 ArtifactPoisoningSink ( ) {
265- download .getAFollowingStep ( ) = poisonable and
266- // excluding artifacts downloaded to the temporary directory
267- not download .getPath ( ) .regexpMatch ( "^/tmp.*" ) and
268- not download .getPath ( ) .regexpMatch ( "^\\$\\{\\{\\s*runner\\.temp\\s*}}.*" ) and
269- not download .getPath ( ) .regexpMatch ( "^\\$RUNNER_TEMP.*" ) and
270- (
265+ exists ( PoisonableStep poisonable |
266+ download .getAFollowingStep ( ) = poisonable and
267+ // excluding artifacts downloaded to the temporary directory
268+ not download .getPath ( ) .regexpMatch ( "^/tmp.*" ) and
269+ not download .getPath ( ) .regexpMatch ( "^\\$\\{\\{\\s*runner\\.temp\\s*}}.*" ) and
270+ not download .getPath ( ) .regexpMatch ( "^\\$RUNNER_TEMP.*" )
271+ |
271272 poisonable .( Run ) .getScript ( ) = this .asExpr ( ) and
272273 (
273274 // Check if the poisonable step is a local script execution step
0 commit comments