fix: transport, IPFS and key-sharing hardening (R2 follow-up) - #7
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
InsecureTransportError.tests/test_pba_r2_l6b_026_parser_differential.py, including a live-listener check and a re-test of the wallet verifierexpected_sha256, or opt out explicitly withverify=False(logged).tests/test_pba_r2_l6b_030_mandatory_verify.pythreshold_shares=1requiresallow_single_holder_recovery=True. The deploy guard is now structural.tests/test_pba_r2_followup_shares.pyChanges to existing tests
test_network_error_handlingnow uses a valid port. An unparseable URL (port 99999) is refused at construction.verify=False.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):
test_economics_simulation.pyis unchanged and runs in CI.uv lock --checkpasses.Publishing stays with the owner.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FYQkdsk54yob6FD24jAT8P