davsclaus opened a new pull request, #30556: URL: https://github.com/apache/camel/pull/30556
## Description [CAMEL-27342](https://issues.apache.org/jira/browse/CAMEL-27342): companies often have no direct internet access, so the CVE audit must reach OSV.dev through their HTTP proxy, including a proxy that needs a login. **Stacked on #30555 (CAMEL-27343: the shared camel-catalog-cve module).** Retarget to `main` once that one is merged; until then this PR shows both commits and CI runs no full build. `camel dependency audit` and the CVE Audit screen of the TUI take the proxy from, in order: 1. the active proxy of the Maven settings: `~/.m2/settings.xml` or `--maven-settings`, with its username, its password (decrypted with `settings-security.xml`) and its `nonProxyHosts`. Companies already configure it for Maven. 2. `HTTPS_PROXY` / `HTTP_PROXY` and `NO_PROXY`, as CI runners set them (`http://user:secret@proxy:3128`). 3. the proxy settings of the JVM (`-Dhttps.proxyHost`), as before. The TUI keeps its own Proxy Host / Proxy Port settings first, then uses the same fallback, also for the documentation it downloads. No password field is added to the TUI settings, so no password ends up in plain text in the CLI user config; a proxy with a login is set in the Maven settings or in `HTTPS_PROXY`. ### The JDK gotcha The JDK does not send Basic credentials when it tunnels HTTPS through a proxy (`jdk.http.auth.tunneling.disabledSchemes=Basic` in `net.properties`), and it reads the property once, when the first HTTP client is used. I checked this in the JDK 25 sources and with a standalone program: with the default value the client gets the 407 back without ever sending the login, even with an `Authenticator`. `OsvClient` clears the property when the proxy has a username, unless the user set it. The CLI resolves Maven artifacts with the Apache HttpClient transport, so the JDK client has not been used before. When the proxy still answers 407, the error says what to set. ### Changes - `camel-catalog-cve`: `HttpProxy` (host, port, login, non-proxy hosts; parses `HTTPS_PROXY` URLs and `NO_PROXY` / `nonProxyHosts` lists; `toString` never shows the password). `OsvClient` takes an `HttpProxy`, logs in to it, and names the proxy in its error. `clearCache` is static, since the caches are. - `camel-tooling-maven`: `MavenDownloaderImpl.proxyFor(url)` asks the resolver session for the proxy of a URL, with its decrypted username and password (`MavenProxy`). - `camel-jbang-core`: `OsvProxy` picks the proxy. `camel dependency audit` now also passes `--maven-settings` and `--maven-settings-security` to the downloader it resolves the dependencies with. - TUI: `TuiSettings.httpProxy()` replaces `proxySelector()`; the CVE Audit screen looks the proxy up for each scan, so a change in the settings applies without a restart. - Docs: the proxy order in the `camel dependency audit` section of the projects page, and the Proxy Host row of the TUI settings page. ## Tests - `OsvClientProxyTest`: a fake proxy asks for a login, and checks the `CONNECT api.osv.dev:443` request comes back with `Proxy-Authorization: Basic ...`. The test fails when the JVM runs with `-Djdk.http.auth.tunneling.disabledSchemes=Basic` (checked), so it covers the gotcha. No request leaves the machine. - `HttpProxyTest`: URL and environment parsing, non-proxy hosts, no password in `toString`. - `MavenDownloaderProxyTest`: the proxy of a `settings.xml`, its login and `nonProxyHosts`. - `OsvProxyTest`: the Maven settings come before `HTTPS_PROXY`. - Locally, `mvn -o verify` of camel-tooling-maven, camel-catalog-cve, camel-jbang-run, camel-jbang-core and camel-jbang-plugin-tui: all green. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 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]
