davsclaus opened a new pull request, #31026:
URL: https://github.com/apache/camel/pull/31026

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27668
   
   ## What was wrong
   
   - The client that Camel creates (`SolrEndpoint.createSolrClient`) builds its 
base URL from `enableSSL` (`http` when it is false, which is the default). 
`certificatePath` and `sslContextParameters` only set the SSL context of the 
`HttpJdkSolrClient`. Without `enableSSL=true` they were ignored and gave no 
notice, and the requests (with the basic authentication credentials) were sent 
in clear text.
   - `certificatePath` is resolved with `ResourceHelper`, and the option 
description listed `http:` as a supported prefix. That let the CA certificate 
the client trusts be loaded over plain HTTP.
   
   ## What changed
   
   - When Camel creates the client and `certificatePath` is set, or 
`sslContextParameters` is set on the endpoint or the component, while 
`enableSSL` is not enabled, the endpoint now fails at startup. The 
`IllegalArgumentException` says to set `enableSSL=true`.
     - The global SSL context parameters (`useGlobalSslContextParameters=true`) 
only log a WARN in that case, because they are shared with other components.
     - I chose this over turning SSL on implicitly. `enableSSL` is a primitive 
boolean, so an explicit `enableSSL=false` looks the same as the default. 
Quietly switching the URL scheme would also be more surprising than a clear 
startup error.
     - The SSL context is only built when the client connects with HTTPS.
   - `certificatePath` refuses an `http:` URL (case-insensitive) with a clear 
message. `classpath:`, `file:`, `https:` and the other resource prefixes are 
still allowed.
   - Option descriptions of `enableSSL`, `certificatePath` and 
`sslContextParameters` (endpoint and component) are updated. The generated 
component JSON, the catalog copy, the endpoint DSL and the component DSL are 
regenerated.
   - The component doc has a new "Connecting with HTTPS" section (the catalog 
copy is updated too).
   - New upgrade-guide entry "camel-solr - certificatePath and 
sslContextParameters need enableSSL".
   
   ## Tests
   
   - New `SolrSslConfigurationTest` (6 tests, no Solr server needed):
     - `certificatePath` without `enableSSL` fails
     - component `sslContextParameters` without `enableSSL` fails
     - a route with `certificatePath` without `enableSSL` fails at CamelContext 
startup
     - global SSL context parameters without `enableSSL` still build a plain 
`http` client
     - `certificatePath` (`file:`) with `enableSSL=true` builds an `https` 
client
     - `http:` and `HTTP:` certificate URLs are refused
   - 4 of the 6 fail without the fix in `src/main`. The other 2 are positive 
cases.
   - `SolrSslContextParametersTest` now uses `enableSSL=true`. Its tests set a 
component-level `sslContextParameters`, which is exactly the setup that now 
fails without `enableSSL`.
   - `InitSolrEndpointTest`, `SolrProducerBodyTest` and the container-based 
`SolrInsertAndDeleteTest` / `SolrPingAndSearchTest` pass.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to