D5: Mitigating Script Injection
GH-200 GitHub Actions exam practice questions · 10 flashcards
Question
What is script injection in Actions?
1 / 10
Tip: Space flips the card, ← / → navigate.
Show all 10 Mitigating Script Injection practice questions and answers
- What is script injection in Actions?Untrusted input (PR title, issue body, branch name) interpolated into run: executes attacker commands.
- Vulnerable example?run: echo "${{ github.event.issue.title }}".
- Safe pattern?env: TITLE: ${{ github.event.issue.title }} then run: echo "$TITLE".
- Untrusted contexts?github.event.*.title/body, head_ref, comment body, commit messages, author names.
- Prefer actions over inline scripts?Pass untrusted data as action inputs instead of shell interpolation.
- Shell quoting?Always quote variables to avoid word splitting/command injection.
- pull_request_target risk?Checking out PR head code with secrets available enables pwn requests.
- workflow_run risk?Artifacts from untrusted runs must be treated as untrusted.
- Code scanning for workflows?CodeQL can detect Actions injection patterns.
- Least privilege as mitigation?Limits impact if injection happens.