Files
insights/.semgrep/rules/security/github-actions-shell-injection.yaml
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

57 lines
2.6 KiB
YAML

# this rule is an extention of semgrep's oss run-shell-injection rule.
# step output checking was removed due to high false positive rate/noisiness.
# however we prefer to be extra cautious and thus have added this check back.
# see https://github.com/semgrep/semgrep-rules/pull/3602
rules:
- id: github-actions-shell-injection
languages:
- yaml
message: 'Using a steps output in another `run:` or `script:` step could allow an attacker to inject their own
code into the runner. This would allow them to steal secrets and code. Step output can have arbitrary
user input and should be treated as untrusted. Instead, use an intermediate environment variable with
`env:` to store the data and use the environment variable in the `run:` script. Be sure to
use double-quotes the environment variable, like this: "$ENVVAR".'
metadata:
category: security
cwe:
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"
owasp:
- A01:2017 - Injection
- A03:2021 - Injection
- A05:2025 - Injection
references:
- https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
- https://securitylab.github.com/research/github-actions-untrusted-input/
technology:
- github-actions
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- vuln
likelihood: HIGH
impact: HIGH
confidence: HIGH
patterns:
- pattern-inside: 'steps: [...]'
- pattern-either:
- patterns:
- pattern-inside: |
- run: ...
...
- pattern: 'run: $SHELL'
- patterns:
- pattern-inside: |
- script: ...
...
- pattern: 'script: $SHELL'
- metavariable-pattern:
language: generic
metavariable: $SHELL
patterns:
- pattern-either:
- pattern: ${{ ... steps. ... .outputs ... }}
# Exclude safe patterns where variable is only checked for truthiness (left of &&)
# e.g., ${{ github.head_ref && 'literal' }} is safe - value not interpolated
- pattern-not: ${{ ... steps. ... .outputs ... && ... }}
severity: ERROR