Support TLS 1.3 mTLS for async cert/A2A auth (#41, #43) - #48
Draft
DanPeterson wants to merge 2 commits into
Draft
Conversation
Enable post-handshake authentication (RFC 8446 4.6.2) on the aiohttp SSLContext so async certificate and A2A credential retrieval succeed over TLS 1.3 on SPP 9.0 (previously failed with error 60094). The sync requests/urllib3 path already enabled this by default. Add opt-in min_tls_version / max_tls_version (ssl.TLSVersion | None, default None) to SafeguardClient, AsyncSafeguardClient, A2AContext, AsyncA2AContext, and the A2A quick_* classmethods. Async applies them in _create_ssl_context; sync mounts a _TlsVersionAdapter using urllib3's native ssl_minimum_version / ssl_maximum_version only when a pin is set, so the default transport path is unchanged. HTTP/1.1 is preserved. Add unit tests (tests/test_tls.py) and TLS 1.3 cert-auth / A2A integration tests. Update AGENTS.md, README, and the a2a-workflow and api-patterns skills. Bump version to 8.2.0.
Promote the TLS 1.3 guidance to a discoverable top-level README section covering what changed (post-handshake auth), version pinning, and Python-specific gotchas (HTTP/2 incompatibility, OpenSSL 1.1.1+ requirement, ssl.TLSVersion usage, verify=False context behavior).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #41 and #43 in one change.
SPP 9.0 enables TLS 1.3. On TLS 1.3, certificate/A2A auth requires the client to answer a post-handshake
CertificateRequest(RFC 8446 §4.6.2), which Python'sssl.SSLContextonly does whenpost_handshake_auth = True. The async (aiohttp) path never set it, so async cert/A2A auth failed on 9.0 with60094 Authorization is denied. The sync (requests/urllib3) path already enables it by default and was unaffected.Changes
AsyncSafeguardClient._create_ssl_contextnow setspost_handshake_auth = True. This is the one change required for async cert/A2A auth to work on 9.0.min_tls_version/max_tls_version(ssl.TLSVersion | None, defaultNone= negotiate) onSafeguardClient,AsyncSafeguardClient,A2AContext,AsyncA2AContext, and the A2Aquick_*classmethods._create_ssl_context._TlsVersionAdapterusing urllib3's nativessl_minimum_version/ssl_maximum_version, only when a pin is set — the default transport path is unchanged.CertificateRequest).8.2.0(backward-compatible minor).Usage:
Tests
tests/test_tls.py(post-handshake auth enabled; pins applied; sync adapter mounted only when pinned; defaults unchanged; A2A forwarding).test_certificate_auth.pyand TLS-1.3 A2A retrieval intest_a2a.py.ruff,ruff format --check src/,mypy --strictclean.Docs
AGENTS.md (TLS 1.3 section), README, and the
a2a-workflow+api-patternsskills.I have not yet validated against live appliances. Please confirm on real hardware:
min_tls_version=TLSv1_3succeeds on 9.0;max_tls_version=TLSv1_2still works on both.The sync side is a review-confident change (uses urllib3's documented version knobs), but the whole point is TLS behavior against real appliances, so live sign-off is required.