Interview Prep/GitHub Actions/Secrets, OIDC & Environments

A developer asks to print a secret in the log "just once" to debug. What do you do instead?

BeginnerScenarioSecrets, OIDC & Environments
Answer

Situation read → Debugging a credential problem without exposure.

What I'd do →

  1. Check presence and shape without the value: test -n "$TOKEN" && echo "len=${#TOKEN}", or compare a hash prefix: echo -n "$TOKEN" | sha256sum | cut -c1-8.
  2. Test the credential against the API and print only the status code.
  3. If the value is wrong, rotate it and re-set with gh secret set.

Why → Logs are readable by everyone with repo read access and are retained for 90 days.

Interview tip → "Verify shape and behaviour, never the value."

All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, OIDC & Environments