Repository navigation
Commit f63244b
[New Query - githubsecuritylab/actions/encoded-secret-in-log] - detect Actions encoded secret in log (#253)
* Actions: add encoded secret in log query
Report a secret that is piped through an encoding command (base64, base32, xxd,
hexdump, od, rev, uuencode, openssl base64) and printed to the workflow log.
The runner masks a secret and a fixed set of its encodings, such as Base64,
JSON, URL and XML escapes. It does not recognize other transformations, and
Base64 output can still leak through its trailing newline or line wrapping.
The query is experimental with medium precision. Decoding, hashing and
encrypting before encoding, output redirection, here-document bodies and
captured command substitutions are not reported.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752
* Do not change the Actions pack version
The version changes when a release is cut.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752
* Actions: fix redirection, shadowed variable and piped input handling
Fix three results of the encoded secret query:
- base64 2>> file redirects only standard error, so the encoded secret still reaches the log. It is reported again.
- An environment variable that an earlier assignment in the script replaced no longer counts as the secret.
- An encoder that reads a redirected input or a file operand (base64 < file, base64 file, openssl base64 -in file) does not read the piped secret.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752
* Actions: handle conditional secrets, copied variables and downstream input
Address three more findings of the encoded secret query:
- A conditional expression such as `github.ref == 'refs/heads/main' && secrets.A || secrets.B` evaluates to a secret, but every expression with && or a comparison was rejected, so the leak was not reported. A secret now counts when the expression can return it: it is not negated, not compared, and not only tested as the left operand of &&.
- A copy of an environment variable (T="$TOKEN") resolved to the environment secret even when an earlier assignment had replaced the variable. The copy is now resolved at the line of the assignment.
- A downstream stage that reads a redirected input (base64 | tee < /dev/null) prints nothing, but was accepted as a pass-through stage. A quoted angle bracket, as in tr '+' '<', is not a redirection.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf867521 parent 54c268b commit f63244b
6 files changed
Lines changed: 778 additions & 0 deletions
File tree
- actions
- src/security/CWE-532
- test/security/CWE-532/EncodedSecretInLog
- .github/workflows
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments