Skip to content

Commit a2503dd

Browse files
committed
fix default_branch_name visibility
1 parent cae29e0 commit a2503dd

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

ql/lib/codeql/actions/security/CachePoisoningQuery.qll

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,35 @@ predicate runsOnDefaultBranch(Job j) {
1515
exists(Event e |
1616
j.getATriggerEvent() = e and
1717
exists(string default_branch_name |
18-
repositoryDataModel(_, default_branch_name)
19-
) and
20-
(
21-
e.getName() = defaultBranchTriggerEvent() and
22-
not e.getName() = "pull_request_target"
23-
or
24-
e.getName() = "push" and
25-
e.getAPropertyValue("branches") = default_branch_name
26-
or
27-
e.getName() = "pull_request_target" and
18+
repositoryDataModel(_, default_branch_name) and
2819
(
29-
// no filtering
30-
not e.hasProperty("branches") and not e.hasProperty("branches-ignore")
31-
or
32-
// only branches-ignore filter
33-
e.hasProperty("branches-ignore") and
34-
not e.hasProperty("branches") and
35-
not e.getAPropertyValue("branches-ignore") = default_branch_name
20+
e.getName() = defaultBranchTriggerEvent() and
21+
not e.getName() = "pull_request_target"
3622
or
37-
// only branches filter
38-
e.hasProperty("branches") and
39-
not e.hasProperty("branches-ignore") and
23+
e.getName() = "push" and
4024
e.getAPropertyValue("branches") = default_branch_name
4125
or
42-
// branches and branches-ignore filters
43-
e.hasProperty("branches") and
44-
e.hasProperty("branches-ignore") and
45-
e.getAPropertyValue("branches") = default_branch_name and
46-
not e.getAPropertyValue("branches-ignore") = default_branch_name
26+
e.getName() = "pull_request_target" and
27+
(
28+
// no filtering
29+
not e.hasProperty("branches") and not e.hasProperty("branches-ignore")
30+
or
31+
// only branches-ignore filter
32+
e.hasProperty("branches-ignore") and
33+
not e.hasProperty("branches") and
34+
not e.getAPropertyValue("branches-ignore") = default_branch_name
35+
or
36+
// only branches filter
37+
e.hasProperty("branches") and
38+
not e.hasProperty("branches-ignore") and
39+
e.getAPropertyValue("branches") = default_branch_name
40+
or
41+
// branches and branches-ignore filters
42+
e.hasProperty("branches") and
43+
e.hasProperty("branches-ignore") and
44+
e.getAPropertyValue("branches") = default_branch_name and
45+
not e.getAPropertyValue("branches-ignore") = default_branch_name
46+
)
4747
)
4848
)
4949
)

0 commit comments

Comments
 (0)