davsclaus opened a new pull request, #30216: URL: https://github.com/apache/camel/pull/30216
_Claude Code on behalf of davsclaus_ [CAMEL-27068](https://issues.apache.org/jira/browse/CAMEL-27068) **Stacked on #30204 (CAMEL-27049: camel-main secret options matched by their whole key).** Review only the last commit. Retarget to `main` once #30204 is merged. ### Problem The security policy (`camel.security.insecureDevPolicy`, which fails the startup with `camel.main.profile=prod`) did not report four camel-main options flagged `security=insecure:dev` in the camel-main metadata: - `camel.management.mcpEnabled` - `camel.management.openapiUiEnabled` - `camel.server.jwtAllowMissingIssuerAndAudience` - `camel.management.jwtAllowMissingIssuerAndAudience` `UpdateSensitizeHelper` read the security category of component, data format and language options only. The camel-main options that were reported came from the hand-kept `EXTRA_SECURITY_OPTIONS` (matched by option name) and the hand-written `SECURITY_KEYS` map in `SecurityUtils` (`camel.chaos.rules`, `camel.chaos.scenario`). Found by Croway in the review of #30204. ### Change - `UpdateSensitizeHelper` collects the camel-main options with a `security` category from `camel-main-configuration-metadata.json` and generates them into `SECURITY_KEYS` of `SecurityUtils` (between `SECURITY-KEYS` markers), matched by their whole key in lower case without dashes. A boolean option is insecure when `true`; another option (such as `camel.chaos.rules`) with any value that is not empty, as before. - `SecurityUtils.getSecurityOption` returns the generated `SecurityOption` for a whole key, so options of components with the same name (such as `camel.component.foo.mcpEnabled`) are not matched. - The camel-main entries of `EXTRA_SECURITY_OPTIONS` stay, as the Camel MCP server's security scan reads option names from `SecurityUtils.getSecurityOptions()`. - Upgrade guide 4.24: the four options are now reported; how to keep one enabled in production (`camel.security.insecureDevPolicy=allow` or `camel.security.allowedProperties`). ### Tests - `SecurityUtilsTest.testCamelMainOptionsMatchByWholeKey` (camel-util): the four options, and the `devConsoleEnabled` ones, are `insecure:dev` and insecure when `true`, also in dash case; a component option with the same name is not matched; `camel.chaos.rules` is still insecure with any value that is not empty. - `MainSecurityPolicyTest` (camel-main): with `camel.main.profile=prod`, each of the four options set to `true` fails the startup, and set to `false` it starts. camel-util (347 tests), camel-main (345 tests) and camel-package-maven-plugin (150 tests) pass locally. As a stacked PR, this one gets no "Build and test" run until it targets `main`. 🤖 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]
