Claus Ibsen created CAMEL-27577:
-----------------------------------
Summary: camel-util - SensitiveUtils.isSensitiveHeader: recognise
credential HTTP headers, including vendor headers such as X-Amz-Security-Token
Key: CAMEL-27577
URL: https://issues.apache.org/jira/browse/CAMEL-27577
Project: Camel
Issue Type: Improvement
Components: camel-http, camel-core
Reporter: Claus Ibsen
Fix For: 4.24.0
Follow-up of CAMEL-27429 (https://github.com/apache/camel/pull/30872).
h3. Problem
{{SensitiveUtils.containsSensitive}} matches a whole name, in lower case with
dashes stripped, against the generated list of secret option names. That works
for configuration keys, but most credential HTTP headers carry a vendor prefix,
so they are not matched: {{X-Amz-Security-Token}} becomes
{{xamzsecuritytoken}}, which is not a key. #30872 therefore adds a short fixed
list in {{LoggingHttpActivityListener}} ({{Proxy-Authorization}}, {{Cookie}},
{{Set-Cookie}}, {{X-Api-Key}}, {{X-Auth-Token}}), which misses the many vendor
headers, for example:
* AWS: {{X-Amz-Security-Token}}, {{X-Amz-Server-Side-Encryption-Customer-Key}},
{{X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key}}
* Azure: {{Ocp-Apim-Subscription-Key}}, {{X-Functions-Key}},
{{X-Ms-Encryption-Key}}
* Google: {{X-Goog-Api-Key}}, {{X-Goog-Encryption-Key}},
{{X-Goog-Iap-Jwt-Assertion}}
* HashiCorp: {{X-Vault-Token}}, {{X-Consul-Token}}, {{X-Nomad-Token}}
* others: {{Private-Token}} and {{Job-Token}} (GitLab),
{{X-Shopify-Access-Token}}, {{X-RapidAPI-Key}}, {{DD-API-KEY}},
{{DD-APPLICATION-KEY}}, {{X-Honeycomb-Team}}, {{X-Sentry-Auth}},
{{X-Registry-Auth}}
The encryption-key headers carry a customer data key in the clear.
There is no registry of such headers, so a list alone stays incomplete.
h3. Proposal
Add {{SensitiveUtils.isSensitiveHeader(String name)}} in camel-util, separate
from the configuration-key matching (adding header names to the generated keys
would also mask configuration options and URI parameters with those names):
# true when {{containsSensitive(name)}} is true;
# true when the name, in lower case without dashes, ends in {{token}}, {{key}},
{{secret}}, {{password}}, {{auth}}, {{credential}} or {{credentials}};
# a small explicit list for credential headers that the rule misses
({{Cookie}}, {{Set-Cookie}}, {{X-Honeycomb-Team}}, ...);
# a small exclusion list for well-known headers that end in such a word but are
not secret ({{Idempotency-Key}}, ...).
Use it in {{LoggingHttpActivityListener}} instead of the fixed list of #30872.
Later, other places that log HTTP header values can use it too, such as the
TRACE logging of header values in camel-netty-http
({{DefaultNettyHttpBinding}}) and camel-undertow
({{DefaultUndertowHttpBinding}}).
Needs a unit test of the rule (each header above, the exclusions, ordinary
headers such as {{Content-Type}} and {{X-Trace}}), a {{@since 4.24}} tag, and
an upgrade-guide note in the logHttpActivity entry of CAMEL-27429.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)