Skip to content

Commit ba80186

Browse files
committed
Fix redundant casts and clarify actor-check wording
1 parent 58240fb commit ba80186

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

actions/ql/src/experimental/Security/CWE-290/SpoofableActorCheck.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Many workflows use `github.actor` or `github.triggering_actor` to check if a specific bot (such as Dependabot or Renovate) triggered the workflow, and then bypass security checks or perform privileged actions. However, `github.actor` refers to the last actor to perform an "action" on the triggering context, not necessarily the actor that actually caused the trigger.
44

5-
An attacker can exploit this by creating a pull request where the HEAD commit has `github.actor == 'dependabot[bot]'` but the rest of the branch history contains attacker-controlled code, bypassing the actor check.
5+
An attacker can exploit this by creating a pull request where the workflow run's `github.actor` is `'dependabot[bot]'` (for example, because Dependabot was the latest actor on the PR), but the branch contains attacker-controlled code, bypassing the actor check.
66

77
## Recommendation
88

actions/ql/src/experimental/Security/CWE-798/HardcodedContainerCredentials.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ YamlScalar getAHardcodedPassword(LocalJobImpl job, string context) {
2424
exists(YamlMapping creds |
2525
// Job-level container credentials
2626
creds =
27-
job.getNode().lookup("container").(YamlMapping).lookup("credentials").(YamlMapping) and
27+
job.getNode().lookup("container").(YamlMapping).lookup("credentials") and
2828
context = "container"
2929
or
3030
// Service-level container credentials
3131
exists(YamlMapping service |
32-
service = job.getNode().lookup("services").(YamlMapping).lookup(_).(YamlMapping) and
33-
creds = service.lookup("credentials").(YamlMapping) and
32+
service = job.getNode().lookup("services").(YamlMapping).lookup(_) and
33+
creds = service.lookup("credentials") and
3434
context = "service"
3535
)
3636
|
37-
result = creds.lookup("password").(YamlScalar) and
37+
result = creds.lookup("password") and
3838
// Not a ${{ }} expression reference (e.g. ${{ secrets.PASSWORD }})
3939
not result.getValue().regexpMatch("\\$\\{\\{.*\\}\\}")
4040
)

0 commit comments

Comments
 (0)