Skip to content

fix(transport): enforce canonical base64url in b64url_decode and reject non-string fields in parse_channel_offer (#271) - #276

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-transport-b64url-wire-271
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-transport-b64url-wire-271

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 23, 2026

Copy link
Copy Markdown

What

Enforce canonical unpadded base64url in ca2a_runtime.transport._b64url.b64url_decode and reject non-string or empty claim fields in ca2a_runtime.transport.wire.parse_channel_offer.

Why

Closes #271.

Security impact

Prevents malleable non-canonical base64url encodings (non-zero trailing padding bits) in sealed_payload and hardware evidence fields (raw_evidence, quote_signature, attestation_key_pem, attestation_key_chain_pem) and prevents silent str(...) coercion of null, bool, int, or list values in channel offers.

Test plan

  • pytest passes (pytest tests/unit/test_a2a_adapter.py tests/unit/test_peer_request.py tests/unit/test_caller_offer_relay.py -q: 85 passed)
  • ruff check passes (ruff check src/ca2a_runtime/transport/_b64url.py src/ca2a_runtime/transport/wire.py tests/unit/test_a2a_adapter.py: All checks passed!)
  • mypy passes (mypy --strict src/ca2a_runtime/transport/_b64url.py src/ca2a_runtime/transport/wire.py: Success)
  • Manual test performed

DCO sign-off

…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>
@drk-ram
drk-ram requested review from a team, carloshvp and zohebk8s as code owners October 23, 2026 15:23
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 23, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(transport): enforce canonical base64url in b64url_decode and reject non-string fields in parse_channel_offer

2 participants