Skip to content

feat: enforce SDK security and exercise secure SUT scenarios - #308

Merged
MisterVVP merged 20 commits into
mainfrom
feat/305-sdk-security-scenarios
Oct 20, 2026
Merged

MisterVVP merged 20 commits into
mainfrom
feat/305-sdk-security-scenarios

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Addresses #305; builds on merged #307 and includes the signing refactor from #310.

Adds SDK security enforcement and live security scenarios across HTTP+JSON, JSON-RPC and gRPC, using both in-memory and PostgreSQL task stores.

  • Authentication and permissions: preserve authenticated principals through callbacks, filter task lists by caller access, authorize returned tasks/push configurations, and recheck permissions before and after blocking stream reads. Hidden and missing tasks share errors; missing security context fails closed; denials reach audit hooks. Taskless messages remain supported.
  • Task authorization: persist explanatory auth_required states and pending messages, apply revision-checked transitions, and coordinate live subscriptions with authorization changes. Cancellation through this service requires an authorization-managed task.
  • TLS: use native gRPC credentials and HTTP certificate/hostname verification, restore default CA settings on pooled handles, and expose detailed transfer errors. Live HTTP fixtures exercise nginx TLS termination.
  • Signed Agent Cards: optional Ed25519/JWS with RFC 8785 canonicalization; verify original JSON before parsing into SDK types, preserve unknown signed fields, and revalidate cached cards against key rotation, revocation and expiry policies. Reject malformed signatures before key resolution and cap cards at 16 signatures.

Secured GetTask and unary SendMessage authorize the full response before applying history limits and invoking audit hooks. Owned task responses that have not been stored remain supported without extra store lookups.

Dependencies and scope

Signing is disabled by default. Enabling A2A_ENABLE_SIGNING and linking a2a::signing adds OpenSSL 3.0+ for Ed25519 and simdjson 3.0+ for strict JSON parsing. No nlohmann/json dependency is introduced.

Simdjson replaces the signing path's custom syntax scanner and protobuf Value parsing. A private serializer still implements JCS key ordering, escaping and number formatting: simdjson itself does not provide RFC 8785 canonicalization. The old public canonicalization API and standalone implementation/tests are removed; independent vectors remain in the signing suite. Broader SDK JSON parsing changes are deferred.

A scoped vcpkg registry selects OpenSSL 3.6.5 and pins simdjson to tested version 3.12.3, with current CMake helpers; the existing gRPC/protobuf/curl baseline remains unchanged. nginx and the OpenSSL CLI are live-test tools.

Implementation details and vector provenance: security scenarios guide.

Validation

  • Current head 1221085: CI passed, including Windows/MSVC, macOS, Linux build/lint/tests, sanitizers, interoperability and performance checks. TCK, CodeQL, docs and tutorials also passed.
  • Local signing-enabled verification: formatting, full clang-tidy and verify_changes.sh passed; 796 checks, zero failures, with two intentional in-process HTTP TLS skips. Live security/TLS scenarios passed for both stores.
  • Signing compatibility: simdjson 3.0.1, Ubuntu 3.6.4 and 3.12.3; 57 independent canonicalization vectors, Python/Go signing fixtures and 1,999 generated cases checked against an ECMAScript oracle. Installed signing-enabled and signing-disabled consumers passed.
  • Original, unmodified upstream TCK: 249 passed / 16 conditional skips per store; 80.9% mandatory, 80.0% overall, within the approved interim target. Security groups without executable upstream assertions remain NOT TESTED; SDK tests do not inflate compliance.
  • Scoped Trivy scans reported no known vulnerabilities in the tested OpenSSL/simdjson dependency pairs. Local fixture benchmarks showed roughly 9× faster card canonicalization and 36% faster signature verification; these are not transport-throughput measurements.

Limits

Applications supply identity validation, permissions, credentials and trusted-key policy. Signing supports Ed25519 without critical JWS extensions; empty/default-field interoperability awaits a2aproject/A2A#2122. Exact visible task counts still scan matching tasks; pagination/ordering follow-up is #309. An intermittent HTTP streaming teardown failure also reproduced in a pre-signing-refactor binary; details are recorded in #310.

Authorship: substantive code, tests, documentation and configuration were generated by an AI agent (AI agent).

@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR

