Skip to content

Commit 5fbf931

Browse files
committed
sanitize user_login
1 parent 8a74aa5 commit 5fbf931

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ActivityPub #
2-
**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/)
2+
**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/), [cavalierlife](https://profiles.wordpress.org/cavalierlife/)
33
**Tags:** OStatus, fediverse, activitypub, activitystream
44
**Requires at least:** 4.7
55
**Tested up to:** 6.3

includes/class-signature.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,19 @@ protected static function generate_key_pair_for( $user_id ) {
121121
}
122122

123123
/**
124-
* Undocumented function
124+
* Return the option key for a given user.
125125
*
126-
* @param [type] $user_id
127-
* @return void
126+
* @param int $user_id The WordPress User ID.
127+
*
128+
* @return string The option key.
128129
*/
129130
protected static function get_signature_options_key_for( $user_id ) {
130131
$id = $user_id;
131132

132133
if ( $user_id > 0 ) {
133134
$user = \get_userdata( $user_id );
134-
$id = $user->user_login;
135+
// sanatize username because it could include spaces and special chars
136+
$id = sanitize_title( $user->user_login );
135137
}
136138

137139
return 'activitypub_keypair_for_' . $id;

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== ActivityPub ===
2-
Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nuriapena
2+
Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nuriapena, cavalierlife
33
Tags: OStatus, fediverse, activitypub, activitystream
44
Requires at least: 4.7
55
Tested up to: 6.3

0 commit comments

Comments
 (0)