Skip to content

feat(yaml): detect ${{ github.<context> }} expression inside run/script steps — command injection (CWE-78) - #148

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/yaml-run-shell-injection
Open

feat(yaml): detect ${{ github.<context> }} expression inside run/script steps — command injection (CWE-78)#148
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/yaml-run-shell-injection

Conversation

@ai-anant

Copy link
Copy Markdown

Detects GitHub Actions run/script steps that interpolate a github context expression (e.g. github.ref_name, github.event.*, github.head_ref) into a shell command.

Context values such as a ref/tag/branch or event payload are untrusted input in the runner shell. Interpolating them (especially unquoted, or inside a larger command template) allows the value to inject arbitrary shell commands when it contains metacharacters — arbitrary command execution on the runner (CWE-78).

Pattern shape (generic):

run: |
  cmd ${{ github.ref_name }}

Validated: pos repro with ref_name/head_ref fires, safe run steps with no expression are clean. Path-scoped to *.yml/*.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant