Skip to content

ci: resolve a few zizmor findings#204

Merged
dimastbk merged 1 commit into
masterfrom
resolve-zizmor
Jun 17, 2026
Merged

ci: resolve a few zizmor findings#204
dimastbk merged 1 commit into
masterfrom
resolve-zizmor

Conversation

@dimastbk

@dimastbk dimastbk commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • Chores
    • Strengthened CI/CD security by tightening workflow and job permissions and disabling credential persistence during checkout.
    • Improved supply-chain resilience by pinning multiple GitHub Actions to commit SHAs.
    • Enabled automated daily dependency update checks via Dependabot for supported ecosystems.
    • Removed the previous Renovate configuration to streamline dependency tooling.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Removes renovate.json and introduces .github/dependabot.yml with daily update schedules for github-actions and cargo ecosystems. Updates CI.yml to set permissions: {} at workflow level, restrict individual jobs to contents: read, and pin all third-party action references to specific commit SHAs throughout test, lint, check, build, release, and gh-release jobs.

Changes

CI Security Hardening

Layer / File(s) Summary
Switch from Renovate to Dependabot
renovate.json, .github/dependabot.yml
renovate.json is deleted; a new dependabot.yml defines daily automated updates with a 7-day cooldown for both github-actions and cargo package ecosystems.
Workflow permissions hardening and test/lint/check action pinning
.github/workflows/CI.yml
Adds permissions: {} at workflow level and contents: read on the test, lint, and build jobs; pins actions/checkout (with persist-credentials: false), Rust toolchain, Rust cache, Python setup, Python cache, and re-actors/alls-green to specific SHAs in the test, lint, and check jobs.
Action SHA pinning in build and release jobs
.github/workflows/CI.yml
Pins actions/checkout, actions/setup-python, dtolnay/rust-toolchain, PyO3/maturin-action (for sdist and wheel), actions/upload-artifact, actions/download-artifact, pypa/gh-action-pypi-publish, and softprops/action-gh-release to specific commit SHAs across the build, release, and gh-release jobs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Snip goes Renovate, hop comes Dependabot!
SHAs pinned tight, permissions locked down,
No floating tags to let bad actors in town.
contents: read — just a nibble, no more,
The rabbit keeps the CI garden secure. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: resolve a few zizmor findings' directly relates to the main changes in the PR, which address security/configuration issues identified by zizmor in CI workflows and dependency management files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch resolve-zizmor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/CI.yml:
- Line 67: Remove the `if: "${{ !matrix.disable-gil }}"` condition line from the
workflow step. The `disable-gil` key is not defined in the matrix object
declaration, making this condition invalid and causing workflow validation to
fail. Simply delete this entire line to resolve the issue.
- Line 61: The rust-cache action at line 61 (and also at lines 74, 115, and 121)
currently allows cache saves on all pull_request runs, which is a security risk.
Add a `save-if` conditional to each of these cache steps that restricts cache
saves to trusted push events only. Use `if: github.event_name == 'push'` as the
save condition while keeping the restore functionality available for all events.
This follows the pattern of using the restore-only behavior on PRs and splitting
to a separate cache step with explicit event gating for saves.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5a4478a5-0780-46b3-9bc1-73811dd79f51

📥 Commits

Reviewing files that changed from the base of the PR and between ff30247 and ee559cb.

📒 Files selected for processing (3)
  • .github/dependabot.yml
  • .github/workflows/CI.yml
  • renovate.json
💤 Files with no reviewable changes (1)
  • renovate.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/dependabot.yml

Comment thread .github/workflows/CI.yml
- id: cache-rust
name: cache rust
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "CI.yml" -o -name "ci.yml" | head -20

Repository: dimastbk/python-calamine

Length of output: 95


🏁 Script executed:

cat -n .github/workflows/CI.yml | sed -n '50,130p'

Repository: dimastbk/python-calamine

Length of output: 2995


🏁 Script executed:

cat -n .github/workflows/CI.yml | head -50

Repository: dimastbk/python-calamine

Length of output: 1656


🏁 Script executed:

cat -n .github/workflows/CI.yml | sed -n '1,100p' | grep -A 20 "^.*on:"

Repository: dimastbk/python-calamine

Length of output: 2752


🌐 Web query:

Swatinem/rust-cache v2.9.1 default behavior pull_request save behavior

💡 Result:

In Swatinem/rust-cache v2.9.1, the default behavior for saving the cache is to always save it, regardless of whether the workflow run is triggered by a pull request or a push [1][2]. The action provides an input option called save-if that controls this behavior [1]. By default, save-if is set to "true" [1][3]. When this default is active, the action will restore the cache (if available) and then save the cache at the end of the job run [1][4]. If you wish to change this behavior—for example, to prevent pull requests from overwriting the main branch's cache or to only save cache when running on specific branches—you can explicitly configure the save-if input [1][3]. A common use case is to restrict saves to the default branch using a GitHub Actions expression [1]: save-if: ${{ github.ref == 'refs/heads/main' }} It is important to note that GitHub Actions has its own native caching scope restrictions: caches created in a pull request are generally only accessible to that specific pull request or the base branch from which it originated, meaning they cannot "pollute" or overwrite the primary cache of other branches unless specifically managed [5]. If you notice that cache is not being "found" in a PR, it is often due to these native GitHub cache scoping rules rather than the save-if configuration [5].

