Command output
set -x, a verbose CLI, or an error dump prints the credential before anyone notices.
A credential printed by CI is not a log-hygiene problem. It is an exposure with a clock: every reader, artifact and fork already has it. This runbook is the scope-and-rotate path.
set -x, a verbose CLI, or an error dump prints the credential before anyone notices.
Base64, URL-encoding or a split value no longer matches the mask; the log looks safe and is not.
.env, fixtures and build caches are downloadable long after the run.
pull_request_target plus untrusted checkout hands secrets to the PR author.
| Command | What it finds |
|---|---|
| gh run view <id> --log > run.log | A local copy you can grep without exposing the secret to a search engine. |
| grep -nE "AKIA|ghp_|github_pat_|sk_live_" run.log | Common credential prefixes in the run log. |
| grep -RIn "BEGIN .*PRIVATE KEY" artifact/ | Keys accidentally uploaded as artifacts. |
| gh api repos/<owner>/<repo>/actions/runs/<id>/artifacts | Every artifact attached to the run, and its retention. |
The literal secret is masked; its base64 form is not. Rotate, then stop printing the request.
The privileged trigger plus untrusted checkout is the classic leak. Rotate and remove the trigger.
Paid chapter: narrow upload paths, delete the artifact, rotate every value in it.
Paid chapter: cache keys, fork restore, and what to rotate when the cache is poisoned.
Paid chapter: redact the payload, disable debug in deployed builds.
| Stage | What the paid chapter covers |
|---|---|
| Rotate | Dependency order, revoking old keys, invalidating sessions. |
| Purge | Logs, artifacts, caches and the copies you cannot delete. |
| Prevent | Runtime injection, canary secret test, retention shorter than credential life. |
Five failure modes, rotation order, purge limits and the prevention checklist.