Menu

How to stop secrets leaking into GitHub Actions logs (and move to OIDC)
📰

How to stop secrets leaking into GitHub Actions logs (and move to OIDC)

DEV Community: security·kobima6813·4 days ago
#tS55wSOb
#devtosecurity#devto#dev#secrets#actions
Reading 0:00
15s threshold

After the Railway incident I wrote a 15-minute key rotation checklist . Rotating is step one. Step two is making sure the new keys don't leak again, and CI is one of the easiest places to leak them.

Here are the three patterns I see most often, and how to fix each one.

1. Printing secrets in run: steps

- run : echo "key is ${{ secrets.DEPLOY_KEY }}" - run : printf '%s\n' "${{ secrets.DB_PASSWORD }}"

Enter fullscreen mode

Exit fullscreen mode

GitHub masks known secret values in logs, but masking is best-effort. If the value is base64-encoded, split, URL-encoded or otherwise transformed, the masked form no longer matches and the real value can show up in the log.

Fix: never echo secrets.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.