http-sig: Update http message signatures for OCM after spec review - #62543
http-sig: Update http message signatures for OCM after spec review#62543mickenordin wants to merge 5 commits into
Conversation
b8eb0c3 to
97e3ba5
Compare
|
Sorry, tapped the wrong button |
Seems this is breaking HTTP (without S) which can be used in real world, but is especially used in all tests (also in other apps outside of server) |
nickvergessen
left a comment
There was a problem hiding this comment.
Sharing textfile0.txt failed, could not find group1@http://localhost:8180, maybe the server is currently unreachable or uses a self-signed certificate.
Seems this is breaking HTTP (without S) which can be used in real world, but is especially used in all tests (also in other apps outside of server)
|
It looks like the same https problem as mentioned above. I will push another commit to fix that, and I think the agreement is to allow http for serving your keys if necessary. |
750e748 to
f94f587
Compare
|
@nickvergessen can you rerun the talk test? |
f94f587 to
41b32a8
Compare
41b32a8 to
c0b1d0b
Compare
|
Seems to be green now again, thanks for the adjustment |
|
I found a bigger problem, the old code gets the identity of the calling server from the key id, and the new http-sig code did the same, but the keyid can be anything, it is an opaque identifier and we cant assume that it is a valid url. So now I am resolving the servers origin from the share or the notification instead. I will let the test suite run again, and run it once more through my manual testing to see that it is ok. |
Implements the changes from cs3org/OCM-API#391 and closes the remaining gaps with the HTTP Message Signatures section: - discover peer JWK Sets via the new `jwksUri` discovery field instead of the fixed /.well-known/jwks.json path; advertise our own jwksUri and require it (https) from peers advertising the `http-sig` capability - stop covering the Date header; freshness is anchored on the `created` signature parameter - mark and select the OCM signature by its integrity-protected tag="ocm" parameter instead of the dictionary label - require the JWK `alg` parameter and derive the signature algorithm from it, accepting fully-specified RFC 9864 names - reject signed requests whose verification key cannot be resolved instead of treating them as unsigned - derive the signer origin from the spec-canonical fqdn#id keyid form Signed-off-by: Micke Nordin <kano@sunet.se>
The annotation was added as 34.0.0 in #60136, but stable34 branched before the PR merged, so the API first ships in 35. Signed-off-by: Micke Nordin <kano@sunet.se>
The spec mandates https for jwksUri but allows an HTTP fallback in testing setups. Advertise the scheme the instance actually serves, and accept an http jwksUri only from a peer whose own endpoint is http: integration tests and http intranets work without configuration, while an https peer advertising an http jwksUri is still rejected, since that downgrade would let a path attacker swap the key material. An https jwksUri is always accepted, also from http-only peers, and it may live on a different host than the peer. Signed-off-by: Micke Nordin <kano@sunet.se>
The JWKS signing keyId was persisted as a full URL, frozen at whichever host provisioned the key first. An instance addressed by more than one host (the two-port integration rig, or a port change behind a proxy) then signed with a keyId whose host no longer matched its federated share identity, so receivers rejected the request with an origin mismatch. Persist only a stable opaque key id (ecdsa-p256-sha256-<n>) and rebuild the full keyId per request from the current URL, in both the signing signatory and the published JWK Set. The signature keyid and the JWKS kid still match, since both are built from the same opaque id and the current request host. Rotation still works: slots differ by the counter, and the host is just fresh context. Drops the resolveKidBase/canonicalKid hostname machinery and the ocm_jwks_kid_base appconfig, which are no longer needed. Assisted-by: ClaudeCode:glm-5.2 Signed-off-by: Micke Nordin <kano@sunet.se>
13cbd0a to
438674c
Compare
RFC 7517 §4.5 leaves the keyid structure unspecified, so the receiver must not parse it. The signer origin now comes from the trusted OCM share/sender identity; the JWK Set is resolved against that origin and the keyid is matched opaquely to the JWKS kid. Aligns with the OCM verification procedure and fixes the origin-mismatch / flaky-kid failures in the two-port integration rig. Reverts the per-request host-based kid back to a stable persisted kid, drops keyid->host parsing, threads a sender-origin parameter through verification, and resolves that origin in every OCM inbound entry point (notifications, shares, token exchange, OCM requests) and the federation rate limiter. Cavage is unchanged. Assisted-by: ClaudeCode:glm-5.2 Signed-off-by: Micke Nordin <kano@sunet.se>
438674c to
6abbe1a
Compare
Summary
This pr adjust the format of HTTP Message Signatures following the review of OCM that resulted in some modifications to OCM spec: cs3org/OCM-API#391
tagrather than alabel. This is because a label is simply a key, where as the tag is signed.algparameter in the jwks.I also updated annotations
since, because the original httpsig PR was not merge before NC34 was released, so it needed some updates.Checklist
3. to review, feature component)stable32)AI (if applicable)
Manual testing:
This request:
Has the headers:
This is between two servers (alice and bob) that support the RFC9421 signatures.
Between a server that supports both, and a server with only draft-cavage support (alice and charlie) it looks like this for the body:
headers:
And for charlie to bob:
with headers:
Functionally the pr works, and is backwards compatible. It may break between servers running on an unpatched master and a patched master, but that is not a too big concern I think since the code it changes is not yet in any release.