Repository navigation
Support SPP 9.0 TLS 1.3: consistent --http1.1 and opt-in TLS version pinning - #112
Merged
petrsnd merged 3 commits intoSep 8, 2026
Merged
Conversation
…pinning Adds shared curl helpers in src/utils/common.sh and applies them across all certificate-auth and A2A curl invocations: - set_http11_flag / curl_version_ge: robust major.minor curl version parse so --http1.1 is forced on all curl >= 7.33 (including 8.x). Fixes the version parse that silently dropped --http1.1 on curl 8.x (breaks cert auth under HTTP/2 with 60094) in connect-safeguard.sh and listen-for-a2a-event.sh, and removes the dead+buggy copies in handle-a2a-*-event.sh. - Adds --http1.1 to the A2A SignalR negotiate calls that were missing it (a2a.sh get_a2a_connection_token, listen-for-a2a-event.sh). - set_tls_version_flags / set_openssl_tls_args: opt-in TLS version pinning via SAFEGUARD_TLS_MIN / SAFEGUARD_TLS_MAX (curl --tlsvX.Y / --tls-max, and openssl -min_protocol/-max_protocol on the s_client fallback). Default behavior is unchanged (negotiated). Token/bearer requests keep the negotiated HTTP version; only TLS enforcement is applied globally. Documents the behavior in src/README.md and bumps version to 8.4.0.
Two latent bugs routed A2A cert-authenticated calls into the openssl s_client fallback, which cannot perform client-certificate auth over TLS 1.3 (it has no post-handshake certificate exchange). They were harmless on TLS 1.2 but surfaced once TLS 1.3 negotiation is enabled: - invoke_a2a_method treated an empty HTTP 204 body from a write as a failure and fell through to the openssl fallback, returning a spurious 60094. Treat a curl request with no error Code (including an empty 204) as success. - get-a2a-retrievable-account.sh passed an empty usesclient argument, which skipped curl and forced the openssl fallback. Pass "false" so these core GETs use curl, which does support cert auth over TLS 1.3. Add live TLS coverage: - New suite-tls-version.sh exercises SAFEGUARD_TLS_MIN/MAX pinning: TLS 1.2 floor/ceiling negotiate, a TLS 1.3 floor connects on a 1.3-capable appliance and fails closed on a 1.2-only one, and an invalid version value is rejected before connecting. - sg_appliance_supports_tls13 framework probe gates 1.3-specific assertions by appliance capability. - suite-a2a.sh now asserts A2A password retrieval works with a TLS 1.3 floor (cert auth over TLS 1.3), skipped when the appliance lacks 1.3. Document that the openssl s_client (-O) fallback does not support cert auth over TLS 1.3.
petrsnd
marked this pull request as ready for review
September 8, 2026 02:02
petrsnd
approved these changes
Sep 8, 2026
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.
Closes #109.
SPP 9.0 enables TLS 1.3. safeguard-bash authenticates against 9.0 today, but HTTP-version pinning was applied inconsistently and there was no way to require a specific TLS version. This PR centralizes the curl plumbing and adds opt-in TLS enforcement.
Changes
1. Shared curl helpers (
src/utils/common.sh)_parse_curl_version/curl_version_ge— robustmajor.minorparse ofcurl --version. The old single-field parse read the minor digit (e.g.5from curl 8.5.0) and compared it against 33, silently dropping--http1.1on curl >= 8.x. Same regression class fixed narrowly in A2A cert retrieval fails on curl 8.x: version parse drops --http1.1 (HTTP/2) #107, now fixed everywhere via one helper.set_http11_flag— sets--http1.1when curl >= 7.33.set_tls_version_flags— mapsSAFEGUARD_TLS_MIN/SAFEGUARD_TLS_MAXto--tlsvX.Y(floor) and--tls-max X.Y(ceiling), with input validation and a warning when--tls-maxis unsupported (curl < 7.54).set_openssl_tls_args— best-effort-min_protocol/-max_protocol(or exact-tlsX_Yon older openssl) for the-Oopenssl s_clientfallback paths.2. Apply
--http1.1consistently on cert-auth / A2A pathsClient-certificate auth requires HTTP/1.1 (HTTP/2 forbids the post-handshake certificate exchange). Applied to:
connect-safeguard.shcertificate RSTS grant (fixed the buggy parse).utils/a2a.shinvoke_a2a_methodandget_a2a_connection_token(the SignalR negotiate call was previously missing it).listen-for-a2a-event.sh— all cert curls, includingget_connection_tokenandnegotiate_connectionwhich never had it.handle-a2a-{password,privatekey,apikeysecret}-event.sh.Bearer/token requests keep the negotiated HTTP version.
3. Opt-in TLS version enforcement
SAFEGUARD_TLS_MIN/SAFEGUARD_TLS_MAX(values1.0–1.3), threaded into everycurl -Kblock ands_clientfallback. Mirrors the min/max model proposed for the Python SDK (PySafeguard #41/#43). Default behavior is unchanged (negotiated, including TLS 1.3).4. Docs + version
README.md: new "TLS Version and HTTP/1.1 (SPP 9.0 / TLS 1.3)" section after "TLS Verification", including a curl gotchas for TLS 1.3 list (--tlsv1.3is a minimum not exact; TLS backend must support 1.3; minimum curl versions for the flags; fail-fast validation;-Os_client mapping).src/README.md: short summary linking to the root section (kept minimal to avoid drift).pipeline-templates/global-variables.yml: version → 8.4.0.Validation so far
bash -nclean on all 9 edited scripts.--http1.1set; min/max flag mapping; invalid input exits non-zero).curlaccepts the generated-Kconfig (--http1.1/--tlsv1.2/--tls-max 1.3).Testing before merge (needs live appliances)
invoke-safeguard-method.sh) + cert/A2A retrieval.SAFEGUARD_TLS_MIN=1.3succeeds at 1.3; a sub-1.3 pin (SAFEGUARD_TLS_MAX=1.2) against 9.0 behaves as expected.Opened as draft pending the live 8.x / 9.0 test pass.