Citations:


🌐 Web query:

actions/cache v5.0.5 GitHub Actions pull_request write behavior default

💡 Result:

In GitHub Actions, the actions/cache@v5.0.5 action does not rely on the permissions block defined in your workflow file to determine its ability to write to the GitHub Actions cache [1][2]. Instead, cache operations are managed by GitHub's internal runner-scoped tokens, which automatically grant write access for workflows running on pull_request events within the repository [3][2]. Key behaviors regarding pull_request and cache write access include: 1. Automatic Write Capability: By default, jobs triggered by pull_request events have permission to create and write to caches within the scope of that specific pull request [3][4]. This allows workflows to "warm" a cache during a PR run. 2. Scope Isolation: Caches created during a pull_request run are restricted to that specific PR (specifically, the merge ref, refs/pull/.../merge) [3][4]. They cannot be restored by other pull requests or by the base branch, preventing unauthorized cache poisoning across different branches [3][4]. 3. Security Considerations: Because cache write operations bypass standard permissions: contents: read limitations, they can pose a security risk if a workflow runs in an untrusted context (e.g., pull_request_target or workflows that check out external PR head code) [1][2]. A malicious pull request could potentially "poison" the cache, which might then be restored by a subsequent trusted run on the main branch [1][2]. To mitigate these security risks, it is recommended to restrict cache writes for untrusted PR builds [1][2]. You can achieve this by using the actions/cache/restore@v5 sub-action instead of the full actions/cache@v5 action, or by adding a conditional check to ensure that the cache save step is skipped for pull_request events [1][2]: if: github.event_name!= 'pull_request' && github.event_name!= 'pull_request_target' uses: actions/cache@v5 with:...

Citations:


Restrict cache saves to trusted push events.

These cache steps currently enable save behavior on all pull_request runs. While GitHub's cache scoping prevents PR caches from overwriting the main branch cache, explicitly gating cache saves to trusted events (push) is a security best practice. Gate cache save using save-if conditionals, and allow restore for all events.

Mitigation pattern
-      - id: cache-rust
-        name: cache rust
-        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
+      - id: cache-rust
+        name: cache rust
+        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
         with:
           key: v3
+          save-if: ${{ github.event_name == 'push' }}

For actions/cache, use the restore-only action on PRs and split to separate save step with event gating on trusted pushes.

Applies to lines: 61, 74, 115, 121

🧰 Tools
🪛 zizmor (1.25.2)

[error] 61-61: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/CI.yml at line 61, The rust-cache action at line 61 (and
also at lines 74, 115, and 121) currently allows cache saves on all pull_request
runs, which is a security risk. Add a `save-if` conditional to each of these
cache steps that restricts cache saves to trusted push events only. Use `if:
github.event_name == 'push'` as the save condition while keeping the restore
functionality available for all events. This follows the pattern of using the
restore-only behavior on PRs and splitting to a separate cache step with
explicit event gating for saves.

Source: Linters/SAST tools

Comment thread .github/workflows/CI.yml
- name: set up python
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
if: "${{ !matrix.disable-gil }}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/CI.yml | head -80

Repository: dimastbk/python-calamine

Length of output: 2789


🏁 Script executed:

# Check if disable-gil appears anywhere else in the workflow
rg "disable-gil" .github/workflows/CI.yml

# Also check the full context around line 67 to see if there's more matrix definition
cat -n .github/workflows/CI.yml | sed -n '23,42p'

Repository: dimastbk/python-calamine

Length of output: 865


🏁 Script executed:

# Check all jobs in the workflow to see if any other job defines disable-gil
rg -A 20 "jobs:" .github/workflows/CI.yml | head -100

# Also check the entire workflow for all matrix definitions
rg "matrix:" .github/workflows/CI.yml -A 15

Repository: dimastbk/python-calamine

Length of output: 2130


🏁 Script executed:

# Get the entire CI.yml file to see all jobs and confirm disable-gil is not defined anywhere
wc -l .github/workflows/CI.yml

# Let's see the full file structure to be thorough
cat -n .github/workflows/CI.yml | tail -100

Repository: dimastbk/python-calamine

Length of output: 4169


Remove the undefined matrix key guard at Line 67.

matrix.disable-gil is not part of the declared matrix object, so this condition is invalid and will fail workflow validation. Remove the if statement since it references a non-existent matrix variable.

Proposed fix
      - name: set up python
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
-       if: "${{ !matrix.disable-gil }}"
        with:
          python-version: ${{ matrix.python-version }}
          allow-prereleases: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: "${{ !matrix.disable-gil }}"
- name: set up python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
🧰 Tools
🪛 actionlint (1.7.12)

[error] 67-67: property "disable-gil" is not defined in object type {pandas-version: string; python-version: string}

(expression)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/CI.yml at line 67, Remove the `if: "${{
!matrix.disable-gil }}"` condition line from the workflow step. The
`disable-gil` key is not defined in the matrix object declaration, making this
condition invalid and causing workflow validation to fail. Simply delete this
entire line to resolve the issue.

Source: Linters/SAST tools

@dimastbk dimastbk merged commit 22689a7 into master Jun 17, 2026
32 checks passed
@dimastbk dimastbk deleted the resolve-zizmor branch June 17, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant