Repository navigation
prototype(gate_store): reject float overflow, out-of-range integers, empty identifiers, and invalid RemoteGateStore timeout (#645) - #652
Open
drk-ram wants to merge 1 commit into
Conversation
…empty identifiers, and invalid RemoteGateStore timeout (agentrust-io#645) - Add _finite_float (parse_float) in _recv to reject overflowed float literals (1e309, -1e309). - Bound _int to [0, 9007199254740991] so negative or >= 2**63 integers raise ValueError and return {'error': 'malformed'} instead of raising an uncaught sqlite3 OverflowError. - Reject empty strings in _str and validate that RemoteGateStore timeout is a positive finite int or float (excluding bool). Closes agentrust-io#645 Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
Contributor
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
Member
|
Batch response for this cluster is here: #653 (comment) |
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.
What this changes
Closes #645.
Hardens
prototype/gate_store.py:_finite_float(parse_float) to_recvso overflowed JSON float literals (1e309,-1e309) raiseValueError._intto0 <= value <= 9007199254740991so negative or>= 2**63integers raiseValueErrorand return{"error": "malformed"}instead of crashing_Handler.handlewith an uncaughtsqlite3OverflowError.""in_str.RemoteGateStore(..., timeout=...)is a positive finiteintorfloat(excludingbool).Validation commands and results:
PYTHONPATH=src python -m pytest tests/test_gate_store_and_cmcp_gate_hardening.py -q-> passed (85 passed)python -m ruff check prototype/gate_store.py tests/test_gate_store_and_cmcp_gate_hardening.py-> passed (All checks passed!)python tools/check_dashes.py-> passed (no dashes outside examples/, spec/trace-v0.1.md)PYTHONPATH=src python tools/review_bar.py --base origin/main --head HEAD-> passed (13 changed test cases fail on behaviour at origin/main)Type of change
Spec section
prototype/gate_store.py(experimental cMCP replay-state store prototype; no normative change tospec/trace-v0.2.md)Tests for a fix
parse_float=_finite_floatin_recv:tests/test_gate_store_and_cmcp_gate_hardening.py::test_recv_rejects_float_exponent_overflow0 <= value <= 9007199254740991in_int:tests/test_gate_store_and_cmcp_gate_hardening.py::test_int_and_server_reject_out_of_range_integers_without_crashing_str:tests/test_gate_store_and_cmcp_gate_hardening.py::test_str_and_server_reject_empty_string_identifierstimeoutvalidation inRemoteGateStore.__init__:tests/test_gate_store_and_cmcp_gate_hardening.py::test_remote_gate_store_rejects_invalid_timeoutChangelog entry
prototype.gate_storenow rejects overflowed JSON floats in_recv, bounds_intto[0, 9007199254740991]so 64-bit integer overflows returnmalformedinstead of raising an uncaughtOverflowError, rejects empty string identifiers in_str, and validatesRemoteGateStoretimeout.Checklist
git commit -s)<!-- CHANGED: #NNN: description -->in spec text