Skip to content

Commit 2556f08

Browse files
authored
docs: add template-injection tips (#259)
1 parent 1cfb8b3 commit 2556f08

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/audits.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,23 @@ from the expanded template.
462462
This avoids the vulnerability, since variable expansion is subject to normal
463463
shell quoting/expansion rules.
464464

465+
!!! tip
466+
467+
To fully remediate the vulnerability, you **should not** use
468+
`${{ env.VARNAME }}`, since that is still a template expansion.
469+
Instead, you should use `${VARNAME}` to ensure that the shell *itself*
470+
performs the variable expansion.
471+
472+
473+
!!! tip
474+
475+
When switching to `${VARNAME}`, keep in mind that different shells have
476+
different environment variable syntaxes. In particular, Powershell (the
477+
default shell on Windows runners) uses `${env:VARNAME}`.
478+
479+
To avoid having to specialize your handling for different runners,
480+
you can set `shell: sh` or `shell: bash`.
481+
465482
=== "Before"
466483

467484
```yaml title="template-injection.yml" hl_lines="3"

0 commit comments

Comments
 (0)