fix: Replace NULL sentinels in form data and tolerate malformed validation errors - #646
Open
razor-x wants to merge 2 commits into
Open
fix: Replace NULL sentinels in form data and tolerate malformed validation errors#646razor-x wants to merge 2 commits into
razor-x wants to merge 2 commits into
Conversation
…ation errors Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y1RzepycXEYA3LStfjt8cY
…it-o2iid9-13-null-data-validation
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.
What
Two small hardening fixes from the SDK audit's L5 grab-bag:
NULLin form data (L5c). The client'srequestoverride appliedreplace_nulltojson=bodies and search params but not todata=— so the documentedNULLsentinel form-encoded viastr()as the literal string"NULL". No generated route usesdata=, but it is part of the documentedseam.client.post(...)escape hatch. Mapping-shapeddata=now gets the samereplace_nullpass in both clients (name=NULL&kept=value→name=&kept=value).Malformed
validation_errorsshapes (L5d).SeamHttpInvalidInputErrortrusted the server'svalidation_errorsenvelope: a list/string envelope, or a parameter entry that isn't a dict, raisedAttributeErrorfrom inside the accessors — and thevalidation_errorsproperty added in #631 walks every key, so a single oddly-shaped entry blew up the whole accessor. Both accessors now degrade to "no validation details" ([]) for anything but the expected object-of-objects shape, while well-formed entries next to malformed ones still surface.Also teaches the test suite's recording server to record form-encoded bodies as text instead of failing to JSON-parse them.
Testing
New
test/null_data_test.py: wire assertion that the sentinel form-encodes as an empty value; list/string envelopes and non-dict/non-list parameter values return[]without raising, with well-formed siblings intact.Revert check: with
seam/client.pyandseam/exceptions.pyreverted, the tests fail with the audit's symptoms —name=NULL&kept=valueon the wire andAttributeError: 'list' object has no attribute 'get'.Full suite: 190 passed; mypy, pylint (10.00), black clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y1RzepycXEYA3LStfjt8cY
Generated by Claude Code