Skip to content

CI: Fix zizmor security findings in PR-triggered workflows#15788

Merged
kevinjqliu merged 1 commit intoapache:mainfrom
kevinjqliu:kevinjqliu/more-zizmor
Mar 27, 2026
Merged

CI: Fix zizmor security findings in PR-triggered workflows#15788
kevinjqliu merged 1 commit intoapache:mainfrom
kevinjqliu:kevinjqliu/more-zizmor

Conversation

@kevinjqliu
Copy link
Copy Markdown
Contributor

@kevinjqliu kevinjqliu commented Mar 27, 2026

What

Fix security findings reported by zizmor in all 11 workflows that are triggered on pull_request.

Changes

1. Add persist-credentials: false to actions/checkout — fixes artipacked (Medium)

Files:

  • .github/workflows/api-binary-compatibility.yml
  • .github/workflows/codeql.yml
  • .github/workflows/delta-conversion-ci.yml
  • .github/workflows/docs-ci.yml
  • .github/workflows/flink-ci.yml
  • .github/workflows/hive-ci.yml
  • .github/workflows/java-ci.yml (3 jobs)
  • .github/workflows/kafka-connect-ci.yml
  • .github/workflows/license-check.yml
  • .github/workflows/open-api.yml
  • .github/workflows/spark-ci.yml

Why zizmor recommends this:
By default, actions/checkout persists the GitHub token in the local git config (.git/config) of the checked-out repository. If a subsequent step uploads the workspace as an artifact, the token is included, potentially allowing an attacker to extract it and push malicious code. Setting persist-credentials: false ensures the token is not written to disk after checkout.

See: https://woodruffw.github.io/zizmor/audits/#artipacked

2. Replace actions/cache with actions/cache/restore + conditional actions/cache/save — fixes cache-poisoning (High)

Files:

  • .github/workflows/api-binary-compatibility.yml
  • .github/workflows/delta-conversion-ci.yml (2 jobs)
  • .github/workflows/flink-ci.yml
  • .github/workflows/hive-ci.yml
  • .github/workflows/java-ci.yml
  • .github/workflows/kafka-connect-ci.yml
  • .github/workflows/spark-ci.yml

Why zizmor recommends this:
actions/cache both restores and saves the cache. In workflows triggered by pull_request, a malicious PR could poison the shared cache by injecting compromised content that is then saved and restored by subsequent trusted runs (e.g., on push to main). The actions/cache action has implicit save behavior in its post step that always runs, regardless of job outcome. Splitting into actions/cache/restore (unconditional) and actions/cache/save (conditional on github.event_name == 'push') makes the intent explicit: PRs can only read the cache, while only trusted push events can write to it.

See: https://woodruffw.github.io/zizmor/audits/#cache-poisoning

3. Add enable-cache: false to astral-sh/setup-uv — fixes cache-poisoning (High)

Files:

  • .github/workflows/open-api.yml

Why zizmor recommends this:
astral-sh/setup-uv uses actions/cache internally when caching is enabled. The same cache-poisoning risk applies: a PR-triggered workflow could save a poisoned uv cache. Disabling the built-in cache eliminates this vector.

Scope

Only the 11 workflows triggered on pull_request are included in this PR. The remaining 6 workflows (labeler, jmh-benchmarks, publish-iceberg-rest-fixture-docker, publish-snapshot, recurring-jmh-benchmarks, site-ci) are not triggered by PRs and will be addressed separately.

Testing

These changes are behavioral no-ops:

  • persist-credentials: false — no workflow step relies on the persisted git credentials
  • actions/cache/restore — equivalent to actions/cache with lookup-only: true (which was already set); the lookup-only parameter is removed since cache/restore never saves by definition

@github-actions github-actions bot added the INFRA label Mar 27, 2026
@kevinjqliu
Copy link
Copy Markdown
Contributor Author

All these changes are for workflows triggered in CI, so in this PR we can verify that everything still runs successfully after the change

- Add persist-credentials: false to all actions/checkout steps (artipacked)
- Replace actions/cache with actions/cache/restore (cache-poisoning)
- Add conditional actions/cache/save on push events to keep cache fresh
- Add enable-cache: false to setup-uv in open-api workflow
@kevinjqliu kevinjqliu force-pushed the kevinjqliu/more-zizmor branch from f10e625 to 5b27645 Compare March 27, 2026 03:49
- run: |
echo "Using the old version tag, as per git describe, of $(git describe)";
- run: ./gradlew revapi --rerun-tasks
- uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should replace actions/cache with gradle/actions/setup-gradle so we dont need to manually configure cache key, tracking in #15789

@kevinjqliu kevinjqliu force-pushed the kevinjqliu/more-zizmor branch from 15590a5 to 5b27645 Compare March 27, 2026 05:06
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098
with:
enable-cache: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems fine. open-api workflow runs in ~22s per CI check. So the performance gain from caching is probably not that important. This is simpler and secure.

We can add back cache/restore in the future if this workflow becomes a bottleneck.

Copy link
Copy Markdown
Contributor

@stevenzwu stevenzwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevinjqliu kevinjqliu merged commit a7d2113 into apache:main Mar 27, 2026
73 of 75 checks passed
@kevinjqliu kevinjqliu deleted the kevinjqliu/more-zizmor branch March 27, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants