[codex] harden Python submit wrapper against malformed inputs#30
Open
[codex] harden Python submit wrapper against malformed inputs#30
Conversation
[codex] fix emission-date overflow in Python submit wrapper
LDiazN
approved these changes
Apr 2, 2026
Contributor
There was a problem hiding this comment.
LGTM, remember to edit the library version before merging, see:
userauth/ooniauth-py/Cargo.toml
Line 3 in 34e5052
0.1.3 should be good
mmaker
commented
Apr 13, 2026
Contributor
|
After our discussion in Slack, I also set the upper bound of the measurement count range to be fixed to |
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 changed
This PR now combines the original malformed-submit hardening with the emission-date arithmetic fix.
Specifically, it:
handle_submit_requestinputs as typed deserialization errors instead of panickingnymlength and range-list shape before indexingemission_date - 30andemission_date + 1arithmetic with checked handlingWhy
The Python submit wrapper previously had multiple bad-input failure modes: malformed external input could panic in the submit handler, and edge-case emission dates could underflow or overflow while constructing the allowed age range.
Impact
The wrapper now fails closed on malformed submit inputs and impossible emission dates instead of crashing or wrapping arithmetic.
Validation
cargo test -p ooniauth_py test_handle_submit_request_rejects_short_ --manifest-path /tmp/codex-bugfixes/userauth-py-panics/Cargo.tomlcargo test -p ooniauth_py test_make_submit_request_rejects_date_overflow --manifest-path /tmp/codex-bugfixes/userauth-py-panics/Cargo.tomlcargo test -p ooniauth_py test_basic_usage --manifest-path /tmp/codex-bugfixes/userauth-py-panics/Cargo.toml