Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Fix template injection in code coverage action - #683

Merged
lopopolo merged 1 commit into
trunkfrom
dev/lopopolo-zizmor-template-injection
Feb 2, 2025
Merged

lopopolo merged 1 commit into
trunkfrom
dev/lopopolo-zizmor-template-injection

Conversation

@lopopolo

@lopopolo lopopolo commented Feb 2, 2025

Copy link
Copy Markdown
Member

Address these zizmor findings:

$ zizmor .github/workflows/code-coverage.yaml
2025-02-02T00:10:03.694628Z  INFO zizmor: skipping impostor-commit: can't run without a GitHub API token
2025-02-02T00:10:03.694659Z  INFO zizmor: skipping ref-confusion: can't run without a GitHub API token
2025-02-02T00:10:03.694670Z  INFO zizmor: skipping known-vulnerable-actions: can't run without a GitHub API token
2025-02-02T00:10:03.723952Z  INFO audit: zizmor: 🌈 completed .github/workflows/code-coverage.yaml
warning[artipacked]: credential persistence through GitHub Actions artifacts
  --> .github/workflows/code-coverage.yaml:22:9
   |
22 |         - name: Checkout repository
   |  _________-
23 | |         uses: actions/checkout@v4.2.2
   | |_____________________________________- does not set persist-credentials: false
   |
   = note: audit confidence → Low

error[template-injection]: code injection via template expansion
   --> .github/workflows/code-coverage.yaml:83:9
    |
 83 |         - name: Check missed lines
    |           ^^^^^^^^^^^^^^^^^^^^^^^^ this step
 84 |           shell: python
 85 | /         run: |
 86 | |           import json
...   |
122 | |           is_ok = branch_coverage["linesMissed"] <= trunk_coverage["linesMissed"]
123 | |           exit(0) if is_ok else exit(1)
    | |________________________________________^ github.ref_name may expand into attacker-controllable code
    |
    = note: audit confidence → High

5 findings (3 suppressed): 0 unknown, 0 informational, 0 low, 1 medium, 1 high

This terraform change has already been deployed org-wide:

Address these zizmor findings:

```console
$ zizmor .github/workflows/code-coverage.yaml
2025-02-02T00:10:03.694628Z  INFO zizmor: skipping impostor-commit: can't run without a GitHub API token
2025-02-02T00:10:03.694659Z  INFO zizmor: skipping ref-confusion: can't run without a GitHub API token
2025-02-02T00:10:03.694670Z  INFO zizmor: skipping known-vulnerable-actions: can't run without a GitHub API token
2025-02-02T00:10:03.723952Z  INFO audit: zizmor: 🌈 completed .github/workflows/code-coverage.yaml
warning[artipacked]: credential persistence through GitHub Actions artifacts
  --> .github/workflows/code-coverage.yaml:22:9
   |
22 |         - name: Checkout repository
   |  _________-
23 | |         uses: actions/checkout@v4.2.2
   | |_____________________________________- does not set persist-credentials: false
   |
   = note: audit confidence → Low

error[template-injection]: code injection via template expansion
   --> .github/workflows/code-coverage.yaml:83:9
    |
 83 |         - name: Check missed lines
    |           ^^^^^^^^^^^^^^^^^^^^^^^^ this step
 84 |           shell: python
 85 | /         run: |
 86 | |           import json
...   |
122 | |           is_ok = branch_coverage["linesMissed"] <= trunk_coverage["linesMissed"]
123 | |           exit(0) if is_ok else exit(1)
    | |________________________________________^ github.ref_name may expand into attacker-controllable code
    |
    = note: audit confidence → High

5 findings (3 suppressed): 0 unknown, 0 informational, 0 low, 1 medium, 1 high
```
@lopopolo lopopolo added A-security Area: Security vulnerabilities and unsoundness issues. A-github-actions Area: GitHub Actions workflows and automation. labels Feb 2, 2025
@lopopolo
lopopolo merged commit 7ca27b2 into trunk Feb 2, 2025
@lopopolo
lopopolo deleted the dev/lopopolo-zizmor-template-injection branch February 2, 2025 00:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-github-actions Area: GitHub Actions workflows and automation. A-security Area: Security vulnerabilities and unsoundness issues.

Development

Successfully merging this pull request may close these issues.

1 participant