fix: read the TLS policy per request instead of snapshotting it - #3
Merged
Merged
Conversation
HttpParams captured HttpTlsPolicy in its constructor, so a client built before a setting changed kept the old policy for its whole life. A long-lived client - an ATTACHed catalog, say - therefore never saw a CA bundle set afterwards, which is exactly the order the consumer's docs tell users to follow. The policy is now read when each request's client is created, and the two snapshot fields are gone rather than left as a trap.
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.
HttpParamscapturedHttpTlsPolicyin its constructor, so a client built before a setting changed kept the old policy for its whole life.That breaks exactly the ordering the consumer's docs prescribe:
ATTACH-then-configure is the natural order, and it silently did nothing.
Fix
The policy is read when each request's client is created. The two snapshot fields are removed rather than left in place — nothing ever set them explicitly (they were only ever seeded from the policy and read once), so leaving them would just preserve the trap.
Cost is a mutex-guarded read of two fields per request, against a TLS handshake.
Verified end to end
That last pair is the regression this fixes; the middle two guard against over-correcting.
Consumer side: DataZooDE/erpl-web#142 adds
test/sql/tls_enforcement.testcovering all of it, opt-in viaERPL_TEST_TLS_ENFORCEMENTso the default run does not depend on badssl.com being reachable.Fixes DataZooDE/erpl-web#138.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.