Skip to content

fix: transport, IPFS and key-sharing hardening (R2 follow-up) - #7

Merged
SaulBuilds merged 4 commits into
mainfrom
fix/pba-r2-sdk-followup
Sep 25, 2026
Merged

SaulBuilds merged 4 commits into
mainfrom
fix/pba-r2-sdk-followup

Conversation

@SaulBuilds

Copy link
Copy Markdown
Contributor

R2 follow-up: sdk-python hardening

This PR follows up on #6 after independent verification. It touches the transport gate, IPFS verification and key sharing. Details are in the private audit record.

Item Change Tests Mutation Status
PBA-L6b-026 (and L6b-027 through the shared gate) Endpoint URLs must use only RFC 3986 characters and carry no userinfo. The host must agree between urllib3 (which requests uses) and urllib.parse. Unparseable URLs raise InsecureTransportError. tests/test_pba_r2_l6b_026_parser_differential.py, including a live-listener check and a re-test of the wallet verifier Revert: red (23 failed), restored green. mutmut: survivors are message-text or equivalent. FIXED
PBA-L6b-030 A download is refused unless it can be verified: pass expected_sha256, or opt out explicitly with verify=False (logged). tests/test_pba_r2_l6b_030_mandatory_verify.py Revert: red (6 failed), restored green FIXED
PBA-L6b-003 follow-up Test for the canonical holder dedupe (the verifier's mutant is now killed). threshold_shares=1 requires allow_single_holder_recovery=True. The deploy guard is now structural. tests/test_pba_r2_followup_shares.py Dedupe mutant killed. Revert: red (11 failed). mutmut: 90 killed; survivors are message-text or equivalent. FIXED

Changes to existing tests

  • test_network_error_handling now uses a valid port. An unparseable URL (port 99999) is refused at construction.
  • Plumbing tests that use CIDs without a hash now pass verify=False.
  • The 1-of-1 boundary test passes the new opt-in.

Version: 0.6.2 is still unpublished, so there's no bump. The changes are noted in CHANGELOG.

CI parity (Python 3.11.16, ruff, mypy, pip-audit):

  • 629 passed, 4 skipped. test_economics_simulation.py is unchanged and runs in CI.
  • ruff, mypy and pip-audit are clean.
  • uv lock --check passes.
  • The wheel tripwire passes.

Publishing stays with the owner.

🤖 Generated with Claude Code
https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P

BerryManifold and others added 4 commits September 25, 2026 08:22
The transport gate now refuses characters outside RFC 3986 and any userinfo, parses with urllib3 (the parser requests uses) and requires it to agree with urllib.parse on the host, and reports unparseable URLs as InsecureTransportError. urllib3 is now an explicit dependency (already locked via requests). All gated clients and verify_wallet_address_on_chain (PBA-L6b-027) are covered by tests, including a live listener check. test_network_error_handling now uses a valid port, because an unparseable URL is refused at construction.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P
Downloads whose address cannot verify its own content now require expected_sha256, or an explicit verify=False opt-out that logs a warning. The opt-out never skips a supplied hash or the size cap. Earlier size-cap tests pass verify=False.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P
Holder dedupe is pinned by a canonical-encoding test. threshold_shares=1 needs allow_single_holder_recovery=True. The deploy guard also refuses share-shaped values and JSON-encoded blobs, not only the known field names. Plumbing tests that used unverifiable CIDs pass verify=False; the 1-of-1 boundary test passes the new opt-in. Mutation-checked with mutmut: every remaining survivor changes only message text or is equivalent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P
0.6.2 is still unpublished, so no version bump.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P
@SaulBuilds
SaulBuilds merged commit cb78d82 into main Sep 25, 2026
9 checks passed
@SaulBuilds
SaulBuilds deleted the fix/pba-r2-sdk-followup branch September 25, 2026 16:32
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