Skip to content

Commit c9bb42a

Browse files
author
Alvaro Muñoz
committed
Enforce a checkout kind of trigger to consider gh pr/gh api ... pulls as a source of untrusted data
1 parent 6298f25 commit c9bb42a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

ql/lib/codeql/actions/dataflow/FlowSources.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ class GhCLICommandSource extends RemoteFlowSource, CommandSource {
129129
run.getScript().getAStmt() = cmd and
130130
cmd.indexOf("gh ") = 0 and
131131
untrustedGhCommandDataModel(cmd_regex, flag) and
132-
cmd.regexpMatch(cmd_regex + ".*")
132+
cmd.regexpMatch(cmd_regex + ".*") and
133+
(
134+
cmd.regexpMatch(".*\\b(pr|pulls)\\b.*") and
135+
run.getATriggerEvent().getName() = checkoutTriggers()
136+
or
137+
not cmd.regexpMatch(".*\\b(pr|pulls)\\b.*")
138+
)
133139
)
134140
}
135141

0 commit comments

Comments
 (0)