Skip to content

ci(release): require approval and a tag policy on the pypi deployment environment #235

Closed

Description

@abruption

What happened

Security and stability hardening audit finding H08 / P3 (2026-09-28). Priority is an audit recommendation, not a claim of a production incident.

The publish job runs in the GitHub environment pypi, which PyPI Trusted Publishing is bound to. That environment has no protection:

gh api repos/abruption/session-peer/environments
  name: pypi
  protection_rules: []
  deployment_branch_policy: null
  can_admins_bypass: true

RELEASING.md requires final user approval immediately before publication, but nothing enforces it. Publishing a GitHub release (including by mistake, or from any tag the workflow accepts) starts the upload automatically, and PyPI files cannot be replaced or reused once uploaded. The workflow's own source checks fail closed on tag/version/ancestry mismatches, but they are not a human approval gate.

What you expected

  • A required reviewer on the pypi environment (the maintainer; self-review allowed for a single-maintainer repository), so the publish job waits for explicit approval after build, install and audit jobs have passed.
  • Deployments to pypi restricted to tags matching v*.
  • Administrator bypass disabled if practical, or its use documented.
  • The PyPI Trusted Publisher confirmed to require environment pypi, so the upload cannot be made from a job outside this environment.

Environment

  • Baseline: published session-peer v1.0.2, commit 2046836822b88e53246de73851186598604cb5ec.
  • Reproduction: read-only GitHub REST API query and source review; no settings were changed and no workflow was run.
  • Audit environment: macOS arm64.
  • No live message tests or production mutation.

Source evidence

Acceptance criteria

  • pypi environment has a required reviewer and a v* tag deployment policy, confirmed through the API.
  • PyPI Trusted Publisher configuration verified to name environment pypi.
  • RELEASING.md describes the approval step as the environment review and how to reject a pending deployment.
  • The next release confirms the job pauses for approval before upload.

Scope and limitations

Target: v1.0.3 hardening work. This issue does not authorize a release or operating-service changes; environment and PyPI settings are owner actions.

Related, not duplicates: #117 (release gates and publication provenance).

Checked

  • Searched existing issues for duplicates.
  • Removed credentials, conversation contents, private paths and real device/session identifiers.
  • Used isolated fixtures without weakening inbound permissions.

Activity

  1. added this to the v1.0.3 milestone on Sep 28, 2026
  2. added
    enhancement
    on Sep 28, 2026
  3. abruption commented on Sep 28, 2026

    @abruption
    OwnerAuthor

    Repository settings applied (2026-09-28), confirmed through the API:

    • pypi environment: required_reviewers (maintainer, self-review allowed) and a custom deployment policy limited to tags matching v*.

    Remaining acceptance items:

    • Verify on PyPI that the Trusted Publisher names environment pypi (not visible through the GitHub API).
    • RELEASING.md (four languages): describe the approval as the environment review and how to reject a pending deployment. Drafted with the next release preparation.
    • The next release confirms the job pauses for approval before upload.
  4. abruption commented on Sep 29, 2026

    @abruption
    OwnerAuthor

    PyPI Trusted Publisher verified on 2026-09-29: the GitHub publisher for this project is bound to repository abruption/session-peer, workflow publish.yml and environment pypi. Combined with the environment's required reviewer and v* tag policy, a PyPI upload now requires an approved deployment from that environment.

    Remaining:

    • RELEASING.md (four languages) approval/rejection step — included in the next release preparation.
    • The next release confirms the job pauses for approval before upload.
  5. abruption commented on Oct 5, 2026

    @abruption
    OwnerAuthor

    v1.0.3 acceptance evidence: exact main 0d25255; preparation run https://github.com/abruption/session-peer/actions/runs/37247147805 and publication/verification run https://github.com/abruption/session-peer/actions/runs/37247453910 succeeded. The PyPI job was observed waiting on environment pypi before upload, followed by review history state approved, user abruption, environment pypi. No administrator bypass or automated approval was used. Candidate hashes/provenance were reviewed before publication; upload and fresh-install/hash verification passed. Rejection UI remains documented rather than exercised on this successful publication.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions