Skip to content

fix(cli,transport): reject duplicate JSON keys, non-finite constants, and non-string coercion in CLI and HTTP transport (#272) - #275

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-cli-transport-json-272
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-cli-transport-json-272

Conversation

@drk-ram

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

Copy link
Copy Markdown

What

Reject duplicate JSON object keys and non-finite constants (NaN, Infinity) across ca2a_runtime.cli, ca2a_runtime.transport.server (/ca2a/task), and ca2a_runtime.transport.client, and enforce strict field types in cli._load_records and DelegationRecord.__post_init__.

Why

Closes #272.

Security impact

Prevents duplicate-key JSON smuggling on /ca2a/task, HTTP client responses, and CLI chain/DAG files, and prevents cli._load_records from splitting a string scope into single-character capabilities or coercing non-string fields via str(...).

Test plan

  • pytest passes (pytest tests/unit/test_lineage_cli.py tests/unit/test_live_call.py tests/unit/test_provenance.py -q: 58 passed)
  • ruff check passes (ruff check src/ca2a_runtime/provenance.py src/ca2a_runtime/cli.py src/ca2a_runtime/transport/server.py src/ca2a_runtime/transport/client.py tests/unit/test_lineage_cli.py: All checks passed!)
  • mypy passes (mypy src/ca2a_runtime/provenance.py src/ca2a_runtime/cli.py src/ca2a_runtime/transport/server.py src/ca2a_runtime/transport/client.py: Success)
  • Manual test performed

DCO sign-off

… and non-string coercion in CLI and HTTP transport (agentrust-io#272)

- Reject duplicate JSON object keys and NaN/Infinity constants in server.py (/ca2a/task), client.py (_get_json / _post_json), and cli.py (_load_chain, _load_records, _cmd_verify_lineage).
- Require strict string and list types in cli._load_records and validate decision in {"allow", "deny"} in DelegationRecord.__post_init__.

Closes agentrust-io#272

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 c36e4bb40037199f49dfc8b069f7eb96a5ca587e in an isolated checkout.

The CLI and unauthenticated HTTP JSON boundaries now reject duplicate members/non-finite constants, and required record/offer identifiers are checked as strings rather than coerced with str(). The authenticated task route retains its existing canonical decoder. No blocking source finding in the changed paths.

Fresh hash-locked Python 3.12.10 validation: 777 unit tests passed, 16 skipped; pip check, Ruff, mypy and Bandit passed. Sign-offs are present. git diff --check reports an extra blank line at test_lineage_cli.py EOF only. Required hosted checks and maintainer gates still need completion.

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(cli,transport): reject duplicate JSON keys, non-finite constants, and non-string coercion in CLI and HTTP transport

2 participants