@@ -21,7 +21,7 @@ import (
2121)
2222
2323// WIMSE HTTP Message Signature profile (draft-ietf-wimse-http-signature-06).
24- // Vectors: https://github.com/kanywst/wimsey/tree/main/conformance/httpsig
24+ // Vectors: https://github.com/kanywst/wimsey (see testdata/wimse/SOURCE for tag/commit).
2525//
2626// httpsign implements RFC 9421, not the WIMSE profile. This harness:
2727// 1. checks we can mint/verify the golden HTTP signatures
@@ -67,6 +67,16 @@ type wimseNegative struct {
6767 ExpectedReqNonce string `json:"expected_req_nonce"`
6868}
6969
70+ // wimseAccepted is a positive case that must still verify (e.g. uncovered component mutated).
71+ type wimseAccepted struct {
72+ ID string `json:"id"`
73+ Description string `json:"description"`
74+ SignatureInput string `json:"signature_input"`
75+ Signature string `json:"signature"`
76+ Body string `json:"body"`
77+ Request * wimseHTTPRequest `json:"request"`
78+ }
79+
7080type wimseResponse struct {
7181 Status int `json:"status"`
7282 Headers [][2 ]string `json:"headers"`
@@ -91,10 +101,11 @@ type wimseSuite struct {
91101 Params map [string ]any `json:"params"`
92102 Request wimseHTTPRequest `json:"request"`
93103 Body string `json:"body"`
94- SignatureInput string `json:"signature_input"`
95- Signature string `json:"signature"`
96- Negative []wimseNegative `json:"negative"`
97- Response * wimseResponse `json:"response"`
104+ SignatureInput string `json:"signature_input"`
105+ Signature string `json:"signature"`
106+ Negative []wimseNegative `json:"negative"`
107+ Accepted []wimseAccepted `json:"accepted"`
108+ Response * wimseResponse `json:"response"`
98109}
99110
100111func loadWimseSuite (t * testing.T , name string ) wimseSuite {
@@ -386,6 +397,14 @@ func TestWimseConformance(t *testing.T) {
386397 }
387398 })
388399
400+ t .Run ("Accepted" , func (t * testing.T ) {
401+ for _ , a := range s .Accepted {
402+ t .Run (a .ID , func (t * testing.T ) {
403+ runWimseRequestAccepted (t , s , keys , reqFields , a )
404+ })
405+ }
406+ })
407+
389408 if s .Response == nil {
390409 return
391410 }
@@ -434,6 +453,38 @@ func TestWimseConformance(t *testing.T) {
434453 }
435454}
436455
456+ func runWimseRequestAccepted (t * testing.T , s wimseSuite , keys wimseKeyPair , reqFields Fields , a wimseAccepted ) {
457+ t .Helper ()
458+ body := s .Body
459+ if a .Body != "" {
460+ body = a .Body
461+ }
462+ httpReq := s .Request
463+ if a .Request != nil {
464+ httpReq = * a .Request
465+ }
466+ sigIn := s .SignatureInput
467+ if a .SignatureInput != "" {
468+ sigIn = a .SignatureInput
469+ }
470+ sig := s .Signature
471+ if a .Signature != "" {
472+ sig = a .Signature
473+ }
474+
475+ req := wimseHTTPReq (t , httpReq , body )
476+ req .Header .Set ("Signature-Input" , sigIn )
477+ req .Header .Set ("Signature" , sig )
478+
479+ details , err := RequestDetails (s .Label , req )
480+ require .NoError (t , err , a .Description )
481+ got := wimseRequestProfileCheck (t , details , req , time .Unix (s .VerifyNow , 0 ), 0 , "https://service.example/transfer" , s .Components )
482+ require .Empty (t , got , a .Description )
483+
484+ err = VerifyRequest (s .Label , * wimseRFCVerifier (t , keys , reqFields ), req )
485+ require .NoError (t , err , a .Description )
486+ }
487+
437488func runWimseRequestNegative (t * testing.T , s wimseSuite , keys wimseKeyPair , reqFields Fields , n wimseNegative ) {
438489 t .Helper ()
439490 body := s .Body
0 commit comments