@MisterVVP MisterVVP linked an issue Oct 14, 2026 that may be closed by this pull request
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T19:32:06.586219Z 1221085 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37f4146d98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/http/http_client_curl.cpp Resolved
Comment thread src/server/dispatcher.cpp Resolved
Comment thread src/client/discovery.cpp Resolved
Comment thread src/server/dispatcher.cpp Resolved
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8666d79735

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/http/http_client_curl.cpp Resolved
Comment thread src/server/security_policy.cpp Resolved
Preserve curl transfer diagnostics by relying on callers to reset handles before installing their error buffers. Reject task-bearing stream events without IDs while allowing taskless messages, with regression coverage for unary/streaming errors and ordinary/timed stream reads.

Consolidate security documentation and signed-card payload fixtures. Keep the security executor private to the SUT and inherit ordinary operations instead of forwarding them. Reduce the PR from 62 to 55 files and remove 248 net lines without dropping security coverage.

Validation: CI formatting, clang-tidy, verify_changes.sh (744 checks, zero failures, two intentional skips), multi-config regressions (32 passed), performance smoke (54 rows, zero errors), dependency scan, and upstream TCK on both stores (249 passed, 16 conditional skips; 80.9% mandatory compliance per the approved interim target).
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90523002de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/security_policy.cpp Resolved
Comment thread src/server/security_policy.cpp Resolved
Check actual GetTask and CancelTask response ownership before release. Share authorized task lookup across requests, associated messages, streams and list loading; normalize missing-task errors while preserving other store failures.

Add regressions for foreign executor responses and serialized error messages on all three bindings. Simplify the private SUT executor, reuse listed metadata during credential polling, and consolidate vector provenance into the shorter security guide. The PR now changes 54 files instead of 55 (62 originally), with all features retained.

Validation: CI formatting, clang-tidy and verify_changes.sh passed (749 CTest checks, zero failures, two intentional skips). Multi-config: 40 passed. Performance: 54 rows, zero errors. Refreshed dependency scan: zero vulnerabilities. Original upstream TCK: 249 passed and 16 skipped per store, 80.9% mandatory compliance under the approved interim target. Regressions fail against the previous implementation and pass with the fixes.
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb0a92c62b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/security_policy.cpp Resolved
Comment thread tests/sut/sut_runtime.cpp Resolved
Comment thread src/server/dispatcher.cpp Resolved
Authorize every returned push-notification configuration using the authoritative task store, including all list entries and missing-ID rejection. Make response authorization exhaustive across payload variants.

Retain the authenticated principal across before/after interceptors, executor callbacks, response checks and stream setup. Preserve application-managed identity behavior when no SDK security policy is configured.

Advertise a separate public gRPC target in the TLS fixture and exercise it through Agent Card discovery with certificate verification enabled. Leave JSON parsing and dependencies unchanged.

Validation: CI formatting, clang-tidy and verify_changes.sh passed with 761 CTest checks, zero failures and two intentional skips. Multi-config: 52 passed. Performance: 54 rows, zero errors. Dependency scan: zero vulnerabilities. Original TCK on both stores: 249 passed, 16 conditional skips and 80.9% mandatory compliance under the approved interim target.
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@MisterVVP

Copy link
Copy Markdown
Owner Author

TODO: consider simdjson again

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11ecf604f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/security_policy.cpp Resolved
Comment thread src/server/security_policy.cpp Resolved
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71d5ae53f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/security_policy.cpp Resolved
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 70670155d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@MisterVVP
MisterVVP marked this pull request as ready for review October 16, 2026 20:31
@MisterVVP

Copy link
Copy Markdown
Owner Author

Double check reinterpret_cast usage

Build signing inputs as unsigned bytes and use a fixed-size Ed25519 signature array. Document the remaining permitted character-alias views and validate OpenSSL integer size limits. Cover malformed and noncanonical signature encodings.
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55fa1fc372

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/security_policy.cpp Resolved
Comment thread tests/scripts/run_security_scenarios.py Resolved
Preserve history-based GetTask and SendMessage authorization before response and audit projections. Reject authorization-service cancellation of ordinary tasks and reserve disjoint SUT/proxy ports. Simplify visible task selection and signing validation, borrow canonicalization members, and remove redundant TLS/discovery test combinations while keeping every cross-binding pair.
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: fe5674a2a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Stacked on #308; targets `feat/305-sdk-security-scenarios`.

Agent Card signing now parses JSON with simdjson instead of the custom
syntax scanner and protobuf `Value` parser. Other SDK JSON parsing paths
stay unchanged.

