Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/changelog/2859-from-description
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Enable RFC 9421 HTTP Message Signatures by default.
2 changes: 1 addition & 1 deletion includes/class-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public static function register_settings() {
array(
'type' => 'boolean',
'description' => 'Use RFC-9421 signature.',
'default' => false,
'default' => true,
)
);

Expand Down
2 changes: 1 addition & 1 deletion includes/class-signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function sign_request( $args, $url ) {
return $args;
}

if ( '1' === \get_option( 'activitypub_rfc9421_signature' ) && self::could_support_rfc9421( $url ) ) {
if ( '1' === \get_option( 'activitypub_rfc9421_signature', '1' ) && self::could_support_rfc9421( $url ) ) {
$signature = new Http_Message_Signature();
} else {
$signature = new Http_Signature_Draft();
Expand Down
2 changes: 1 addition & 1 deletion includes/wp-admin/class-advanced-settings-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static function render_authorized_fetch_field() {
* Render RFC-9421 signature field.
*/
public static function render_rfc9421_signature_field() {
$value = \get_option( 'activitypub_rfc9421_signature', '0' );
$value = \get_option( 'activitypub_rfc9421_signature', '1' );
?>
<p>
<label>
Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/tests/includes/class-test-signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ public function test_unsupported_ec_curve_for_hs2019() {
* @covers ::verify_http_signature
*/
public function test_verify_http_signature_with_digest() {
// Ensure Draft Cavage signature is used for this test.
\update_option( 'activitypub_rfc9421_signature', '0' );

// Create a user and get their keypair.
$keys = Actors::get_keypair( 1 );

Expand Down Expand Up @@ -352,6 +355,7 @@ public function test_verify_http_signature_with_digest() {
$this->assertTrue( Signature::verify_http_signature( $request ) );

\remove_filter( 'activitypub_pre_http_get_remote_object', $mock_remote_key_retrieval );
\delete_option( 'activitypub_rfc9421_signature' );
}

/**
Expand Down