Monday, November 30, 2009

Problems with Unsigned WS-Security Timestamps in the Response

I've had a few customers recently that have struggled with this scenario - a web-service consumer receives a response message that it cannot validate. We spend some much time focusing on the request, but often don't think about the response. The messages in question look something like this:

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="">
<wsse:Security xmlns:wsse="" S:mustUnderstand="1">
<wsu:Timestamp xmlns:wsu="">
<ns2:sayHelloResponse xmlns:ns2="">

The issue is that the message includes a timestamp, but its not signed. I've seen this issue with both WCF clients as well as Oracle Web Services Manager (OWSM).

Depending on the client stack, there are two ways to fix this issue. The first is to simply sign the response. This is really the best practice, especially for a message that the sender took the time and effort to add WS-Security to in the first place. The second approach, is to simply remove the message security (i.e. WS-Security header and timestamp). For example, below is a modified Wssp1. 2-2007-Https.xml that still ensures that the request is over SSL, but removes the "offending" timestamp.

Wssp1. 2-2007-Https-no-timestamp.xml

<?xml version="1.0"?>
<sp:HttpsToken />

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.