CAMEL-24571: camel-spiffe - add SpiffeSSLContextParameters for Workload-API-backed mTLS - #26098
Conversation
…ad-API-backed mTLS SpiffeSSLContextParameters is an SSLContextParameters whose SSLContext is backed by the SPIFFE Workload API (via io.spiffe:java-spiffe-provider) with automatic X.509-SVID rotation, so any Camel component accepting sslContextParameters gets zero-trust mTLS. The built context is wrapped with the same decorator as the parent, so inherited clientAuthentication, cipherSuites and secureSocketProtocols still apply. Peer authentication is fail-closed: an acceptedSpiffeIds allow-list or acceptAnySpiffeId (mutually exclusive). The X509Source is created lazily (bounded by initTimeout), closed on CamelContext shutdown, and the cached context is invalidated then so a restarted context rebuilds a fresh source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DBEWFBQvRgMrg6ukvv5iV Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 10 tested, 26 compile-only — current: 9 all testedMaveniverse Scalpel detected 36 affected modules (current approach: 9).
|
gnodet
left a comment
There was a problem hiding this comment.
Solid implementation. The double-checked locking on sslContext is correct (volatile field + synchronized block), fail-closed validation rejects missing trust configuration, and the X509Source lifecycle is properly tied to CamelContext shutdown.
Static analysis (ast-grep) flagged the synchronized block in X509SourceService.stop() and the broad catch (Exception) blocks -- both are non-issues: sslContext is already declared volatile, and the catch blocks preserve the cause chain via RuntimeCamelException(e), which is standard Camel idiom.
No findings.
This review was generated by an AI agent, Hermes on behalf of @gnodet.
Second increment of the
camel-spiffecomponent (CAMEL-23305, shipped in 4.23.0). AddsSpiffeSSLContextParameters, anSSLContextParameterswhoseSSLContextis backed by the SPIFFEWorkload API (via
io.spiffe:java-spiffe-provider) with automatic X.509-SVID rotation, so any Camelcomponent that accepts an
sslContextParametersreference (camel-http, camel-netty-http, camel-jetty,camel-vertx-http, ...) can obtain zero-trust mutual TLS.
Highlights
SSLContextParametersconfiguration. The SPIFFESSLContextis wrapped withthe same decorator the parent uses, so
serverParameters.clientAuthentication,cipherSuitesandsecureSocketProtocolsstill apply — a server correctly requests and validates the peer SVID ratherthan silently accepting unauthenticated peers.
acceptedSpiffeIdsallow-list oracceptAnySpiffeId(the two are mutually exclusive); configuring neither is rejected.
X509Sourceis created lazily (bounded byinitTimeout, default 30s), closedon
CamelContextshutdown, and the cached context is invalidated at the same time so a restartedcontext rebuilds a fresh source.
secureSocketProtocol(default
TLSv1.3).Testing
blank-only allow-list rejection, and fast-fail on an unreachable Workload API.
manual/integration verification rather than a CI test.
Docs
Adds a "Mutual TLS with SPIFFE (SSLContextParameters)" section to the component page with a wiring example.
🤖 Generated with Claude Code
https://claude.ai/code/session_017EbUBfDPznQECWRbY5cr2n