Hacker News
Composer leaks contents of tokens configured as GitHub OAuth tokens
damienwebdev
|next
[-]
ammar2
|root
|parent
|next
[-]
> GitHub Actions' built-in secret masker matches registered values as exact substrings. When the exception message is rendered by Symfony Console it may wrap, embed in In BaseIO.php line N: framing, or interleave with ANSI control sequences. So the masker does not redact, and the plaintext token reaches the log.
What does this log rendering look like such that the token from that code snippet becomes interleaved enough to not be a substring match?
I'm not familiar with composer/Symfony but I would expect something like:
Line 34: Foo bar
Line 34: <red>Foo bar</red>
jacobrussell
|root
|parent
[-]
For your example:
Line 34: <red>ghs_fdsafdsarewqfdsa...</red>
Is probably long enough in most cases to break to a new line.
Also, those blocks get "interleaved" like this:
<red>ghs_fdsafdsarewqfdsafdsa</red>
<red>fdsardsardsafdsafs......</red>
So there are now </red>'s within the token, also breaking the substring matching.
This is kind of eye-opening for me -- I have never thought about how styled output like this could cause logging leakages.
securesaml
|root
|parent
|next
|previous
[-]
How many other actions/libraries do you think are vulnerable?
semi-extrinsic
|root
|parent
|previous
[-]
jacobrussell
|root
|parent
|next
[-]
securesaml
|root
|parent
|previous
[-]
This include's the GITHUB_TOKEN that is builtin within a actions jobs.
ShowalkKama
|next
|previous
[-]
Normal_gaussian
|next
|previous
[-]
This does not surprise me.
freedomben
|root
|parent
|next
[-]
When the GH action YAML is just invoking shell scripts, I find it quite pleasant to use
micksmix
|next
|previous
[-]
Shameless plug: I work on Kingfisher, an Apache 2.0 OSS secret scanner and validator written in Rust, that can also map blast radius and revoke many creds:
<https://github.com/mongodb/kingfisher>
It can scan repos, history, and artifacts and validate many findings against provider APIs, as well as revoke many exposed tokens directly from the CLI. Also generates a blast-radius/access-map view so you can see what a leaked credential could reach.
Install:
brew install kingfisher
# or
uv tool install kingfisher-bin
Scan a local path: kingfisher scan /path/to/scan --access-map --view-report
Or scan a GitHub/GitLab repo directly: kingfisher scan https://github.com/path/to/repo.git --access-map --view-report