Skip to content

Commit 4b199ee

Browse files
committed
Correct wildcard path typing
1 parent b633394 commit 4b199ee

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
@@ -41,9 +41,7 @@ private string getUnnormalizedLocalScriptPath(LocalScriptExecutionRunStep step)
4141

4242
private class ExecutionPathInput extends NormalizableFilepath {
4343
ExecutionPathInput() {
44-
exists(LocalScriptExecutionRunStep |
45-
this = trimQuotes(getUnnormalizedLocalScriptPath(_))
46-
)
44+
this = trimQuotes(getUnnormalizedLocalScriptPath(_))
4745
or
4846
exists(LocalActionUsesStep step | this = step.getCallee())
4947
}
@@ -111,20 +109,16 @@ where
111109
(
112110
// Check if the poisonable step is a local script execution step
113111
// and the path of the command or script matches the path of the downloaded artifact
114-
(
115-
poisonable instanceof LocalScriptExecutionRunStep and
116-
checkoutContainsPath(checkout,
117-
getUnnormalizedLocalScriptPath(poisonable), poisonable.getPath())
118-
)
112+
poisonable instanceof LocalScriptExecutionRunStep and
113+
checkoutContainsPath(checkout, getUnnormalizedLocalScriptPath(poisonable),
114+
poisonable.(LocalScriptExecutionRunStep).getPath())
119115
or
120116
// Checking the path for non local script execution steps is very difficult
121-
(
122-
poisonable instanceof Run and
123-
not poisonable instanceof LocalScriptExecutionRunStep
124-
)
117+
poisonable instanceof Run and
118+
not poisonable instanceof LocalScriptExecutionRunStep
119+
or
125120
// Its not easy to extract the path from a non-local script execution step so skipping this check for now
126121
// and isSubpath(poisonable.(Run).getWorkingDirectory(), checkout.getPath())
127-
or
128122
poisonable instanceof UsesStep and
129123
(
130124
not poisonable instanceof LocalActionUsesStep and

0 commit comments

Comments
 (0)