Add dev-only in-process mTLS termination to the http4s server#2869
Merged
simonredfern merged 1 commit intoJul 15, 2026
Merged
Conversation
Successor of the RunMTLSWebApp.scala launcher removed with the Jetty teardown, as a props toggle on the normal server instead of a separate launcher: - Http4sMtls.scala: mtls.* props (honoured only when run.mode=development), SSLContext from JKS keystore/truststore, fs2 TLSContext + TLSParameters (client_auth need/want), and an HttpApp middleware that strips any client-supplied PSD2-CERT header and injects the handshake-verified client certificate as canonical PEM. - Http4sServer.scala: mtls.enabled branch on the Ember builder (withTLS + middleware); plain-HTTP path is unchanged when the prop is off. Warns when hostname is still http://. - sample.props.template: commented mtls.* block next to the other keystore props. - Http4sMtlsTest: unit tests for PEM encoding, header injection/stripping, SSLContext construction from the checked-in dev keystores. - Http4sMtlsHandshakeTest: end-to-end proof over a real TLS handshake that Ember populates ServerRequestKeys.SecureSession, the verified client cert surfaces as PSD2-CERT (spoofed header replaced), and certless handshakes are rejected under client_auth=need. - docs/MTLS_DEV_MODE.md: how-to (cert generation, props, smoke tests, consumer pinning, troubleshooting, production proxy guidance). Verified manually end-to-end: HTTPS on dev.port, certless handshake rejected, DirectLogin over mTLS, and /my/mtls/certificate/current returning the handshake certificate while ignoring a spoofed header.
|
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.



Successor of the RunMTLSWebApp.scala launcher removed with the Jetty teardown, as a props toggle on the normal server instead of a separate launcher:
Verified manually end-to-end: HTTPS on dev.port, certless handshake rejected, DirectLogin over mTLS, and /my/mtls/certificate/current returning the handshake certificate while ignoring a spoofed header.