BM: Baca dalam Bahasa Melayu
World C4: Pipeline Shields
Script injection
You will learn: how a stranger's title can become a command, and the env: fix.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
Your robot thanks everyone who opens an issue:
- run: echo "Thanks for ${{ github.event.issue.title }}"Who writes that title?
Pick one answer.
Watch
Tap each point on the timeline.
Tap through it. The title became code. An order slip with a hidden instruction: that is script injection: An order slip with a hidden instruction: text from a stranger becomes a command in your run: script..
Predict
The fix: pass the title through env: first. Bash then sees plain data, never code.
- run: echo "Thanks for $TITLE"
env:
TITLE: ${{ github.event.issue.title }}Same sneaky title. What does bash print now?
Pick one answer.
Try it
Tap every line where a stranger’s text becomes code.
Tap every risky line. Each one shows the attack and the fix.
Workflow file .github/workflows/greet.yml
Hint
Look insiderun: lines. A number is safe. Names and text are not.Try it
Build the safe welcome robot. Pass the title through env:.
Tap blocks to add them. Put them in order.
Blocks
Your workflow
Tap a block above to start.
Workflow file .github/workflows/
name: Welcome
What runs
Nothing to run yet.
Check
Safe straight inside run:, or should it go through env:? Swipe each value.
Swipe right for good, left for needs work. Or use the buttons.
${{ github.event.issue.title }}You did it!
You can now stop a stranger’s text from turning into a command.
Go deeper (optional)
Tools catch this for you. actionlint warns that a value “is potentially untrusted”. CodeQL has a check too. Another fix: a small JavaScript action that takes the value as an input. Real rep: search your workflows for github.event inside run: lines.
Bahasa Melayu
Robot anda ucap terima kasih bila isu baharu dibuka:
- run: echo "Thanks for ${{ github.event.issue.title }}"Siapa yang tulis tajuk itu?
Tekan setiap langkah. Tajuk itu jadi kod. Slip pesanan dengan arahan tersembunyi: itulah script injection (suntikan skrip).
Pembaikannya: hantar tajuk melalui env: dulu. Bash kemudian nampak data biasa, bukan kod.
- run: echo "Thanks for $TITLE"
env:
TITLE: ${{ github.event.issue.title }}Tajuk licik yang sama. Apa bash cetak sekarang?
Tekan setiap baris di mana teks orang asing jadi kod.
run:. Nombor selamat. Nama dan teks tidak.Bina robot sambutan yang selamat. Hantar tajuk melalui env:.
Selamat terus dalam run:, atau patut melalui env:? Leret setiap nilai.
Kini anda boleh halang teks orang asing daripada jadi arahan.
You finished this before. Practice is always welcome!
Official docs: Script injections · Secure use: good practices against script injection
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?