Repository navigation
feat: Supporting parsing of Accept-Signature header - #176
Conversation
ParseAcceptSignature returns the signatures a peer requests, so a client can fulfill them without parsing the field itself. A member that can't be used doesn't affect the others: the usable requests are returned together with an error for each unusable member.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
=======================================
Coverage 97.70% 97.71%
=======================================
Files 22 22
Lines 1397 1445 +48
=======================================
+ Hits 1365 1412 +47
- Misses 32 33 +1 ☔ View full report in Codecov by Harness. |
|
Thanks a lot @rosylilly for this PR. Looks very nice. There are however some small issues, which I'm fixing right now. As as soon as these are done, I'll push an update to your branch. |
|
Your PR made a previously present issue visible: #180. |
|
two things are still open:
I'm fixing that now. |
…o one place and moved TestSignAndVerifyParsedSignatureRequest to a new integration_tests.go file
|
@rosylilly: I'm done with my updates. Here's a short summary of the changes I made beyond merging the latest
I noticed that you added I also appreciate your review of my changes. Most of them were related to HMS RFC compliance. Though, not all was possible due to some httpsfv limitations. |
|
Thanks for the updates! LGTM. On One nitpick: since the |
|
Thanks @rosylilly. I changed the code to make use of Regarding the |
|
LGTM. I agree on both points: changing |
|
@rosylilly: The last commits resolve the issue you've reported. If I've not overlooked anything, invalid/malformed signatures are ignored as long as these are not selected for validation. Could you please check as well. I'm now looking whether there are any performance optimizations in the changed code. Other then that, I think the PR is ready for being merged. At least if you don not find anything else, which might be blocking. |
|
I didn't find anything concerning! I think it's good to merge. Performance-wise, I don't think it will cause any problems in practice either. |
Accept-Signature header
ParseAcceptSignature returns the signatures a peer requests as SignatureRequest values, so a client can fulfill them without parsing the field itself.
http.Headerinstead of*Message#170 discussed taking a
*Messageto keep the library framework-agnostic. I went withhttp.Headerbecause parsing this field needs nothing else from a message, and it can then be used without building one.Messageusers can callParseAcceptSignature(msg.Header), andhttp.Headeris only a map type from the standard library, so this adds no framework dependency.Errors per member
A member that can't be used, for example because it names an unsupported component, doesn't affect the others. The usable requests are returned together with a joined error that wraps
ErrMalformedDatafor each unusable member, because RFC 9421 Section 5.2 permits ignoring requests that don't fit. This also matches #174, where a member the caller didn't select can't fail the call. Callers that need every request to be usable can requireerr == nil. If the field as a whole isn't valid Structured Fields, no requests are returned.Closes #170