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

   Implements [CAMEL-27577](https://issues.apache.org/jira/browse/CAMEL-27577).
   
   HTTP header names do not follow the same naming conventions as configuration 
keys, so `SensitiveUtils.containsSensitive` alone does not reliably detect 
credential-bearing headers. This adds a dedicated check for headers:
   
   - New `SensitiveUtils.isSensitiveHeader(String)` in camel-util, tagged 
`@since 4.24`. A header is sensitive when:
     - `containsSensitive(name)` matches (existing key matching), or
     - the normalized name (lowercase, dashes stripped) ends in `token`, `key`, 
`secret`, `password`, `auth`, `credential` or `credentials`, or
     - it is on a small explicit list for headers the rules above miss (e.g. 
`Cookie`, `Set-Cookie`, `Proxy-Authorization`, `X-Goog-Iap-Jwt-Assertion`, 
`X-Honeycomb-Team`).
     - A small exclusion list keeps non-credential headers such as 
`Idempotency-Key` from being flagged. Null/empty names return `false`.
   - `SensitiveUtilsTest.testIsSensitiveHeader` covers every header named in 
the issue 
(AWS/Azure/Google/HashiCorp/GitLab/Shopify/RapidAPI/Datadog/Honeycomb/Sentry 
and the CAMEL-27429 headers), case variants, the exclusion, and ordinary 
headers (`Content-Type`, `Accept`, `User-Agent`, `WWW-Authenticate`, ...) 
asserted not sensitive.
   - Upgrade guide note for 4.24 describing the header masking rule.
   
   Listener wiring: `LoggingHttpActivityListener` now masks a header when 
`h.isSensitive() || SensitiveUtils.isSensitiveHeader(h.getName())`. This form 
is deliberate: CAMEL-27429 / #30872, which introduced the listener's current 
fixed sensitive-header list, is not merged yet, so this change is written 
against current `main` and composes with #30872 when it lands (the fixed list 
can then be replaced by the `isSensitiveHeader` check).
   
   Tests:
   - camel-util full module suite: 313 tests, all passing, including the new 
`testIsSensitiveHeader` (the test was written first and fails on unmodified 
code since the method does not exist).
   - camel-http builds successfully and `LoggingHttpActivityListenerTest` 
passes. The full camel-http suite was not run locally (most of its tests start 
local HTTP servers, which the local sandbox restricts); CI will cover it.
   


-- 
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