Skip to content

Implements signed index support - #312

Merged
zooba merged 27 commits into
mainfrom
gh-308
Apr 15, 2026
Merged

Implements signed index support#312
zooba merged 27 commits into
mainfrom
gh-308

Conversation

@zooba

@zooba zooba commented Apr 13, 2026

Copy link
Copy Markdown
Member

Fixes #308

Copilot AI 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.

Pull request overview

This PR adds signed-index verification for runtime feed JSONs, aiming to detect tampering of the python.org index while keeping the feature configurable for other sources (Fixes #308).

Changes:

  • Introduces a Windows native _native.verify_trust implementation to validate a JSON file against a signed catalog (.cat) using OS trust.
  • Extends IndexDownloader to fetch and validate {index_url}.cat before processing indexes, with configurable per-source requirements (source_settings).
  • Updates CI pipelines to generate/sign catalog files for partitioned indexes and upload the resulting .json.cat artifacts; adds tests and test fixtures.

Reviewed changes

Copilot reviewed 18 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/test_verify.py Adds end-to-end tests covering successful verification and failure/bypass paths.
tests/data/self-signed.cat Adds an untrusted (self-signed) catalog fixture for negative tests.
tests/data/psf-signed.cat Adds a trusted/signed catalog fixture for positive tests.
tests/data/index-windows.json Adds a test index fixture used by verification tests.
src/pymanager.json Adds default source_settings for python.org index URLs.
src/manage/urlutils.py Implements signature download/verification flow in IndexDownloader.
src/manage/list_command.py Updates call sites for new IndexDownloader(cmd, ...) signature.
src/manage/install_command.py Updates call sites for new IndexDownloader(cmd, ...) signature.
src/manage/indexutils.py Extends index schema with signature-related fields.
src/manage/exceptions.py Adds an exit code to InvalidFeedError for CLI handling.
src/manage/commands.py Adds source_settings to config schema and command attributes.
src/manage/init.py Treats InvalidFeedError as a user-facing error with an exit code.
src/_native/verify_trust.cpp Adds native Windows verification logic for signed catalog + file hash membership.
scripts/repartition-index.py Updates for new IndexDownloader constructor signature.
ci/upload.py Uploads .json.cat alongside .json for index publishing.
ci/sign-files.yml Adds reusable signing template used by pipelines.
ci/repartition-index.yml Generates catalogs for index JSONs, signs them, and handles publish vs pretend-publish paths.
ci/release.yml Refactors signing parameters and uses sign-files.yml; restructures post-test and publish stages.
_msbuild_test.py Links wintrust.lib and exports verify_trust for test builds.
_msbuild.py Links wintrust.lib and exports verify_trust for production builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/manage/urlutils.py Outdated
Comment thread ci/release.yml
Comment thread src/manage/urlutils.py Outdated
Comment thread src/manage/commands.py
Comment thread src/manage/indexutils.py Outdated
Comment thread src/manage/urlutils.py
Comment thread src/_native/verify_trust.cpp Outdated
Comment thread src/_native/verify_trust.cpp Outdated
@zooba
zooba merged commit 38c243c into main Apr 15, 2026
5 checks passed
@zooba
zooba deleted the gh-308 branch April 15, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants