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

   Supersedes #30892. Same change, rebased onto current `main` after 
CAMEL-27429 / #30872 merged, addressing the review points raised by @davsclaus 
on #30892.
   
   ## What CAMEL-27577 asks for
   
   A reusable rule in camel-util that decides whether an HTTP header carries a 
credential, so that `LoggingHttpActivityListener` (camel-http) masks the values 
of credential headers in the activity log based on that rule instead of a fixed 
list of header names.
   
   ## The change
   
   - `SensitiveUtils.isSensitiveHeader(String)` (camel-util, `@since 4.24`): 
true when the name matches a sensitive configuration key via the existing 
`containsSensitive`, when the normalized name (lowercase, dashes stripped) ends 
in `token`, `key`, `secret`, `password`, `auth`, `credential` or `credentials`, 
or when it is in a small explicit list of well-known credential headers the 
rules miss (`Cookie`, `Set-Cookie`, `Proxy-Authorization`, 
`X-Google-IAP-JWT-Assertion`, `X-Honeycomb-Team`). `Idempotency-Key` is 
explicitly excluded: it ends in `key` but carries no secret.
   - `LoggingHttpActivityListener` now delegates to 
`SensitiveUtils.isSensitiveHeader`, replacing the fixed `SENSITIVE_HEADERS` 
list from CAMEL-27429; the protected `isSensitiveHeader(String)` method is kept 
so subclasses can override it, and masked values still go through the 
`getMaskString()` path from #30872.
   - Upgrade guide: the rule is documented inside the existing CAMEL-27429 
`camel-http` entry in the 4.24 upgrade guide (no separate section).
   - Component docs: the "Logging HTTP activity" section of 
`http-component.adoc` describes the new rule, and the generated catalog copy is 
updated to match.
   
   ## Review points from #30892 and how they are covered
   
   1. Listener uses the new method in place of the fixed list, protected method 
kept: done.
   2. Masking goes through `getMaskString()` so bare credential values are 
logged as `xxxxx`, not passed through the masking formatter: done (the listener 
keeps the structure merged in #30872).
   3. Listener test for the new headers: `HttpLoggingActivityMaskHeadersTest` 
now also sends `X-Amz-Security-Token` and `Ocp-Apim-Subscription-Key` and 
asserts both are logged as `xxxxx`, and sends `Idempotency-Key` and asserts its 
value is logged as sent.
   4. Upgrade-guide note merged into the existing CAMEL-27429 entry: done.
   5. Component docs describe the new rule and the catalog copy is regenerated: 
done.
   - Minor: in `testIsSensitiveHeader`, `X-Api-Key` and `X-Auth-Token` are 
grouped with the suffix matches, since they match through the `key` and `token` 
suffixes rather than `containsSensitive`.
   
   ## Tests
   
   - camel-util: full module suite, 362 tests, 0 failures (includes 
`SensitiveUtilsTest` 13/13 with the new `testIsSensitiveHeader` covering every 
header named in the ticket, the explicit list, the `Idempotency-Key` exclusion, 
case variants, and ordinary headers asserted false).
   - camel-http: `LoggingHttpActivityListenerTest` passes; the extended 
`HttpLoggingActivityMaskHeadersTest` compiles but could not be run locally (it 
starts a local HTTP server and this sandbox blocks JVM loopback connections, so 
it times out before reaching its assertions), so CI is its first full run.
   - `formatter:format` and `impsort:sort` run on both modules with no changes.
   


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