Skip to content

Verify HTTP Signatures with ap: key IDs #1096

Description

@dahlia

Background

#840 made Fedify identify its own gateway keys by compatible identifiers, e.g., https://example.com/.well-known/apgateway/did:key:z6Mk…/actor#main-key, and verify incoming HTTP Signatures whose key IDs have that form. Other implementations may identify keys of portable actors by ap: or ap+ef61: URIs instead, such as ap://did:key:z6Mk…/actor#main-key. FEP-521a recommends that key IDs be fragments of the actor ID, and FEP-ae97 only asks for key IDs “generated with the server's origin” when compatible identifiers are used, which suggests key IDs under the portable ID otherwise. FEP-ae97 also says the client's own key “MUST NOT be a compatible identifier.”

Fedify cannot verify such signatures today: the document loader cannot fetch an ap: URI, and the key ID alone does not say which gateway to fetch the actor document from.

Proposed work

Resolve key IDs that are ap: or ap+ef61: URIs by dereferencing the actor document through its gateways, and then apply the same rules #840 applies to gateway keys: the document must have a valid Object Integrity Proof by the actor's DID and embed the key in its assertionMethod.

Design questions:

  • Which gateways should Fedify ask? Candidates are @gateway location hints in the key ID, the origin of the request being verified, and gateways learned from earlier lookups of the actor. None of these is authenticated, which is acceptable since the proof authenticates the document, but they decide whom Fedify contacts.
  • With a key ID like this, which gateway made the signature? HTTP signature keys for portable actor gateways #840 requires the signing gateway to be listed in gateways, and takes it from the key ID's origin, which an ap: key ID does not have. One option is to treat such keys as the actor's own keys rather than a gateway's.
  • Should outgoing requests ever use key IDs of this form, e.g., as an option of mapPortableActorId()?

It would help to check what Mitra and Streams actually send before settling this.

Scope

This issue covers verifying incoming signatures with ap: and ap+ef61: key IDs. It does not include FEP-ae97 client registration or the client-signed outbox.

Tests

  • a request signed with an ap: key ID of a portable actor being verified through a gateway;
  • rejecting the key when the actor document has no valid proof, or does not embed the key;
  • location hints in the key ID, if supported;
  • unchanged behavior for compatible key IDs and ordinary key IDs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Fields

    Priority

    None yet

    Effort

    None yet

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions