Skip to content

fix(transport,harness): validate collect_metadata/parent_record_hash, bound SDK float-to-int by safe int, and reject duplicate JSON keys in harness (#286) - #291

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-adapter-sdk-harness-286

Conversation

@drk-ram

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

Copy link
Copy Markdown

What

Validate message_or_request and metadata mapping types and reject empty string parent_record_hash in a2a_adapter, bound metadata_from_sdk_message float-to-int conversion by RFC 8785 safe-integer limits (2**53 - 1), and reject duplicate JSON keys and NaN/Infinity in hardware_acceptance.

Why

Closes #286.

Security impact

Prevents unhandled AttributeError/TypeError on malformed A2A envelopes, prevents lossy IEEE-754 floats >= 2**53 in protobuf Struct metadata from being coerced into imprecise integers, and closes duplicate-key JSON smuggling in the hardware acceptance harness.

Test plan

  • pytest passes (pytest tests/unit/test_hardware_acceptance.py tests/unit/test_a2a_adapter.py -q: 27 passed, 1 skipped)
  • ruff check passes (ruff check src tests/unit/test_hardware_acceptance.py: All checks passed!)
  • mypy passes
  • Manual test performed

DCO sign-off

@drk-ram
drk-ram requested review from a team, carloshvp and zohebk8s as code owners October 25, 2026 06:01
@github-actions

github-actions Bot commented Oct 25, 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 25, 2026
carloshvp
carloshvp previously approved these changes Oct 25, 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 9e81cc380152ff2b2f01e35e5df706cb3fa58c0a in an isolated checkout.

The adapter refuses non-object metadata and empty supplied parent hashes, SDK float conversion is bounded to finite safe integers, and the hardware harness rejects ambiguous configuration/chain JSON before provider work. The focused adapter boundary control passes here and fails against the baseline adapter module. Valid adapter and harness software controls remain passing; this review does not claim hardware acceptance.

Independent validation in a fresh repository-hash-locked Python 3.12.10 environment: 780 tests passed, 16 skipped; pip check, configured Ruff, mypy, Bandit and diff whitespace checks passed. Commit sign-offs are present. Hosted CI and applicable independent maintainer/security gates remain separate prerequisites to merge.

Reviewed with OpenAI Codex.

@drk-ram drk-ram closed this Oct 29, 2026
@drk-ram
drk-ram force-pushed the drk-ram-fix-adapter-sdk-harness-286 branch from 9e81cc3 to 1889ce4 Compare October 29, 2026 15:20
… bound SDK float-to-int by safe int, and reject duplicate JSON keys in harness (agentrust-io#286)

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>

@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 2a0c45e478818b899285b2eab9f1faad05d46cba in an isolated checkout.

The adapter rejects non-object metadata and empty parent hashes, SDK integer normalization is limited to finite safe-integer values, and the hardware-harness JSON loader rejects duplicate members. This is software input/transport validation; I did not run a hardware acceptance session.

Fresh Python 3.12.10 validation: 836 passed, 16 skipped; Ruff, mypy and configured Bandit pass. The installed dependencies are consistent, and the PR commit carries a DCO sign-off. The required format check and whitespace check pass. Hosted CI and the required independent security 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

2 participants