Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 534A59AB9 for ; Tue, 9 Dec 2014 12:03:13 +0000 (UTC) Received: (qmail 79439 invoked by uid 500); 9 Dec 2014 12:03:12 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 79325 invoked by uid 500); 9 Dec 2014 12:03:12 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 79080 invoked by uid 99); 9 Dec 2014 12:03:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2014 12:03:12 +0000 Date: Tue, 9 Dec 2014 12:03:12 +0000 (UTC) From: "Ruud de Jong (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-6144) WS-Security fails if body has signature on WSS4JInInterceptor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-6144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ruud de Jong updated CXF-6144: ------------------------------ Attachment: soap-body-2.7.8.txt Soap body according to XmlDebug in version 2.7.8. > WS-Security fails if body has signature on WSS4JInInterceptor > ------------------------------------------------------------- > > Key: CXF-6144 > URL: https://issues.apache.org/jira/browse/CXF-6144 > Project: CXF > Issue Type: Bug > Components: WS-* Components > Affects Versions: 2.7.9 > Environment: Any > Reporter: Ruud de Jong > Attachments: XmlDebug.java, soap-body-2.7.8.txt, soap-body-2.7.9.txt > > > If a WebService has WS-Security with the soap body as part of the signature, the incoming security check (by the WSS4JInInterceptor) will break. > This bugs was introduced in 2.7.9 and is still present in the current codebase (3.0.3). > This problem is caused by the WSS4JInInterceptor. It uses the "SAAJInInterceptor.INSTANCE.handleMessage(msg)" on getSOAPMessage to convert a CXF SoapMessage to a javax.xml.soap.SOAPMessage. > During this conversion, the SAAJInInterceptor add an empty text-node at the end of the soap-body. > This breaks when the soap-body is part of the signature. > The old 2.7.8 version of the SAAJInInterceptor did (line 223:) StaxUtils.readDocElements(soapMessage.getSOAPPart().getEnvelope().getBody(), xmlReader, true, true); > The new 2.7.9 version does (line 140:) > StaxUtils.copy(xmlReader1, new SAAJStreamWriter(e.getSOAPPart(), e.getSOAPPart().getEnvelope().getBody()), true, true); > If I use XmlDebug in WSS4JInInterceptor right after this call, the old version returns: > soapenv:Body/"" wsu:Id=id-DAA3E142F565CE51EF1418124875319916 xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd > ns:genereerProduct/"" > ns:productRequest/"" > ns:klantreferentie/"" > #text/"123" > ns:productnaam/"" > #text/"456" > ns:productversie/"" > #text/"789" > ns:productsleutel/"" > ns:kvkNummer/"" > #text/"33333333" > #text/"\n" > #text/"\n" > while the new version returns: > soapenv:Body/"" wsu:Id=id-DAA3E142F565CE51EF1418124875319916 xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd > ns:genereerProduct/"" > ns:productRequest/"" > ns:klantreferentie/"" > #text/"123" > ns:productnaam/"" > #text/"456" > ns:productversie/"" > #text/"789" > ns:productsleutel/"" > ns:kvkNummer/"" > #text/"33333333" > #text/"\n" > #text/"\n" > #text/"\n" > Notice the additional #text/"\n" inside the body. -- This message was sent by Atlassian JIRA (v6.3.4#6332)