Skip to content

Add zizmor to ci/cd #24663

Merged
krrish-berri-2 merged 2 commits intomainfrom
litellm_test_branch_03_26_2026_p1
Mar 27, 2026
Merged

Add zizmor to ci/cd #24663
krrish-berri-2 merged 2 commits intomainfrom
litellm_test_branch_03_26_2026_p1

Conversation

@krrish-berri-2
Copy link
Copy Markdown
Contributor

Relevant issues

Addresses #24512 (comment)

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

  • Addresses all zizmor comments about our github action yaml's
  • Includes a new zizmor action

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Mar 27, 2026 4:13am

Request Review

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Mar 27, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_test_branch_03_26_2026_p1 (dfb5433) with main (b20cff8)

Open in CodSpeed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR hardens the repository's GitHub Actions CI/CD workflows against injection attacks and over-privileged credentials, following recommendations from the zizmor static analysis tool. The core changes are: moving inline ${{ ... }} expressions to step-level env: blocks, pinning action refs to full commit SHAs, adding explicit permissions: blocks, and adding persist-credentials: false to actions/checkout calls.\n\nKey changes:\n- Inline expression injection risk eliminated across all changed workflows by routing values through env vars.\n- Action SHAs pinned in action.yml and dependabot cooldown periods added.\n- Explicit, minimal permissions: blocks added to 10+ workflows.\n- persist-credentials: false universally applied to actions/checkout.\n\nIssues found:\n- Breaking regression (P0): Both create-staging-branch and create-internal-dev-branch jobs in create_daily_staging_branch.yml call git push origin $BRANCH_NAME after setting persist-credentials: false. With no credential helper in place, these pushes will fail at runtime.\n- Silent caching regression (P1): In llm-translation-testing.yml, actions/cache was replaced with actions/cache/restore. The restore-only variant never writes an updated cache entry back after the job, so the Poetry dependency cache will grow stale over time.\n- Missing zizmor workflow: The PR description states "Includes a new zizmor action," but no new workflow file appears in the diff.

Confidence Score: 2/5

Not safe to merge as-is: create_daily_staging_branch.yml will fail at runtime due to broken git authentication after persist-credentials: false is applied to push jobs.

The security hardening intent is sound and most changes are correct. However, the persist-credentials: false change in create_daily_staging_branch.yml introduces a concrete runtime breakage: both branch-creation jobs call git push with no credential mechanism left in place, which will fail every scheduled run. This breaks a production workflow. The caching regression in llm-translation-testing.yml is a secondary (P1) issue. Together these prevent a safe merge.

.github/workflows/create_daily_staging_branch.yml (broken git push auth), .github/workflows/llm-translation-testing.yml (cache never saved)

Important Files Changed

Filename Overview
.github/workflows/create_daily_staging_branch.yml Adds persist-credentials: false and permissions: contents: write, but breaks git push because no authentication mechanism is configured for git after credentials are dropped.
.github/workflows/auto_update_price_and_context_window.yml Adds top-level permissions block and persist-credentials: false; git operations use GH_TOKEN via the gh CLI which can work independently of the checkout credential helper.
.github/actions/helm-oci-chart-releaser/action.yml Moves all inline ${{ inputs.* }} expressions to env vars and uses quoted shell references — correct injection-hardening with no functional regressions.
.github/workflows/llm-translation-testing.yml Switches actions/cacheactions/cache/restore, which silently drops cache-save behaviour; inline expressions moved to env vars correctly.
.github/workflows/run_observatory_tests.yml Replaces ${{ env.TUNNEL_URL }} / ${{ env.CLOUDFLARED_PID }} with bare shell vars; these are set via $GITHUB_ENV so are available as real shell env vars in later steps — safe change.
.github/dependabot.yaml Adds cooldown periods (7 days default, 14 days for major bumps) to reduce dependabot noise — straightforward and safe.
.github/workflows/stale.yml Adds explicit issues: write and pull-requests: write permissions, matching what the stale action already needs — safe improvement.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Workflow trigger] --> B[actions/checkout\npersist-credentials: false]
    B --> C{Job needs\ngit push?}
    C -- No --> D[✅ Read-only jobs\ntest-linting, test-litellm,\ncodspeed, codeql, etc.]
    C -- Yes --> E{Explicit auth\nconfigured?}
    E -- Yes --> F[✅ auto_update_price\nuses GH_TOKEN via gh CLI]
    E -- No --> G[❌ create_daily_staging_branch\ngit push fails — no credential helper]
    G --> H[403 Authentication Error\nat runtime]
Loading

Comments Outside Diff (1)

  1. .github/workflows/create_daily_staging_branch.yml, line 45 (link)

    P0 git push will fail after persist-credentials: false

    Setting persist-credentials: false on actions/checkout removes the credential helper that the action normally injects into the git config. As a result, git push origin $BRANCH_NAME has no way to authenticate with GitHub and will fail with a 403/authentication error at runtime.

    The GITHUB_TOKEN environment variable is present, but git does not read that variable automatically — it relies on the credential helper configured by actions/checkout, which is now disabled.

    To fix both the create-staging-branch job (line 45) and the create-internal-dev-branch job (line 85), you need to either:

    1. Re-configure the git remote URL to embed the token before the push (e.g. using gh auth setup-git), or
    2. Drop persist-credentials: false from these two jobs, since they intentionally need write access to push branches.

    The persist-credentials: false approach is correct for read-only checkout jobs, but it breaks jobs that must push back to the repository.

Reviews (1): Last reviewed commit: "fix: address zizmor comments" | Re-trigger Greptile


- name: Cache Poetry dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0
- name: Restore Poetry dependencies cache
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.

P1 Cache save behavior silently dropped

Renaming from actions/cache to actions/cache/restore is a meaningful semantic change: cache/restore only restores a previously-saved cache entry but never writes an updated entry back at the end of the job. Using actions/cache would both restore and save.

The practical effect is that the Poetry virtual-environment cache will gradually become stale and will never be refreshed (e.g., when pyproject.lock changes). This defeats the purpose of the cache step over time and can lead to test failures when new dependencies are added.

If the goal was purely to satisfy a zizmor warning, consider using actions/cache with an explicit save-always: false option, or add a separate actions/cache/save step after tests complete, so the cache is still kept up-to-date.

@krrish-berri-2 krrish-berri-2 merged commit ff63df2 into main Mar 27, 2026
37 of 85 checks passed
@krrish-berri-2 krrish-berri-2 deleted the litellm_test_branch_03_26_2026_p1 branch March 27, 2026 15:59
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.

2 participants