Repository navigation
fix(policies): resolve the cache-poisoning release path per trigger - #500
Conversation
83c6be2 to
20cf1a6
Compare
20cf1a6 to
8c327af
Compare
8c327af to
205d814
Compare
205d814 to
2223e78
Compare
2223e78 to
a0ba2cb
Compare
The IR had no notion of when a step runs: Action lost the workflow's step-level `if:`, Scripts was a bare list, and the job-level `if:` only existed flattened into Conditions together with every step's, unusable as the job gate. Action gains `if`, Job gains `if` (the job gate alone) and `scriptIfs` (aligned index for index with Scripts, set only when some run step is conditional), all filled by the GitHub workflow collector. The fields are optional and omitted when empty, so the ingestion contract stays forward-tolerant. Groundwork for the issue #497 fix: the cache-poisoning release-path resolution reads them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ft8dmcMLK7V9XZh7JX4vzs
a0ba2cb to
49d485d
Compare
e2e: standalone and platform mode, released v0.5.12 vs this branchScenario branch: Standalone (
|
| job | v0.5.12 | this branch |
|---|---|---|
vulnerable/publish |
ISSUE-705 | ISSUE-705 |
i497-reusable/publish |
ISSUE-705 | ISSUE-705 |
i497-repro/build-and-publish |
ISSUE-705 | silent |
i497-split-steps/build-and-publish |
ISSUE-705 | silent |
i497-job-if/test |
ISSUE-705 | silent |
i497-setup-go-conditional/publish |
ISSUE-705 | silent |
i497-unresolved/publish |
ISSUE-705 | ISSUE-717 (medium) |
Artifacts from the branch build: the SARIF carries an ISSUE-717 rule (level warning, helpUri to the docs page) and every result has a location (Code Scanning contract); the OCSF report and the legacy JSON are produced, the latter with unscopedCacheRestoreFound: 2, unresolvedConditionalCacheFound: 1; the terminal report renders MED [ISSUE-717] with its docs link and the summary row reads ISSUE-705, ISSUE-717.
Platform mode (GitHub Actions, PR build, e2e platform)
Run 36508644987 builds the CLI from 49d485d in the job and runs analyze --platform https://plumber.e2e.getplumber.tech: exit 0, same three verdicts, the usual GitHub "results sink" incomplete-collection notice. On the platform side the run was ingested and the issues stored with the pushed severity and the right control:
issue: code=ISSUE-705 | severity=high | job=i497-reusable/publish | control=releaseWorkflowsMustNotRestoreUntrustedCache | status=Detected
issue: code=ISSUE-705 | severity=high | job=vulnerable/publish | control=releaseWorkflowsMustNotRestoreUntrustedCache | status=Detected
issue: code=ISSUE-717 | severity=medium | job=i497-unresolved/publish | control=releaseWorkflowsMustNotRestoreUntrustedCache | status=Detected
The platform needs no change for the new code: ingestion has no code allowlist, display severity is the pushed one, and the scoring fallback for a code its pinned CLI module does not know is medium, which is ISSUE-717's severity. A pin bump after the release adds the title and doc URL to /issue-types and /controls.
Consistency pass
The third commit (e75c6ea) is the result of a whole-repo sweep: every place documenting the control (docs/GITHUB_ISSUES.md, both .plumber.yaml, config struct and schema docs, registry description, wizard label, rego comments, the ISSUE-717 wording) now describes the per-trigger resolution and the downgrade. Docs site companion: getplumber/getplumber.io#432.
e75c6ea to
988a294
Compare
Closes #497. releaseWorkflowsMustNotRestoreUntrustedCache treated any non-empty enable input as an active cache and reasoned job-level, so a repository doing the recommended remediation (a conditional `cache:` expression that is empty on the publish trigger, or caching split into a step whose `if:` excludes it) got the same High as one doing nothing. ISSUE-705 now requires an event where a restore and a publish can share a run: job triggers, narrowed by each step's `if:` and by the canonical enable shape `${{ github.event_name ==/!= '<event>' && '<manager>' || '' }}`, intersected with the publish events (the release trigger, publish actions and publish scripts, each narrowed by its own `if:`). Unrecognized conditions narrow nothing and jobs without trigger data keep the job-level context, so every existing verdict outside the new shapes is unchanged. A whole-value enable expression outside the canonical shape cannot be resolved, and asserting the High would be a guess: it downgrades to the new medium ISSUE-717 verify-manually code on the same control (one control, two codes graded by certainty, the ISSUE-307/310 pattern). The legacy payload counts the two separately and the catalog golden picks up the additive code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ft8dmcMLK7V9XZh7JX4vzs
…717 everywhere the control is documented A consistency pass over every place that documents releaseWorkflowsMustNotRestoreUntrustedCache after the issue #497 rework. docs/GITHUB_ISSUES.md gains the ISSUE-717 entry (table of contents, section, control-name shortcut row) and the ISSUE-705 section explains the per-trigger resolution; both .plumber.yaml files, the config struct docs, the schema docs, the control registry description and the wizard label stop describing the cache modes in literal-value terms only. The ISSUE-717 message and description now name the default-mode disable input the rule also downgrades, not just the opt-in enable input, and the contract test counts a stray ISSUE-717 on its clean case as a failure. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ft8dmcMLK7V9XZh7JX4vzs
988a294 to
e23695f
Compare
Closes #497.
Why
releaseWorkflowsMustNotRestoreUntrustedCache(ISSUE-705, High) treated any non-empty, non-"false" enable input as an active cache and reasoned at the job level. A repository doing exactly the remediation the finding recommends, disabling the cache on the publish trigger withcache: ${{ github.event_name != 'workflow_dispatch' && 'maven' || '' }}or splitting caching into a step whoseif:excludes the publish trigger, got the same High as one doing nothing. A false positive there teaches maintainers to disable the control.What
Actiongainsif,Jobgainsif(the job gate alone;Conditionsflattens job and step ifs together and cannot serve) andscriptIfs(aligned withscripts, present only when some run step is conditional), filled from the workflow YAML. Optional fields, omitted when empty, so the contract stays forward-tolerant.if:, the stepif:, the canonical enable shapegithub.event_name ==/!= '<event>' && '<manager>' || '', and (default-mode actions) a conditional disable input in bothdisableValuedirections. Publish events = thereleasetrigger plus publish actions/scripts, each narrowed by its ownif:. Unrecognized conditions narrow nothing, and jobs without trigger data keep the job-level context, so verdicts outside the new shapes are unchanged (all 20 pre-existing fixtures pass untouched).github.event_namein aworkflow_callworkflow is the caller's event, never the literal"workflow_call", so the event universe there is the finite abstraction of the open caller domain: every event the job's conditions name plus a caller token that satisfies every!=but no==. An event-gated publish in a reusable workflow keeps its High while the remediation above still resolves inside one.Testing
==inverse, conditional disables (both directions, clean and overlap), job-level and publish-actionif:gating, the reusable-workflow false negative and its remediated twin, three reusable-universe pins, and the unresolvable downgrades (asserted 0 x ISSUE-705, 1 x ISSUE-717 medium). Every behavior change watched red on the previous head first; clean fixtures assert silence of BOTH codes.Action.If/Job.If/Job.ScriptIfscapture and the absent-when-unconditional contract; a legacy-payload test pins the split metrics.policies(incl. identity harness),github,control,cmd,finding,configuration,internal/...,pbom,gitlabsuites green;go vetclean; pinnedgolangci-lint: 0 issues.Follow-up
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ft8dmcMLK7V9XZh7JX4vzs