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

Gaëtan Pitteloud updated CXF-8982:
----------------------------------
    Description: 
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 (\w+:) 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}
 

 

  was:
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 (\w+:)? 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}
 

 


> 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: 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 (\w+:) 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)

Reply via email to