Skip to content

Commit 69b9542

Browse files
author
Alvaro Muñoz
committed
Add help file for SecretsInArtifacts query
1 parent 3a39058 commit 69b9542

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Storage of sensitive information in GitHub Actions artifact
2+
3+
## Description
4+
5+
Sensitive information included in a GitHub Actions artifact can allow an attacker to access the sensitive information if the artifact is published.
6+
7+
## Recommendation
8+
9+
Only store information that is meant to be publicly available in a GitHub Actions artifact.
10+
11+
## Example
12+
13+
The following example uses `actions/checkout` to checkout code which stores the GITHUB_TOKEN in the \`.git/config\` file and then stores the contents of the \`.git\` repository into the artifact:
14+
15+
```yaml
16+
name: secrets-in-artifacts
17+
on:
18+
pull_request:
19+
jobs:
20+
a-job: # VULNERABLE
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: "Upload artifact"
25+
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
26+
with:
27+
name: file
28+
path: .
29+
```
30+
31+
The issue has been fixed below, where the `actions/upload-artifact` uses a version (v4+) which does not include hidden files or directories into the artifact.
32+
33+
```yaml
34+
name: secrets-in-artifacts
35+
on:
36+
pull_request:
37+
jobs:
38+
a-job: # NOT VULNERABLE
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: "Upload artifact"
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: file
46+
path: .
47+
```

0 commit comments

Comments
 (0)