Subject: [OAUTH-WG] HTTP request signing and repeated query/header keys

From: "Brock Allen" <[email-masked]>
Date: Sun, 28 Feb 2016 16:31:33 -0500

Given that the client can iterate over the query/headers in any order to
generate the concatenated value to hash, I think there's an issue with query
string or header values with repeated keys. I'll stick with query params for
simplicity in my sample. 

If a client signs this concatenated query: "a=1&a=2" then the "p" value in
the signed JSON object could be this:

"p": [["a", "a"], "blah"]

On the resource server, how do you know which key/value pair to put in which
order for verification? Also, given that different server implementations
express these incoming parameters in different ways, it seems problematic to
be consistent.

Thanks.

-Brock

---

From: Justin Richer <[email-masked]>
Date: Sun, 28 Feb 2016 13:37:14 -0800

In §7.5 we currently have:

   The behavior of repeated query parameters or repeated HTTP headers is
   undefined by this specification.  If a header or query parameter is
   repeated on either the outgoing request from the client or the
   incoming request to the protected resource, that query parameter or
   header name MUST NOT be covered by the hash and signature. [[ Note to
   the WG: is this something we need to cover? ]]

Which is to say: Yeah, that’s a problem, probably. We either declare this behavior out of scope and say you can’t use this method with that kind of API (or at least those parameters/headers) or we define a mechanism for handling that. I’m in favor of the former, and removing the text from the generation sections that says repeated parameters are processed with no special handling, making them explicitly out of scope throughout.

I would love to see more feedback from the group about this, especially if someone’s got a clever solution.

 — Justin

> On Feb 28, 2016, at 1:31 PM, Brock Allen <[email-masked]> wrote:
> 
> Given that the client can iterate over the query/headers in any order to generate the concatenated value to hash, I think there’s an issue with query string or header values with repeated keys. I’ll stick with query params for simplicity in my sample.
>  
> If a client signs this concatenated query: “a=1&a=2” then the “p” value in the signed JSON object could be this:
>  
> On the resource server, how do you know which key/value pair to put in which order for verification? Also, given that different server implementations express these incoming parameters in different ways, it seems problematic to be consistent.
>  
> Thanks.
>  
> -Brock
>  
> _______________________________________________
> OAuth mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/oauth

---

From: "Brock Allen" <[email-masked]>
Date: Sun, 28 Feb 2016 16:40:20 -0500

Ok, missed that – thanks.

For now in my implementation I’m also ignoring this problem :)

-Brock

From: Justin Richer [mailto:[email-masked]] 
Sent: Sunday, February 28, 2016 4:37 PM
To: Brock Allen <[email-masked]>
Cc: <[email-masked]> <[email-masked]>
Subject: Re: [OAUTH-WG] HTTP request signing and repeated query/header keys

 — Justin

On Feb 28, 2016, at 1:31 PM, Brock Allen <[email-masked] <mailto:[email-masked]> > wrote:

Thanks.

-Brock

_______________________________________________
OAuth mailing list
[email-masked] <mailto:[email-masked]> 
https://www.ietf.org/mailman/listinfo/oauth

---

From: "Brock Allen" <[email-masked]>
Date: Sun, 28 Feb 2016 16:50:22 -0500

Now that I’m thinking about this, the only thing that comes to mind is a hash of the value included somehow (which I’m sure you’ve already thought of). That’s obviously more complexity and overhead for all scenarios to support this edge case. 

-Brock

From: Brock Allen [mailto:[email-masked]] 
Sent: Sunday, February 28, 2016 4:40 PM
To: 'Justin Richer' <[email-masked]>
Cc: '<[email-masked]>' <[email-masked]>
Subject: RE: [OAUTH-WG] HTTP request signing and repeated query/header keys

-Brock

From: Justin Richer [mailto:[email-masked]] 
Sent: Sunday, February 28, 2016 4:37 PM
To: Brock Allen <[email-masked] <mailto:[email-masked]> >
Cc: <[email-masked] <mailto:[email-masked]> > <[email-masked] <mailto:[email-masked]> >
Subject: Re: [OAUTH-WG] HTTP request signing and repeated query/header keys

 — Justin

Thanks.

-Brock

---

From: Justin Richer <[email-masked]>
Date: Sun, 28 Feb 2016 17:12:49 -0800

Yeah, that’s the trick — you don’t want to end up replicating the entire HTTP message inside the JWS envelope, because then you end up with a SOAP kind of approach where you’re not really using the outside HTTP constructs to their fullest anymore. 

In the end, I don’t think this spec is ever going to be perfectly universal, but if it can hit a majority of use cases with a simple and robust solution, I think we’re in good shape.

 — Justin

