Repository navigation
Only accept activities signed with the actor's own key - #3979
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #
Proposed changes:
actor. Before, any key from the same host was enough, so on a server where users hold their own keys, one account's key passed for another account on that server.Remote_Actors::get_public_key()reports the actor the key was taken from (the stored actor, or the one fetched from the key's host), and both verifiers return that owner instead of the keyId.verify_key_id()compares it with the actor and still fails closed on identifiers without a host.Signature::verify_http_signature()andHttp_Signature::verify()now return the id of the actor that owns the verified key instead of the keyId. In the plugin only the inbox verification uses the value, the router only checks for an error. I did not find other callers.get_remote_metadata_by_actor()explains whyProxy::get()should be used instead.Other information:
This follows what Mastodon does: it looks up the stored key with its account first, fetches only on a miss, and rejects an activity whose
actoris not the key's account (different_actor?). I checked Mastodon's FeatureRequest and QuoteRequest: both are signed with the requesting account's own#main-key, so they still pass.Same-host activities signed with another actor's key (for example a server or instance actor) are now rejected, as Mastodon does. Same-host key aliases keep working, because the owner is compared, not the keyId string.
I could not test this live: my local site cannot be reached from outside, so tags.pub and mastodon.social reject its signed fetches. I checked the documents by hand: tags.pub serves a standalone
CryptographicKeywithownerset to the actor, and a Mastodon#main-keyresolves to the actor document. Both give the actor as owner.Testing instructions:
vendor/bin/phpunit --filter 'test_verify_key_id|test_get_public_key_sets_owner|test_get_public_key_rejects_a_key_id_without_host|redirected_signing_key'.Changelog entry
Changelog Entry Details
Significance
Type
Message