Skip to content

Commit f2017b6

Browse files
committed
Correct wildcard path typing
1 parent 869c399 commit f2017b6

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

actions/ql/src/Security/CWE-829/UntrustedCheckoutCritical.ql

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ private string getUnnormalizedLocalScriptPath(LocalScriptExecutionRunStep step)
4545

4646
private class ExecutionPathInput extends NormalizableFilepath {
4747
ExecutionPathInput() {
48-
exists(LocalScriptExecutionRunStep |
49-
this = trimQuotes(getUnnormalizedLocalScriptPath(_))
50-
)
48+
this = trimQuotes(getUnnormalizedLocalScriptPath(_))
5149
or
5250
exists(LocalActionUsesStep step | this = step.getCallee())
5351
}
@@ -119,20 +117,16 @@ where
119117
(
120118
// Check if the poisonable step is a local script execution step
121119
// and the path of the command or script matches the path of the downloaded artifact
122-
(
123-
poisonable instanceof LocalScriptExecutionRunStep and
124-
checkoutContainsPath(checkout,
125-
getUnnormalizedLocalScriptPath(poisonable), poisonable.getPath())
126-
)
120+
poisonable instanceof LocalScriptExecutionRunStep and
121+
checkoutContainsPath(checkout, getUnnormalizedLocalScriptPath(poisonable),
122+
poisonable.(LocalScriptExecutionRunStep).getPath())
127123
or
128124
// Checking the path for non local script execution steps is very difficult
129-
(
130-
poisonable instanceof Run and
131-
not poisonable instanceof LocalScriptExecutionRunStep
132-
)
125+
poisonable instanceof Run and
126+
not poisonable instanceof LocalScriptExecutionRunStep
127+
or
133128
// Its not easy to extract the path from a non-local script execution step so skipping this check for now
134129
// and isSubpath(poisonable.(Run).getWorkingDirectory(), checkout.getPath())
135-
or
136130
poisonable instanceof UsesStep and
137131
(
138132
not poisonable instanceof LocalActionUsesStep and

0 commit comments

Comments
 (0)