Commit c55a6ef
committed
security(actions): harden winget-submit against PowerShell injection
The `Resolve tag` and `Submit PR` steps interpolated `${{ github.event.
release.tag_name }}` and `${{ github.event.inputs.tag }}` directly into
the PowerShell `run:` body. A malicious tag like `v1.0.0';evil-code;#`
could break out of the surrounding quotes and execute arbitrary code in
the runner — which has access to `WINGET_PAT` (publish-to-WinGet PAT).
Funnel all attacker-controllable contexts through `env:` blocks so the
shell receives them as opaque env values that can't escape into syntax.
Also tighten the validation from `StartsWith('v')` to a strict
`^v\d+\.\d+\.\d+(-[A-Za-z0-9.-]+)?$` regex as defence-in-depth.
Audit confirmed no breach: every tag is a clean `vMAJOR.MINOR.PATCH`,
all workflow runs are documented manual `workflow_dispatch` from main,
no `release: published` triggers. No secret rotation needed.1 parent c851d40 commit c55a6ef
1 file changed
Lines changed: 28 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
32 | | - | |
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
| |||
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
46 | 65 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 66 | + | |
| 67 | + | |
51 | 68 | | |
52 | | - | |
| 69 | + | |
53 | 70 | | |
54 | 71 | | |
55 | | - | |
| 72 | + | |
0 commit comments