You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/07/27 07:37:00 UTC

[jira] [Resolved] (CAMEL-24256) DefaultMaskingFormatter/SensitiveUtils: mask connection-string userinfo credentials and PEM private-key blocks

     [ https://issues.apache.org/jira/browse/CAMEL-24256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-24256.
---------------------------------
    Resolution: Fixed

Merged via PR https://github.com/apache/camel/pull/25113

> DefaultMaskingFormatter/SensitiveUtils: mask connection-string userinfo credentials and PEM private-key blocks
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24256
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24256
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Andrea Cosentino
>            Assignee: Omar Atie
>            Priority: Major
>             Fix For: 4.22.0
>
>
> Camel's secret masking ({{org.apache.camel.support.processor.DefaultMaskingFormatter}}) and the underlying key list ({{org.apache.camel.util.SensitiveUtils}}) detect secrets by *key name*: they blank the value of a key=value, XML or JSON entry whose name is one of {{SensitiveUtils.getSensitiveKeys()}}. That covers the common cases well, but two credential *shapes* are not name-based and are therefore not masked:
> * Connection-string userinfo credentials, for example {{mongodb://user:pass@host:27017/db}} or {{amqp://admin:secret@broker:5672/vhost}}. The password sits in the URI userinfo ({{user:pass@}}) with no {{password=}} key, so the key=value masker never sees it. (Note the {{?password=...}} query-parameter form *is* already caught, since that is key=value.)
> * PEM private-key blocks, for example a value containing {{-----BEGIN RSA PRIVATE KEY-----}} ... {{-----END PRIVATE KEY-----}}.
> h3. Proposal
> Add optional, format-based detection to {{DefaultMaskingFormatter}} (or a small helper alongside {{SensitiveUtils}}) for these two shapes:
> * mask the userinfo of a {{scheme://user:pass@host}} URI (replace the {{:pass}} portion), and
> * mask the body of a PEM {{-----BEGIN ... PRIVATE KEY-----}} ... {{-----END ... PRIVATE KEY-----}} block.
> Both are value-shape patterns, not new keywords, so they complement the existing name-based list rather than duplicating it.
> h3. Context
> Found while reviewing the Camel JBang MCP secret-redaction rework in [camel#25093|https://github.com/apache/camel/pull/25093]. That PR moved the MCP redactor onto {{SensitiveUtils}} / {{DefaultMaskingFormatter}} (per review feedback) and consequently dropped the two shapes above, which had been handled by an ad-hoc regex there. Handling them centrally in the masker would let every caller (logging {{logMask=true}}, the dev console, the jbang tooling, the MCP server) benefit, instead of each re-implementing it.
> _Filed by Claude Code on behalf of Andrea Cosentino (@oscerd)._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)