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

@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 previously approved these changes Oct 24, 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.

@rajnisht7

Copy link
Copy Markdown
Member

@drk-ram Kindly rebase on main

zohebk8s
zohebk8s previously approved these changes Oct 27, 2026
@drk-ram drk-ram closed this Oct 29, 2026
@drk-ram
drk-ram force-pushed the drk-ram-fix-transport-b64url-wire-271 branch from b0852d7 to 1889ce4 Compare October 29, 2026 15:20
@drk-ram drk-ram reopened this Oct 29, 2026
@drk-ram
drk-ram dismissed stale reviews from zohebk8s and carloshvp via 9a3a1b6 October 29, 2026 15:21
@drk-ram

drk-ram commented Oct 29, 2026

Copy link
Copy Markdown
Author

@rajnisht7 Rebased onto origin/main (1889ce4) in 9a3a1b6.

@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 current head 9a3a1b6f9782f69de9714b4f57c50533418558ae in an isolated checkout.

The scoped input-hardening behavior passes source review and the full local unit/conformance suite (873 passed, 16 skipped). Ruff lint, mypy, configured Bandit and dependency consistency pass; the commit is signed off.

The required ruff format --check src/ tests/ job still fails on this head, while the same command passes on current main. Please run the pinned formatter on tests/unit/test_a2a_adapter.py and rerun the format gate. The formatting diff is mechanical; no additional behavioral repair is requested by this review. Hosted CI and the independent security-review requirements still apply.

Reviewed with OpenAI Codex.

Copy link
Copy Markdown
Contributor

The requested formatting correction is ready for author adoption: dinakarjs#4, commit d0395bce04c20f46398214e4b5b8e592ae80f224, based directly on this reviewed PR head. Pinned Ruff 0.17.1 formatting changes only; every changed Python AST is identical before/after. Final unit/conformance run: 887 passed, 2 skipped; Ruff format/lint, mypy, Bandit and whitespace checks pass. Environment and scope are recorded in the companion. Please cherry-pick into the existing PR and rerun hosted checks. This does not replace independent maintainer approval. DCO signed; prepared with Codex.

…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 Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram

drk-ram commented Oct 31, 2026

Copy link
Copy Markdown
Author

@carloshvp Amended and force-pushed f231b13 (f231b13c8afb5f98dacdbac71e1dc0a3c9046778). ruff format --check src/ tests/ and ruff check src/ tests/ now pass with 0 errors.

@drk-ram
drk-ram force-pushed the drk-ram-fix-transport-b64url-wire-271 branch from 9a3a1b6 to f231b13 Compare October 31, 2026 15:08

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

5 participants