Four Ways Your CI Secrets Leave the Building
Printed in logs, handed to fork PRs, passed to third-party actions, or carried by an over-privileged token. Each path has a one-line fix.
Lock down four paths: mask or remove secret-printing steps, never check out PR head in pull_request_target, pin third-party actions to SHAs, and set minimal token permissions per workflow.
GitHub masks exact secret values in logs, but any transformation defeats it: base64, substring, concatenation. A debug step that prints an encoded credential leaks it to anyone who can read the run log, including fork PR authors on public repos. The audit greps workflow steps for secret references inside echo, export and debug contexts.
In This Guide
Path one: the log
Path two and three: forks and third parties
Path four: the token
Get the skill
4 Tips to Get Started
Set permissions: contents: read at workflow level, raise per job only where needed.
Pin every action to a full commit SHA. A mutable tag is a supply-chain door.
echo $SECRET in a step prints to the log. GitHub masks known secrets, but transformed values leak.
Run zizmor on the repo: it finds the leak paths automatically.
Ready to Stop Worrying About Infra?
Knowledge is the first step. Get a free 1-hour diagnostic and see where your infrastructure leaks time, money, and focus.
Related Guides
Is My S3 Bucket Public? How to Check in One Command
One command tells you if your S3 bucket is public, and one curl proves it. The policy check shows intent, the anonymous request shows reality.
The Most Common AWS Misconfiguration (It Is One Line of Config)
Public buckets and Principal * policies cause most disclosed AWS incidents. Each is one line of config with account-wide blast radius. Here is the pattern.
Terraform State File Leak: Every Secret in Plaintext
terraform.tfstate stores database passwords, IAM keys and TLS private keys in plaintext. sensitive=true hides nothing. Here is how leaks happen and the check.
Docker Socket Mounted in a Container: Root on the Host, No Exploit Needed
A container with /var/run/docker.sock mounted controls the host daemon and can mount your entire filesystem. No kernel exploit required. Here is the mechanism and the check.
Ron Cohen — DevOps engineer & founder, roqy.io
Content reviewed by the roqy.io team. Our guides are based on publicly available data.
Disclaimer: This content is for informational and educational purposes only. It does not constitute professional advice or a guarantee of specific results. Infrastructure needs vary by team, stack, and stage. Consult a qualified engineer for advice tailored to your situation.
Frequently Asked Questions
How do GitHub Actions secrets leak?
Four main paths: a step prints the secret or a transformed value into the run log; a pull_request_target workflow checks out attacker-controlled PR code that exfiltrates secrets; a third-party action receives the secret and forwards it; or the GITHUB_TOKEN has write permissions an injected step can abuse. Each path has a one-line fix.
Why pin GitHub Actions to a commit SHA?
A mutable tag like v4 can be repointed to malicious code by the maintainer or by an account compromise. Pinning to a full commit SHA freezes the code you reviewed. OWASP lists tag pinning as a supply-chain risk; SHA pinning is the fix.
How do I scan my workflows for secret leaks?
Run zizmor on the repository: it detects template injection, excessive permissions, pull_request_target misuse and unpinned actions. Add gitleaks for secrets committed in code. Our own repo runs both on every pull request.
Get the DevOps Ecosystem Behind You
One accountable engineer. Full platform behind him. Month-to-month, no lock-in.