Repository navigation
fix(transport): enforce canonical base64url in b64url_decode and reject non-string fields in parse_channel_offer (#271) - #276
Conversation
…ct non-string fields in parse_channel_offer (agentrust-io#271) - Require len(value) % 4 != 1 and exact round-trip b64url_encode(raw) == value in b64url_decode. - Require non-empty str values for channel_public_key, platform, measurement, public_key, and nonce and a dict attestation object in parse_channel_offer. Closes agentrust-io#271 Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed exact head b0852d7785ce0a76034724fb429b71d57dc537d4 in an isolated checkout.
The shared transport decoder rejects noncanonical encodings and the channel-offer parser validates nonempty string claims and mapping-shaped attestation. The six encoding regressions pass here; restoring the actual merge-base decoder/parser in process causes the three nonzero-pad-bit cases to fail their rejection assertions, while existing valid transport exchanges pass in the full suite.
Fresh hash-locked Python 3.12.10 validation: 817 unit tests passed, 16 skipped; pip check, Ruff, mypy and Bandit passed. Commit sign-offs are present. Please trim the extra blank line at test_a2a_adapter.py EOF. No blocking source finding; hosted CI and applicable security-maintainer approvals remain separate.
Reviewed with OpenAI Codex.
What
Enforce canonical unpadded base64url in
ca2a_runtime.transport._b64url.b64url_decodeand reject non-string or empty claim fields inca2a_runtime.transport.wire.parse_channel_offer.Why
Closes #271.
Security impact
Prevents malleable non-canonical base64url encodings (non-zero trailing padding bits) in
sealed_payloadand hardware evidence fields (raw_evidence,quote_signature,attestation_key_pem,attestation_key_chain_pem) and prevents silentstr(...)coercion ofnull,bool,int, orlistvalues in channel offers.Test plan
pytestpasses (pytest tests/unit/test_a2a_adapter.py tests/unit/test_peer_request.py tests/unit/test_caller_offer_relay.py -q:85 passed)ruff checkpasses (ruff check src/ca2a_runtime/transport/_b64url.py src/ca2a_runtime/transport/wire.py tests/unit/test_a2a_adapter.py:All checks passed!)mypypasses (mypy --strict src/ca2a_runtime/transport/_b64url.py src/ca2a_runtime/transport/wire.py:Success)DCO sign-off
Developer Certificate of Origin (https://developercertificate.org).