- Keep simdjson 3.0+ optional with `A2A_ENABLE_SIGNING`; add it to the
vcpkg signing feature, Linux security installer and exported package
dependencies. Windows CI now builds signing too.
- Remove `json_canonicalization.cpp`, both old headers, the standalone
test file/target and the unused strict syntax scanner. Canonicalization
is private to signing; independent RFC 8785 and Python/Go
interoperability coverage lives in the signing suite.
- Preserve unknown signed fields, decoded duplicate-key rejection,
Unicode validation, signature exclusion, size/depth limits and rotation
behavior. Use On-Demand `get_double()` so integer tokens beyond 64 bits
retain JCS binary64 behavior. Borrow decoded JWS strings and use sorted
lookup for header overlaps.

**Canonicalization detail:** simdjson is a parser, not an RFC 8785
implementation. A private serializer still supplies UTF-16 key ordering,
JCS string escaping and ECMAScript number formatting; simdjson
minification alone would produce incorrect signatures.

CI compatibility fix: Ubuntu's simdjson 3.6.4 requires an explicit
argument on raw `field::unescaped_key()`, while 3.0.1 and 3.12.3
accepted the previous call. Decode keys through the stable
`simdjson_result<field>` API before unwrapping the value. This preserves
strict Unicode handling without version checks or another abstraction;
malformed surrogate-key regressions cover that behavior. Windows also
selected OpenSSL 1.1.1i and simdjson 0.8.2 from the historical baseline.
A scoped, pinned registry now selects OpenSSL 3.6.5 and current CMake
helpers; simdjson is pinned to the tested 3.12.3 version. The
gRPC/protobuf/curl baseline is unchanged. Default and signing-enabled
dependency plans were validated on Linux; MSVC compilation is checked by
CI.

Validation on Linux:

The replacement [Ubuntu 24.04 TCK CI
run](https://github.com/MisterVVP/a2a-cpp/actions/runs/39219089247)
passed, including security validation and mandatory suites for both
stores.

- Exact CI clang-format, full clang-tidy and
`./scripts/verify_changes.sh`: passed; 796 checks, zero failures, two
intentional in-process HTTP TLS skips. Live TLS/security scenarios
passed for both stores.
- Simdjson 3.0.1 and optimized 3.12.3 builds: all 29 focused tests
passed. The exact Ubuntu 24.04 simdjson 3.6.4 package also passed the CI
build/security step (105 checks). The retained corpus has 57 independent
vectors; another 1,999 generated cases matched an ECMAScript oracle byte
for byte.
- Fresh installed-package consumer signed and verified through
`a2a::signing`; obsolete headers were absent. Signing-disabled TCK
builds passed with simdjson discovery explicitly disabled.
- Original upstream TCK, both stores: 249 passed / 16 skipped each;
mandatory 80.9%, overall 80.0%, within the approved interim target.
Upstream security groups remain NOT TESTED.
- Trivy recognized both the Ubuntu/local dependency pair (simdjson
3.6.4, OpenSSL 3.5.7) and the pinned vcpkg pair (simdjson 3.12.3,
OpenSSL 3.6.5): no known vulnerabilities reported. Clang 19 lint uses
simdjson 3.12.3; Ubuntu 3.6.4 was validated with GCC because its
upstream formatter header fails Clang 19 independently of SDK code.
Windows/MSVC execution awaits CI.

A later full-suite run exposed an existing HTTP streaming teardown race:
`SharedHttpClientTest.OneClientKeepsSixtyFourStreamsOnBoundedSharedThreads`
passed its assertions, then aborted with `Resource deadlock avoided`.
The same failure reproduced on trial 8 in the preserved pre-change
executable dated October 15. HTTP streaming implementation/tests are
unchanged in this PR; the failure is recorded separately from signing
validation.

Local optimized microbenchmarks against preserved #308 binaries, one
pinned CPU, alternating before/after runs (microseconds/call):

| Case | #308 | This branch |
| --- | ---: | ---: |
| Canonicalize 686-byte signed card | 46.640 | 5.212 |
| Canonicalize 256 short Unicode keys | 392.220 | 68.187 |
| Canonicalize 256 long Unicode keys | 763.237 | 289.347 |
| Verify shared Python/Go signed card | 226.337 | 144.649 |

These are fixture-level measurements, not transport-throughput claims.
General JSON parsing migration remains deferred until after #308 merges.

Authorship: implementation, tests, configuration and documentation
generated by an AI agent (Codex).
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 122108578e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@MisterVVP
MisterVVP merged commit 6a2a0fa into main Oct 20, 2026
22 checks passed
@MisterVVP
MisterVVP deleted the feat/305-sdk-security-scenarios branch October 20, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Make the TCK SUT exercise SDK security behavior

1 participant