Skip to content

ISSUE-705 flags a setup action whose cache: input is disabled on the release trigger by an expression #497

Closed

Description

@Totara-thib

Describe the bug

releaseWorkflowsMustNotRestoreUntrustedCache (ISSUE-705) treats an opt-in setup action's cache as enabled whenever its cache: input is a non-empty string that is not "false". It does not evaluate GitHub expressions, so an input that turns the cache off on the release trigger and keeps it on everywhere else is still reported as restoring a cache on the release path.

That is the remediation the finding itself recommends ("disable caching on publish paths") and the one plumber#409 proposes, applied the only way that keeps ordinary builds fast. A repository that does the right thing gets the same High finding as one that does nothing, and the only way to clear it is to remove the cache from every run, including pull request builds that never publish.

To Reproduce

name: plugin
on:
  workflow_dispatch:
  pull_request:
jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: actions/setup-java@v4
        with:
          java-version: "17"
          distribution: temurin
          cache: ${{ github.event_name != 'workflow_dispatch' && 'maven' || '' }}
      - run: mvn -B package
      - name: Publish
        if: github.event_name == 'workflow_dispatch'
        run: npx ovsx publish plugin.vsix -p "$OVSX_PAT"
        env:
          OVSX_PAT: ${{ secrets.OVSX_PAT }}

plumber analyze reports:

HIGH  [ISSUE-705] job "plugin/build-and-publish" restores a cache via "actions/setup-java@v4" on a release-type trigger — scope the key (and any restore-keys) to the release ref or disable caching on publish paths

On workflow_dispatch, the only trigger that publishes, the expression evaluates to '' and setup-java restores nothing. On pull_request it restores the Maven cache, but nothing is published.

Splitting the step in two with step-level if: conditions (one cached step with if: github.event_name != 'workflow_dispatch', one uncached with if: github.event_name == 'workflow_dispatch') is flagged as well, with the same finding on 0.5.12, because _cache_enabled only looks at action.with[...] and never at the step's if:.

Expected behavior

When the enable input is an expression, the control should resolve it per trigger where it can. At minimum, the common shape github.event_name != '<release trigger>' && '<manager>' || '' (and its == inverse) should be treated as disabled on that trigger. A step whose if: excludes every release trigger of the job should not count as a restore on the release path either.

Where the expression cannot be resolved, reporting the step as not_evaluable, or as a lower-severity "conditional cache on a release path, verify manually", would be more accurate than a High that asserts a restore that does not happen.

Relevant versions and configuration files

  • OS: Windows 11 (binary plumber-windows-amd64)
  • Platform: GitHub (github.com)
  • Plumber version: 0.5.12
  • .plumber.yaml: none, built-in default configuration

Relevant logs

Rule source at policies/cache_poisoning.rego: actions/setup-java is an opt-in cache action with enableInput: cache, and _cache_enabled accepts any is_string(c) with c != "" and lower(c) != "false". The unexpanded ${{ ... }} text satisfies all three.

Additional context

This matters most on exactly the jobs the control exists for. The pattern in the reproduction (build on every PR with a cache, publish to a marketplace on manual dispatch) is common for IDE plugins and CLI releases, and the conditional input is the least disruptive way for a maintainer to close the gap. A false positive there teaches them to disable the control instead.

Activity

  1. added 15 commits that reference this issue on Sep 29, 2026
    20cf1a6
    8c327af
    205d814
    2223e78
    4315e2b
    a0ba2cb
    46c16ed
    49d485d
    e75c6ea
    f8c5c94
    988a294
    0039c94
    e23695f
    4195575
    c626275
  2. added a commit that references this issue on Oct 1, 2026
    37dd0f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions