Skip to content

[SECURITY] Publish to PyPI from a tag with Trusted Publishing instead of manual token uploads #210

Backlog

Description

@OkiriGabriel

Problem

Releases are published to PyPI by hand with a long-lived API token (twine upload from a laptop). This has gone wrong repeatedly (TestPyPI vs PyPI tokens, scope errors), and the token is a supply-chain risk: anyone who gets it can publish devops-ai-agent. Nothing checks that the uploaded files match a reviewed commit.

Proposed fix

  • Add .github/workflows/release.yml, triggered on pushed v* tags:
    1. check that the tag equals project.version in pyproject.toml,
    2. run the test suite,
    3. python -m build + twine check,
    4. publish with PyPI Trusted Publishing (OIDC, pypa/gh-action-pypi-publish, id-token: write, a protected pypi environment that needs maintainer approval). No token is stored anywhere.
    5. create a GitHub Release with generated notes and attach the sdist and wheel, plus build provenance (actions/attest-build-provenance).
  • Pin actions by SHA (see [SECURITY] Supply chain: build images from a hashed lock file instead of open >= ranges #121 for the dependency side).
  • Configure the trusted publisher on pypi.org (owner open-devops-agent, repo open-devops-agent, workflow release.yml, environment pypi), then revoke the old API tokens.
  • Document the release steps in CONTRIBUTING.md: bump the version in a PR, merge, git tag vX.Y.Z && git push --tags.

Files

New .github/workflows/release.yml, CONTRIBUTING.md, docs/BUILD_AND_USAGE.md

Activity

  1. added
    enhancement
    security
    ci
    on Nov 26, 2026
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

    cienhancementsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions