Skip to content

Commit 71bc89b

Browse files
Fix query
Fix various issues with the query.
1 parent 9a29ceb commit 71bc89b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bindingset[version]
2727
private predicate isPinnedContainer(string version) { version.regexpMatch("^sha256:[A-Fa-f0-9]{64}$") }
2828

2929
bindingset[nwo]
30-
private predicate isContainerImage(string nwo) { version.regexpMatch("^docker:\/\/.*") }
30+
private predicate isContainerImage(string nwo) { nwo.regexpMatch("^docker://.+") }
3131

3232
from UsesStep uses, string nwo, string version, Workflow workflow, string name
3333
where
@@ -39,17 +39,17 @@ where
3939
not exists(workflow.getName()) and workflow.getLocation().getFile().getBaseName() = name
4040
) and
4141
uses.getVersion() = version and
42-
isContainerImage(nwo) = isContainer and
4342
not isTrustedOwner(nwo) and
44-
not isImmutableAction(uses, nwo)
45-
not (
43+
not isImmutableAction(uses, nwo) and
44+
not
45+
(
4646
(
47-
isContainer and
48-
isPinnedCommit(version)
47+
isContainerImage(nwo) and
48+
isPinnedContainer(version)
4949
)
5050
or
5151
(
52-
not isContainer and
52+
not isContainerImage(nwo) and
5353
isPinnedCommit(version)
5454
)
5555
)

0 commit comments

Comments
 (0)