BM: Baca dalam Bahasa Melayu
World C4: Pipeline Shields
Secrets in logs
You will learn: how GitHub hides secrets in logs, where that stops, and what to do after a leak.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
Your deploy fails. To debug it, you print the token in a step. Your repo is public. Who can read that log?
Pick one answer.
Watch
Pick an event. Press Run and watch the line.
A deploy line. One step prints the token. Its log shows Using token ***.
Workflow file .github/workflows/deploy.yml
name: Deploy on: push: branches: [main] permissions: contents: read jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: echo "Using token ${{ secrets.CLOUDFLARE_API_TOKEN }}" - run: npx wrangler deploy env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
The line
Push to main · main
Run it, then tap the echo station to read its log. GitHub swapped the token for ***. This is masking: Blacking out a secret in the logbook: GitHub shows *** instead of the exact secret text.: a black marker in the logbook.
Watch
The mask only finds the exact secret text. Change the text, and it slips past. Hidden, or leaked?
Swipe right for good, left for needs work. Or use the buttons.
A step prints $TOKEN as it is
Try it
Made a new secret value in a step? Mask it yourself, before anything prints it.
Tap the line that tells GitHub to hide the new value.
0 of 1 found
Predict
A real token shows up in a public log, not masked. What do you do first?
Pick one answer.
Check
Clean up after the leak. Put the steps in order.
First step at the top. Put these in order. Use the arrows, or drag.
- Delete the logs of that run
- Remove the line that printed it
- Revoke the leaked secret and make a new one
- Save the new value as the repo secret
You did it!
You can now keep secrets out of logs, and clean up leaks.
Go deeper (optional)
The tj-actions attack printed secrets encoded twice, so masks missed them. Also: never pass a secret on the command line. Other programs on the runner can see it. Pass it in env:. Stuck later? The Rescue Center has a “secret printed in logs” flow.
Bahasa Melayu
Deploy anda gagal. Untuk nyahpepijat, anda cetak token dalam satu langkah. Repo anda awam. Siapa boleh baca log itu?
Jalankannya, kemudian tekan stesen echo untuk baca lognya. GitHub tukar token itu kepada ***. Ini masking (penutupan): pen hitam dalam buku log.
Penutup hanya cari teks secret yang tepat. Ubah teks itu, dan ia terlepas. Tersembunyi, atau bocor?
Buat nilai rahsia baharu dalam satu langkah? Tutup ia sendiri, sebelum apa-apa mencetaknya.
Token sebenar muncul dalam log awam, tanpa ditutup. Apa anda buat dulu?
Bersihkan selepas bocor. Susun langkah ikut urutan.
Kini anda boleh jauhkan secret daripada log, dan bersihkan bila satu terlepas.
You finished this before. Practice is always welcome!
Official docs: Workflow commands: masking a value · Secure use: using secrets
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?