Skip to content

Commit 0c0e280

Browse files
committed
update the qhelp to mention that the GITHUB_TOKEN only sometimes has write-access
1 parent c0152a4 commit 0c0e280

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

javascript/ql/src/Security/CWE-094/ExpressionInjection.qhelp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,47 @@
22
"-//Semmle//qhelp//EN"
33
"qhelp.dtd">
44
<qhelp>
5-
65
<overview>
7-
86
<p>
9-
107
Using user-controlled input in GitHub Actions may lead to
118
code injection in contexts like <i>run:</i> or <i>script:</i>.
12-
139
</p>
14-
1510
<p>
1611
Code injection in GitHub actions may allow an attacker to
1712
exfiltrate the temporary GitHub repository authorization token.
18-
The token has write access to the repository, and thus an attacker
19-
can use it to modify the repository.
13+
The token might have write access to the repository, and thus an attacker
14+
might be able to use it to modify the repository.
2015
</p>
21-
2216
</overview>
2317

2418
<recommendation>
25-
2619
<p>
2720
The best practice to avoid code injection vulnerabilities
2821
in GitHub workflows is to set the untrusted input value of the expression
2922
to an intermediate environment variable.
3023
</p>
31-
24+
<p>
25+
It is also recommended to limit the permissions of any tokens used
26+
by a workflow such as the the GITHUB_TOKEN.
27+
</p>
3228
</recommendation>
3329

3430
<example>
35-
3631
<p>
37-
3832
The following example lets a user inject an arbitrary shell command:
39-
4033
</p>
41-
4234
<sample src="examples/comment_issue_bad.yml" />
4335

4436
<p>
45-
4637
The following example uses shell syntax to read
4738
the environment variable and will prevent the attack:
48-
4939
</p>
50-
5140
<sample src="examples/comment_issue_good.yml" />
52-
5341
</example>
5442

5543
<references>
5644
<li>GitHub Security Lab Research: <a href="https://securitylab.github.com/research/github-actions-untrusted-input">Keeping your GitHub Actions and workflows secure: Untrusted input</a>.</li>
5745
<li>GitHub Docs: <a href="https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions">Security hardening for GitHub Actions</a>.</li>
46+
<li>GitHub Docs: <a href="https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token">Permissions for the GITHUB_TOKEN</a>.</li>
5847
</references>
59-
6048
</qhelp>

0 commit comments

Comments
 (0)