akamai / AkamaiOPEN-edgegrid-python

This library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme
Apache License 2.0
88 stars 52 forks source link

Inaitana params path signature #66

Closed robertolopezlopez closed 2 years ago

robertolopezlopez commented 2 years ago

https://github.com/akamai/AkamaiOPEN-edgegrid-python/pull/52 , rebased. C&P:

This pull request fixes #51.

Python's implementation of urlparse takes the semicolon ";" as a separator for the params section, so any string following ";" is not considered part of the path. For this reason, urls for multi-configId SIEM fetch events requests, which by specifications should be listed in the path separated by semicolons, are not correctly signed by this library.

I.e:

urlparse("https://***.akamaiapis.net/siem/v1/configs/111;222;333?from=1611249319&limit=200000")

would produce:

{ ..., path: "/siem/v1/configs/111", params: "222;333", query: "from=1611249319&limit=200000" }

Including only the path and query sections in the data_tosign only signs "siem/v1/configs/111?from=1611249319&limit=200000"_ and does not produce the correct signature. Including the params section produces a correct signature which is accepted by the SIEM api.

inaitana commented 2 years ago

Thank you, now I see what you meant. Anyway I actually thought jrobins04's solution from #52 (using urlsplit instead of urlparse and leave the rest unchanged) was a better idea, that's why I thought my PR could be discarded altogether.

robertolopezlopez commented 2 years ago

@inaitana : we will check what's the best approach here, no worries :-)