python: strict receiver validation per BBQr BIP draft - #21
Open
scgbckbone wants to merge 3 commits into
Open
scgbckbone wants to merge 3 commits into
scgbckbone wants to merge 3 commits into
Conversation
Contributor
Author
Contributor
Author
|
3293ab5: exact 1k window via a validate-only pure-python DEFLATE distance scan (CPython zlib compiles out INFLATE_STRICT, no dmax access), boundary tests (1024 accepted, 1025/2048 rejected), vectors re-synced to draft v4 with conflicting-duplicate under strict_policy_cases. 3722 tests pass. |
scgbckbone
commented
Jul 29, 2026
| return encoding, data, 8 | ||
|
|
||
| def decode_data(parts, encoding): | ||
| def scan_deflate_distances(stream, max_dist=1024): |
Contributor
Author
There was a problem hiding this comment.
looks like overkill
This branch has not been deployed
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.
Negative vector: lowercase-hex-body
Frame: B$HT0100aa
Behavior before: bytes.fromhex() accepts lowercase (and whitespace), so the
frame decoded
Fixed by: uppercase-only charset check on H bodies
────────────────────────────────────────
Negative vector: noncanonical-base32-pad-bits
Frame: B$2P0100AB
Behavior before: b32decode() silently discards the non-zero pad bits; AB
decoded to the same byte as canonical AA
Fixed by: re-encode round-trip comparison after decode
────────────────────────────────────────
Negative vector: deflate-trailing-data
Frame: B$ZP0100JNGEUBQAAA
Behavior before: bytes after the DEFLATE end-of-stream marker were silently
ignored
Fixed by: z.unused_data must be empty
────────────────────────────────────────
Negative vector: empty-body
Frame: B$HT0100
Behavior before: header with no body decoded to an empty transfer
Fixed by: body must be non-empty; decoded transfer must be non-empty
The remaining 10 negative vectors (zero total, index ≥ total, unknown
encoding, odd hex length, invalid Base32 terminal length, missing frame,
mixed headers, conflicting duplicate, zlib wrapper, etc.) were already
rejected — unchanged.
Also tightened, per draft rules that have no published vector:
must be uppercase base-36 digits (int(x, 36) previously accepted lowercase)
longer (the independent-placement invariant the format relies on)
previously returned partial data without any error (z.eof check)