You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2024/03/12 00:36:00 UTC

[jira] [Resolved] (CXF-8982) LoggingFeature does not hide sensitive xml elements with namespace prefix

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

Andriy Redko resolved CXF-8982.
-------------------------------
    Resolution: Fixed

> LoggingFeature does not hide sensitive xml elements with namespace prefix
> -------------------------------------------------------------------------
>
>                 Key: CXF-8982
>                 URL: https://issues.apache.org/jira/browse/CXF-8982
>             Project: CXF
>          Issue Type: Improvement
>          Components: logging
>    Affects Versions: 3.5.7, 3.6.2, 4.0.3
>            Reporter: Gaëtan Pitteloud
>            Priority: Major
>
> When setting a sensitive element name in the LoggingFeature, the element is not hidden if the element appears in XML with a namespace prefix.
> It's not possible to just add a prefix when configuring the LoggingFeature:
>  # this does not work for JSON
>  # the namespace prefix is typically generated by the marshaller (ns1, ns2, etc) thus unknown during configuration
> The solution is to change the xml regex templates in MaskSensitiveHelper by adding the optional prefix group in the opening and closing tags:
>  
> {code:java}
> private static final String MATCH_PATTERN_XML_TEMPLATE = "(<(\\w+:)?-ELEMENT_NAME-.*?>)(.*?)(</(\\w+:)?-ELEMENT_NAME->)";
> private static final String REPLACEMENT_XML_TEMPLATE = "$1XXX$4";
> {code}
>  
>  



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