-
Notifications
You must be signed in to change notification settings - Fork 80
Add/User Delete activities #552
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
Changes from 37 commits
bcf29e1
e3a78fb
af3e61c
3785cee
d64ed73
565a6ca
9e8065a
4d83e1a
7543884
05b4ebf
2bfb930
6c548bc
41f05ef
f101daf
87d32cb
06a023e
5090e84
8499aa4
96b29a3
76771aa
fcbfa74
ca3d1bc
e894bc6
1aa30ed
fb0f679
61951f7
4cef50d
6c1fa00
01b4d09
22a664e
aa448d3
f9fee8c
2df226e
d1e0074
bf50942
c781662
39fffc7
7af4eb1
c9477d7
dc88d91
b84286e
0de423a
2f33377
39e6e71
520c3fb
962e6dd
2730907
295d5bc
4fcf151
f319cac
62714a5
84dbdc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,7 +186,14 @@ protected static function check_legacy_key_pair_for( $user_id ) { | |
*/ | ||
public static function generate_signature( $user_id, $http_method, $url, $date, $digest = null ) { | ||
$user = Users::get_by_id( $user_id ); | ||
$key = self::get_private_key_for( $user->get__id() ); | ||
if ( ! is_wp_error( $user ) ) { | ||
$key = self::get_private_key_for( $user->get__id() ); | ||
$key_id = $user->get_url() . '#main-key'; | ||
} else { | ||
$temp_sig_options = get_option( 'activitypub_temp_sig_' . $user_id ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this feels a bit hacky and might break things in the future, if we maybe introduce key rotation: https://swicg.github.io/activitypub-http-signature/#key-rotation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a sig for deletes at all? The remote server is not able to verify it anyways!?! This is very confusing https://swicg.github.io/activitypub-http-signature/#handling-deletes-of-actors There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed it is very hacky! In my previous tests Mastodon ignored actor deletes signed by the instance actor, but I will do some more tests and report back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe we do it as you mentioned it here: #552 (comment)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or we store the complete delete object in the schedule on the delete?!? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The first part is the hack I've implemented, the problem with the second part is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmm, the scheduler runs before signature generation. |
||
$key = $temp_sig_options['private_key']; | ||
$key_id = $temp_sig_options['key_id']; | ||
} | ||
|
||
$url_parts = \wp_parse_url( $url ); | ||
|
||
|
@@ -215,8 +222,6 @@ public static function generate_signature( $user_id, $http_method, $url, $date, | |
\openssl_sign( $signed_string, $signature, $key, \OPENSSL_ALGO_SHA256 ); | ||
$signature = \base64_encode( $signature ); // phpcs:ignore | ||
|
||
$key_id = $user->get_url() . '#main-key'; | ||
|
||
if ( ! empty( $digest ) ) { | ||
return \sprintf( 'keyId="%s",algorithm="rsa-sha256",headers="(request-target) host date digest",signature="%s"', $key_id, $signature ); | ||
} else { | ||
|
Uh oh!
There was an error while loading. Please reload this page.