Skip to content

[BUG]: False positive: uv publish uses trusted publishing #1191

Closed

Description

@konstin

Pre-submission checks

  • I am not filing a feature request. These should be filed via the feature request form instead.
  • I have looked through both the open and closed issues for a duplicate report.

zizmor version

v1.14.1,, 6c8b251

Expected behavior

uv publish with id-token: write is accepted as trusted publishing

Actual behavior

uv publish is always considered token-based publishing.

name: "Publish to PyPI"

on:
  workflow_call:

jobs:
  pypi-publish:
    name: Upload to PyPI
    runs-on: ubuntu-latest
    environment:
      name: release
    permissions:
      # For PyPI's trusted publishing.
      id-token: write
    steps:
      - name: "Install uv"
        uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
      - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
        with:
          pattern: wheels-*
          path: wheels
      - name: Publish to PyPi
        run: uv publish -v wheels/*
$ uvx zizmor .github/workflows/publish-pypi.yml -v
DEBUG collect_inputs: zizmor::config: discovering config for local input `.github/workflows/publish-pypi.yml`
DEBUG collect_inputs: zizmor::config: attempting config discovery in `.github/workflows`
DEBUG collect_inputs: zizmor::config: found `/home/konsti/projects/ty/.git`, stopping search
DEBUG collect_inputs: zizmor::registry::input: registering workflow input as with key file://.github/workflows/publish-pypi.yml
 INFO zizmor::registry: skipping impostor-commit: can't run without a GitHub API token
 INFO zizmor::registry: skipping ref-confusion: can't run without a GitHub API token
 INFO zizmor::registry: skipping known-vulnerable-actions: can't run without a GitHub API token
 INFO zizmor::registry: skipping stale-action-refs: can't run without a GitHub API token
 INFO zizmor::registry: skipping ref-version-mismatch: can't run without a GitHub API token
DEBUG audit: zizmor: running artipacked on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running unsound-contains on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running excessive-permissions on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running dangerous-triggers on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running use-trusted-publishing on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running template-injection on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running hardcoded-container-credentials on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running self-hosted-runner on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running unpinned-uses on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running undocumented-permissions on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running insecure-commands on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running github-env on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running cache-poisoning on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running secrets-inherit on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running bot-conditions on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running overprovisioned-secrets on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running unredacted-secrets on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running forbidden-uses on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running obfuscation on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running unpinned-images on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running anonymous-definition on file://.github/workflows/publish-pypi.yml
DEBUG audit: zizmor: running unsound-condition on file://.github/workflows/publish-pypi.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/publish-pypi.yml
info[use-trusted-publishing]: prefer trusted publishing for authentication
  --> .github/workflows/publish-pypi.yml:23:14
   |
23 |         run: uv publish -v wheels/*
   |         ---  ^^^^^^^^^^^^^^^^^^^^^^ this command
   |         |
   |         this step
   |
   = note: audit confidence → High

3 findings (2 suppressed): 1 informational, 0 low, 0 medium, 0 high

Reproduction steps

See above.

Logs

See above.

Additional context

Implemented here:

r"(?s)uv\s+(.+\s+)?publish",

ref #282

Activity

  1. added
    bugSomething isn't working
    triageIssue is being triaged
    on Sep 29, 2025
  2. nijel commented on Sep 29, 2025

    @nijel

    The rule also matches uv publish --trusted-publishing always which fails if trusted publishing is not available.

  3. woodruffw commented on Sep 29, 2025

    @woodruffw
    Member

    Thanks @konstin! Yeah, this looks like a regression, maybve with #1161. I'll look at it now.

  4. woodruffw commented on Sep 29, 2025

    @woodruffw
    Member

    Yeah, here's the problematic change: https://github.com/zizmorcore/zizmor/pull/1161/files#diff-a678c93ad59a932c634a2a235d0da1f77fa0729d1aa3f4c5b3f5d240f65c6f33L305-R346

    I hadn't thought through the consequences of that enough -- our ability to detect these publishing scenarios via CLI options is too imprecise at the moment for us to distinguish between incomplete TP migrations and complete ones. I'll revert that part of the change.

    CC @KristianGrafana for viz 🙂

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions