Skip to content

Commit fefeae4

Browse files
author
Alvaro Muñoz
committed
feat: New query to report GITHUB_TOKEN exposed in artifacts
1 parent ac7b7b7 commit fefeae4

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @name Secret In Artifacts
3+
* @description Secrets are exposed in GitHub Artifacts
4+
* @kind problem
5+
* @problem.severity error
6+
* @security-severity 9.0
7+
* @precision high
8+
* @id actions/secrets-in-artifacts
9+
* @tags actions
10+
* security
11+
* experimental
12+
* external/cwe/cwe-312
13+
*/
14+
15+
import actions
16+
17+
from UsesStep checkout, UsesStep upload
18+
where
19+
checkout.getCallee() = "actions/checkout" and
20+
upload.getCallee() = "actions/upload-artifact" and
21+
checkout.getAFollowingStep() = upload and
22+
(
23+
not exists(checkout.getArgument("persist-credentials")) or
24+
checkout.getArgument("persist-credentials") = "true"
25+
) and
26+
upload.getVersion() =
27+
[
28+
"v4.3.6", "834a144ee995460fba8ed112a2fc961b36a5ec5a", //
29+
"v4.3.5", "89ef406dd8d7e03cfd12d9e0a4a378f454709029", //
30+
"v4.3.4", "0b2256b8c012f0828dc542b3febcab082c67f72b", //
31+
"v4.3.3", "65462800fd760344b1a7b4382951275a0abb4808", //
32+
"v4.3.2", "1746f4ab65b179e0ea60a494b83293b640dd5bba", //
33+
"v4.3.1", "5d5d22a31266ced268874388b861e4b58bb5c2f3", //
34+
"v4.3.0", "26f96dfa697d77e81fd5907df203aa23a56210a8", //
35+
"v4.2.0", "694cdabd8bdb0f10b2cea11669e1bf5453eed0a6", //
36+
"v4.1.0", "1eb3cb2b3e0f29609092a73eb033bb759a334595", //
37+
"v4.0.0", "c7d193f32edcb7bfad88892161225aeda64e9392", //
38+
]
39+
select upload, "A secret is exposed in a public artifact uploaded by $@", upload,
40+
"actions/upload-artifact"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: secrets-in-artifacts
2+
on:
3+
pull_request:
4+
jobs:
5+
test1:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: "Upload artifact"
10+
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
11+
with:
12+
name: file
13+
path: results
14+
test2:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: "Upload artifact"
19+
uses: actions/upload-artifact@v4
20+
with:
21+
name: file
22+
path: results
23+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| .github/workflows/secrets-in-artifacts.yml:9:9:14:2 | Uses Step | A secret is exposed in a public artifact uploaded by $@ | .github/workflows/secrets-in-artifacts.yml:9:9:14:2 | Uses Step | actions/upload-artifact |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Security/CWE-312/SecretsInArtifacts.ql
2+

0 commit comments

Comments
 (0)