Claus Ibsen created CAMEL-27049:
-----------------------------------
Summary: camel-main - mask the server and vault options flagged
secret
Key: CAMEL-27049
URL: https://issues.apache.org/jira/browse/CAMEL-27049
Project: Camel
Issue Type: Bug
Components: camel-catalog, camel-util, camel-main,
camel-package-maven-plugin
Reporter: Claus Ibsen
Assignee: Claus Ibsen
Fix For: 4.24.0, 4.22.3, 4.18.6
h3. Behaviour today
The list of sensitive keys in {{org.apache.camel.util.SensitiveUtils}}
({{SENSITIVE_KEYS}} and {{SENSITIVE_PATTERN}}) is generated by
{{UpdateSensitizeHelper}} in camel-package-maven-plugin. It collects the
options flagged secret from the component, data format and language catalogs,
plus a few hand-added keys. It does not read the camel-main configuration
metadata ({{camel-main-configuration-metadata.json}}) or the beans catalog.
As a result, these camel-main options are flagged secret in the metadata but
are not in the sensitive-key list:
* {{camel.server.jwtKeystorePassword}}
* {{camel.management.jwtKeystorePassword}}
* {{camel.vault.azure.eventhubConnectionString}}
* {{camel.vault.azure.tenantId}}
* {{camel.vault.gcp.serviceAccountKey}}
* {{camel.vault.ibm.eventStreamUsername}}
* {{camel.vault.ibm.eventStreamPassword}}
Everything that relies on {{SensitiveUtils.containsSensitive}} treats them as
ordinary options: the Camel Main auto-configuration summary shows their
configured values instead of {{xxxxxx}}, sanitized URIs keep them, and the
{{camel.security.secretPolicy}} plain-text check does not report them.
h3. Behaviour after the change
The generated sensitive-key list also contains the camel-main options (and bean
options) flagged secret, so these options are masked like every other secret
option. Endpoint-only options are still taken from the component catalogs as
before; the change does not widen the URI pattern with new short endpoint names.
h3. Code changes
* {{tooling/maven/camel-package-maven-plugin/.../UpdateSensitizeHelper.java}}:
also read {{main/camel-main-configuration-metadata.json}} (top-level
{{properties}} with {{"secret": true}}) and {{beans/*.json}}
({{bean.properties}}), collecting the lower-cased last name segment, the same
way {{collectSecretOption}} does for the other catalogs.
* Regenerate
{{core/camel-util/src/main/java/org/apache/camel/util/SensitiveUtils.java}} and
{{catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/sensitive-keys.json}}.
Expected new keys: {{eventhubconnectionstring}}, {{eventstreampassword}},
{{eventstreamusername}}, {{jwtkeystorepassword}}, {{serviceaccountkey}},
{{tenantid}}.
* 4.18.x only: flag {{IBMSecretsManagerVaultConfiguration.eventStreamUsername}}
and {{eventStreamPassword}} with {{@Metadata(secret = true)}} and regenerate
the camel-main metadata (core and catalog copies).
* No change is needed in the camel-main code itself.
h3. Tests
* {{SensitiveUtilsTest.serverAndVaultSecretOptionsAreSensitive()}}
(camel-util): the seven keys above are sensitive.
* {{SecretOptionsAreSensitiveKeysTest}} (camel-catalog): every camel-main
option and every component, data format, language and bean option flagged
secret in the catalog is a sensitive key, so a new secret option cannot be
missed.
* {{MainAutoConfigurationSummaryMaskingTest}} (camel-main, main only): the
auto-configuration summary shows {{xxxxxx}} for
{{camel.server.jwtKeystorePassword}} and
{{camel.vault.azure.eventhubConnectionString}}.
h3. Upgrade note
These options are now masked in the startup summary and in sanitized URIs. On
4.24 and 4.22.x they are also covered by {{camel.security.secretPolicy}}: a
literal value is reported as a plain-text secret (a warning by default; startup
fails with {{camel.main.profile=prod}}). Use a property placeholder or a vault
reference for them. Entries go in the 4.24, 4.22 and 4.18 upgrade guides.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)