> On Feb 28, 2016, at 1:50 PM, Brock Allen <[email-masked]> wrote:
> 
> From: Justin Richer [mailto:[email-masked] <mailto:[email-masked]>] 
> To: Brock Allen <[email-masked] <mailto:[email-masked]>>
> Cc: <[email-masked] <mailto:[email-masked]>> <[email-masked] <mailto:[email-masked]>>
>> On Feb 28, 2016, at 1:31 PM, Brock Allen <[email-masked] <mailto:[email-masked]>> wrote:
>>  
>> https://www.ietf.org/mailman/listinfo/oauth <https://www.ietf.org/mailman/listinfo/oauth>
>

---

From: "Brock Allen" <[email-masked]>
Date: Sun, 28 Feb 2016 20:17:27 -0500

Yea, I’m cool with just saying “duplicate keys won’t work” for my implementation, unless I do some implementation specific thing like sort them by value order or some such (but that would have to be on both sides).

-Brock

Sent: Sunday, February 28, 2016 8:13 PM

 — Justin

On Feb 28, 2016, at 1:50 PM, Brock Allen <[email-masked] <mailto:[email-masked]> > wrote:

-Brock

From: Brock Allen [mailto:[email-masked]] 
Sent: Sunday, February 28, 2016 4:40 PM
To: 'Justin Richer' <[email-masked] <mailto:[email-masked]> >
Cc: '<[email-masked] <mailto:[email-masked]> >' <[email-masked] <mailto:[email-masked]> >
Subject: RE: [OAUTH-WG] HTTP request signing and repeated query/header keys

-Brock

 — Justin

Thanks.

-Brock

---

From: "Manger, James" <[email-masked]>
Date: Mon, 29 Feb 2016 13:39:31 +1100

Being able to selectively include or exclude individual query string name=value parameters in a signature feels far too dangerous. Always sign them all — with the only exception being the signature itself if transmitted as a query string parameter.
Unfortunately we do need to selectively include or exclude HTTP headers as they are a mix of transport, app-layer, end-to-end, and hop-by-hop items.

Ignoring duplicate query parameter names is a poor design for a fairly generic HTTP signing method. My suggestion would be to do a stable sort on parameter names. That is, sort the names, but preserve the order of values when a name appears multiple times. …hoping that works with almost all frameworks.

--
James Manger

From: OAuth [mailto:[email-masked]] On Behalf Of Brock Allen
Sent: Monday, 29 February 2016 12:17 PM
To: 'Justin Richer' <[email-masked]>
Cc: '<[email-masked]>' <[email-masked]>
Subject: Re: [OAUTH-WG] HTTP request signing and repeated query/header keys

-Brock

From: Justin Richer [mailto:[email-masked]]
Sent: Sunday, February 28, 2016 8:13 PM
To: Brock Allen <[email-masked]<mailto:[email-masked]>>
Cc: <[email-masked]<mailto:[email-masked]>> <[email-masked]<mailto:[email-masked]>>
Subject: Re: [OAUTH-WG] HTTP request signing and repeated query/header keys

 — Justin

On Feb 28, 2016, at 1:50 PM, Brock Allen <[email-masked]<mailto:[email-masked]>> wrote:

-Brock

From: Brock Allen [mailto:[email-masked]]
Sent: Sunday, February 28, 2016 4:40 PM
To: 'Justin Richer' <[email-masked]<mailto:[email-masked]>>
Cc: '<[email-masked]<mailto:[email-masked]>>' <[email-masked]<mailto:[email-masked]>>
Subject: RE: [OAUTH-WG] HTTP request signing and repeated query/header keys

-Brock

From: Justin Richer [mailto:[email-masked]]
Sent: Sunday, February 28, 2016 4:37 PM
To: Brock Allen <[email-masked]<mailto:[email-masked]>>
Cc: <[email-masked]<mailto:[email-masked]>> <[email-masked]<mailto:[email-masked]>>
Subject: Re: [OAUTH-WG] HTTP request signing and repeated query/header keys

 — Justin

On Feb 28, 2016, at 1:31 PM, Brock Allen <[email-masked]<mailto:[email-masked]>> wrote:

Thanks.

-Brock

_______________________________________________
OAuth mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/oauth

---

From: "Phil Hunt (IDM)" <[email-masked]>
Date: Sun, 28 Feb 2016 19:18:27 -0800

The issue for any service is that things like gateways and proxies may change or add parameters.

There is a long tradition with http to mess with things headers and payload in the real world. Not ideal, but a certain reality. 

Thus for certain services it is likely only possible to sign a subset of params that the client and service provider want to verify did not change. 

Phil

> On Feb 28, 2016, at 18:39, Manger, James <[email-masked]> wrote:
>