Repository navigation
An API signed by a private authority is reached by trusting that authority for its client alone - #56
Merged
Merged
Conversation
…ority for its client alone A Kubernetes cluster's API, like most APIs inside an organisation, is signed by an authority no public trust store carries. OpenApiClientProperties gains trustedCertificates: PEM, PEM with \n for its line breaks, or Base64 of PEM or DER (a kubeconfig's certificate-authority-data). The tools built with those properties trust those certificates in place of the JVM's authorities; no other client does, and nothing stops verifying. The JDK clients stay shared: SharedHttpClients keys a redirect-refusing client by connect timeout and by the fingerprint of the certificates it trusts, so there is one per configuration. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6e7yb6kDzgxADRVhasCrL
LearnedApiSpec.toFactory takes the OpenApiClientProperties its tools are built with, so an API loaded from its kept spec trusts the same authority, and has the same timeouts, as one just learned. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6e7yb6kDzgxADRVhasCrL
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.
What
OpenApiClientPropertiesgainstrustedCertificates. The tools built with those properties trust the given certificates in place of the JVM's authorities. No other client is affected, and there is no option to stop verifying.The text is what an operator already has:
\nfor its line breaks, as a single-line setting carries it;certificate-authority-datais.Text that holds no certificate is refused with
IllegalArgumentException, never ignored.Why
A Kubernetes cluster's API is signed by the cluster's own authority, as most APIs inside an organisation are. Today the choices are to add that authority to the JVM's trust store, which trusts it for every call the application makes, or to stop verifying. A host that learns an API per installation (Embabel Me's realms) needs to say 'trust this authority for this API'.
How
TrustedCertificatesparses the text and builds anSSLContextover those certificates only.SharedHttpClients.redirectRefusingkeys its shared client by connect timeout and the fingerprint of the trusted certificates, so the thread bound from OpenApiLearner builds an HttpClient per learned tool and never closes it #51/HttpProbeTool's HttpClient is never closed #52 holds: one client per configuration, whatever form the certificates were written in.CredentialSafeRedirects.overJdkClienthas an overload taking them;OpenApiLearner.buildRestClientpasses them through.OpenApiClientPropertieskeeps its existing constructors for Java callers (@JvmOverloads).Tests
TrustedCertificatesTest(6, new) starts an HTTPS server holding a certificate made at test time by the JDK'skeytool, so nothing is checked in:SSLHandshakeException;SharedHttpClientsTest(6) andCredentialSafeRedirectsTest(7) still pass.Not in this PR
🤖 Generated with Claude Code