Repository navigation
Open
Labels
Description
Is your feature request related to a problem? Please describe.
The ISSUE-705 rework in #533 (untrustedTriggersMustNotWriteCache: a job granted cache-mode: write or write-only on an untrusted trigger) left a few edge cases unhandled. Each one is rare, but each can make the finding wrong or less useful:
- Untested contexts in
cache-modeexpressions. GitHub rejects acache-modeexpression that readsgithub,varsorinputs(probed on github.com).matrix,needsandstrategywere not probed. Plumber treats any expression that reads a context as invalid and stays silent, so if GitHub accepts e.g.${{ needs.setup.outputs.mode || 'write' }}, that write grant is missed. - YAML aliases and merge keys give line 0. A job defined through an alias (
b: *a) or a merge key (<<: *defaults) that carriescache-modegets its value, but the finding carriesline: 0. - An empty job-level
cache-mode:drops the workflow's value.cache-mode:with no value (null) on a job is ignored instead of falling back to the workflow-levelcache-mode. GitHub probably rejects such a file, so this is mostly about not hiding a grant. - The old key under
gitlab.controlspoints to the wrong fix.releaseWorkflowsMustNotRestoreUntrustedCacheundergitlab.controls(reachable by migrating a v1 file) warns to runplumber config migrate, but migrate only rewritesgithub.controlsand then reports "Nothing to do". - Jobs that never run are still flagged. A job under a constant false
if:withcache-mode: writeraises ISSUE-705 and is counted as exempted, while the attack-path engine already ignores such jobs.
Describe the solution you'd like
- Probe
matrix,needsandstrategyon a scratch repository. Until then, resolve an expression that reads a context to write when one of its quoted strings iswriteorwrite-only(a file GitHub rejects never runs, so this costs nothing). - Resolve aliases and merge keys when locating the
cache-modeline, or fall back to the job's own line. - Treat a null job-level
cache-modeas absent, so the workflow-level value applies. - Make the rename warning provider-aware, or have
plumber config migratedrop the key fromgitlab.controlsand list the change. - Skip dead jobs in the ISSUE-705 rule and in the exempted-jobs count.
Configuration in .plumber.yaml
No configuration change:
github:
controls:
untrustedTriggersMustNotWriteCache:
enabled: true
exemptWorkflows: []
exemptJobs: []Implementation Hints
- Items 1 to 3 are in the GitHub collector's
cache-moderesolution (ir.Job.CacheMode). - Item 4 is in the control rename warning and the migrate rename step.
- Item 5 is a
not job.deadguard in the rule, mirrored in the Go stats. - Every item needs a fixture under
policies/testdata/ISSUE-705/github/, plus the rego/Go parity test.
Why It's Valuable
The point of #533 was a finding a maintainer cannot disprove. These cases either miss a real grant (1, 3), point at the wrong line (2) or the wrong fix (4), or flag a job that never runs (5).
Activity