-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Must you not also verify the key ID in addition to the other verification steps? #58
Comments
Yes! You're absolutely right, you also want to check that the activity's actor owns the This all falls under authorization and access control, which are obviously important! The AP authn/authz primer https://www.w3.org/wiki/ActivityPub/Primer/Authentication_Authorization#Actor_ownership discusses them in more detail, but we didn't try to comprehensively cover them in this report. Just covering authentication, ie signing and verifying signatures based on |
To be a little more precise, Steps 5-6 in the "How to obtain a siganture's public key" section are designed to handle the case of making sure the actor ID is correct:
So, first you have to resolve to an actor. At this point, you need to write down which actor ID you've resolved the key to (e.g. which URL you requested) and then make sure to use this Actor object in any future authorization decisions. Deciding e.g. whether the actor |
What does this mean in practice? How do I decide whether an actor owns the key? For instance, let's say you get this activity: {
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Just a note",
"type": "Create",
"actor": "https://example.org/users/123",
"object": {
"type": "Note",
"content": "Just a boring note"
}
} The HTTP signature on the request has the key ID {
"id": "https://example.org/public_key",
"owner": "https://example.org/instance_actor",
"publicKeyPem": "-----BEGIN PUBLIC KEY----- ..."
} ... so then you fetch {
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Service",
"id": "https://example.org/instance_actor",
"publicKey": {
"id": "https://example.org/public_key",
"owner": "https://example.org/instance_actor",
"publicKeyPem": "-----BEGIN PUBLIC KEY----- ..."
},
...
} This key isn't owned by |
@SorteKanin Usually there's a property that indicates an owner. For activities it's
In general:
(more info in FEP-c7d3: Ownership) I think in this particular case it is ok if key owner and activity actor (owner) are different (as long as origin is the same). I shall clarify this in FEP-c7d3 (edit: https://codeberg.org/fediverse/fep/pulls/387). |
This is authentication, and it's straightforward as long as you follow the steps from the spec very carefully. In your example, the actor who owns the key is https://auth0.com/docs/get-started/identity-fundamentals/authentication-and-authorization
You're talking about an authorization decision. You've determined that That's something your server has to determine for itself, the HTTP Signatures spec cannot help you, it can only give you the inputs you need to authenticate the request before you make the authorization decision. Here is a doc from the ActivityPub primer representing the current state of the fediverse / best practices: https://www.w3.org/wiki/ActivityPub/Primer/Authentication_Authorization I hope that helps, LMK if that answers your question |
Thanks for indulging me so far, this has all been very enlightening.
@silverpill In what cases? Why might I require that?
@nightpool I guess my question is, as long as the actor with the key has the same host as the authoring actor of the note, why would I not authorize the note? Clearly the same instance controls both the actor with the key and the authoring actor, so only that instance could have produced the request (HTTP Signature + Activity content). So I feel like there is no authentication doubt - the user with ID And as long as there's no authentication doubt, why would there be any authorization doubt? Unless of course I have banned the external user from my instance or something along those lines, but that's a separate issue I would say. Btw the primer page seems to suggest that the authoring actor and the owner of the key really ought to be the exact same actor, so following that this wouldn't work I think. |
Many reasons. Off the top of my head:
|
@SorteKanin There are two ways to think about ActivityPub: actor-centric and server-centric. |
@snarfed This doesn't make any sense to me. The actor ID is rooted at a |
So the current suggested procedure for verifying a HTTP Signature looks like this:
It's possible that I am missing something, but is it not also necessary to verify that the
keyId
URL has the same hostname (domain) as the actor performing the activity represented in the body of the request? Or at least somehow verify that the actor sending the activity does in fact control that key?To explain, imagine you receive this activity:
The request you got this activity from is signed with a HTTP Signature, but the key ID is just
https://shady.website/maliciouskey
. When you fetch the key from this URL, you get some actor object with the correct public key and using that key you verify the HTTP Signature on the request. But surely this alone does not verify that this note does in fact come from the user with ID 123 from example.org? I mean anyone could set up a domain, host a public key and send the activity above signed with that key as the key ID.Am I correct that you need to check this as well or is this somehow verified by the other steps?
The text was updated successfully, but these errors were encountered: