Improve documentation

This commit is contained in:
jarlob
2023-04-05 10:24:07 +02:00
parent 40b7910473
commit 9fba7d31f1
2 changed files with 23 additions and 1 deletions

View File

@@ -21,7 +21,7 @@
The best practice to avoid code injection vulnerabilities
in GitHub workflows is to set the untrusted input value of the expression
to an intermediate environment variable and then use the environment variable
using the native syntax of the shell/script interpreter (i.e. <b>NOT</b> the ${{ env.VAR }}).
using the native syntax of the shell/script interpreter (i.e. <b>NOT</b> the <i>${{ env.VAR }}</i>).
</p>
<p>
It is also recommended to limit the permissions of any tokens used
@@ -40,6 +40,18 @@
the environment variable and will prevent the attack:
</p>
<sample src="examples/comment_issue_good.yml" />
<p>
The following example uses an environment variable, but
still allows injection because of the use of expression syntax:
</p>
<sample src="examples/comment_issue_bad_env.yml" />
<p>
The following example uses shell syntax to read
the environment variable and will prevent the attack:
</p>
<sample src="examples/comment_issue_good.yml" />
</example>
<references>

View File

@@ -0,0 +1,10 @@
on: issue_comment
jobs:
echo-body:
runs-on: ubuntu-latest
steps:
- env:
BODY: ${{ github.event.issue.body }}
run: |
echo '${{ env.BODY }}'