digitalbazaar / http-signature-header

BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Implement draft-ietf-httpbis-message-signatures-04 #45

Open aljones15 opened 3 years ago

aljones15 commented 3 years ago

Latest Spec for Signing HTTP Messages Issue Tracker for Spec

Implementation:

Add

Remove

Change

  1. keyid is always lowercase
  2. use alg instead of algorithm
  3. psuedo headers are not @signature-parameters

Remains

  1. lowercase all content identifiers
  2. checks for created and expires do not change (unix time stamp integer)
  3. support for x-date
  4. validateDateRange
  5. api.parseRequest

Optional These 2 address a previous issue while solving issues related to where we validate key type via alg:

Questions

  1. Are we still using hs2019 as the alg?
  2. Do psuedo-header now called @signature-params still need to be in (parenthesis)?
    • looks like the answer to this is no, but not sure.
  3. I see that @request-target has an @ at the beginning, should I use @created for the created sig param?
    • It looks like the answer to this is no, but not sure.
  4. If I define created as a param of a signature input: do I just include it in the signature string?
    • Example: Signature-Input: sig1=("@request-target" "host" "date" "cache-control" \ "x-empty-header" "x-example");created=1618884475;\ keyid="test-key-rsa-pss"
    • created is not in the covered content list, but is defined as a sf parameter of sig1
    • it looks like you do include created in the signing string here, but not sure.
    • it looks like created is included in the @signature-params part of the signing string creation
      • turn the signature input entry into a string again and use it for @signature-params
  5. What happens if I have multiple signatures in Signature-Input & one of them throws before verification?
    • Do I return the request with say 2/3 signatures filled?
  6. What happens if I have multiple signatures in Signature & only one of them fails verification?

Tests

  1. add tests for all @request-target examples from the spec
  2. Change all tests to use Signature-Input & Signature headers over Authorization header
  3. Change all tests to loop over two situations:
    1. single signature
    2. multiple signatures (we'll say 3)
  4. Add tests for structured field value issues
    • should throw if prefix is out of bounds
    • should throw if key is not found
    • should throw if not an sf list
    • should throw if not an sf dictionary
msporny commented 3 years ago

Are we still using hs2019 as the alg?

No, but we need one for ed25519... let's create one called ed25519-2021 -- we'll have to lobby to get this added to the official specification.

What happens if I have multiple signatures in Signature-Input & one of them throws before verification?

By default, if one signature fails, the call to verify should fail. We may want to provide an option where you get back a list of all signatures that succeeded/failed.

Do I return the request with say 2/3 signatures filled?

Always design security systems to fail closed by default. So, by default, you say the signature verification for what was passed in failed. If we provide details in the error code/response, we should state which signatures failed and for what reason like: "unknown signature suite", "unknown keyid", "could not dereference keyid", etc.

What happens if I have multiple signatures in Signature & only one of them fails verification?

Fail closed. If one signature fails, the verification function should return false.

gausnes commented 2 years ago

No, but we need one for ed25519... let's create one called ed25519-2021 -- we'll have to lobby to get this added to the official specification.

It looks like ed25519 was added to the latest version of the draft as an official enumeration.

By default, if one signature fails, the call to verify should fail. We may want to provide an option where you get back a list of all signatures that succeeded/failed.

I don't think this captures the specification intention of multiple signature support. I think that the invoker should specify the signature identifier they are wishing to inspect. If you inspect the example in the latest draft, you can see the proxy need to override the authority. This would cause the proxied request to no longer have the context to validate sig1.