@@ -125,8 +125,6 @@ class LegitLabsDownloadArtifactActionStep extends UntrustedArtifactDownloadStep,
125
125
}
126
126
127
127
class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep , UsesStep {
128
- string script ;
129
-
130
128
ActionsGitHubScriptDownloadStep ( ) {
131
129
// eg:
132
130
// - uses: actions/github-script@v6
@@ -149,12 +147,14 @@ class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep, Use
149
147
// var fs = require('fs');
150
148
// fs.writeFileSync('${{github.workspace}}/test-results.zip', Buffer.from(download.data));
151
149
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
+ )
158
158
}
159
159
160
160
override string getPath ( ) {
@@ -171,10 +171,10 @@ class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep, Use
171
171
.getScript ( )
172
172
.getACommand ( )
173
173
.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
+ )
178
178
}
179
179
}
180
180
@@ -207,12 +207,13 @@ class GHRunArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
207
207
.getScript ( )
208
208
.getACommand ( )
209
209
.regexpCapture ( unzipRegexp ( ) + unzipDirArgRegexp ( ) , 3 ) ) )
210
- else
211
- if
210
+ else (
211
+ (
212
212
this .getAFollowingStep ( ) .( Run ) .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) ) or
213
213
this .getScript ( ) .getACommand ( ) .regexpMatch ( unzipRegexp ( ) )
214
- then result = "GITHUB_WORKSPACE/"
215
- else none ( )
214
+ ) and
215
+ result = "GITHUB_WORKSPACE/"
216
+ )
216
217
}
217
218
}
218
219
@@ -259,15 +260,15 @@ class DirectArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
259
260
260
261
class ArtifactPoisoningSink extends DataFlow:: Node {
261
262
UntrustedArtifactDownloadStep download ;
262
- PoisonableStep poisonable ;
263
263
264
264
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
+ |
271
272
poisonable .( Run ) .getScript ( ) = this .asExpr ( ) and
272
273
(
273
274
// Check if the poisonable step is a local script execution step
0 commit comments