Skip to content

Revert "Always remove filter maybe_double_knock http_response fil… #1991

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

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

pfefferle
Copy link
Member

…ter! (#1986)"

This reverts commit 4d14174.

Fixes #

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 13:05
@pfefferle pfefferle self-assigned this Jul 23, 2025
@pfefferle pfefferle requested review from obenland and removed request for Copilot July 23, 2025 13:05
@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Jul 23, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reverts a previous commit that modified the placement of a filter removal in the maybe_double_knock method. The change moves the remove_filter call from the beginning of the method (after the early return check) back to its original position before the early return check.

  • Restores the original filter removal timing in the HTTP signature handling logic

Comment on lines 88 to +95
// Bail if there's nothing to sign with. It's likely an unrelated request getting processed first.
if ( ! isset( $args['key_id'], $args['private_key'], $args['headers']['Date'] ) ) {
return $response;
}

// Remove this filter to prevent infinite recursion.
\remove_filter( 'http_response', array( self::class, 'maybe_double_knock' ) );

Copy link
Preview

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the filter removal after the early return check creates a potential issue. If the method returns early due to missing required parameters (line 90), the filter will never be removed, which could lead to the filter remaining active when it shouldn't be. The filter should be removed immediately at the start of the method to ensure it's always cleaned up regardless of execution path.

Suggested change
// Bail if there's nothing to sign with. It's likely an unrelated request getting processed first.
if ( ! isset( $args['key_id'], $args['private_key'], $args['headers']['Date'] ) ) {
return $response;
}
// Remove this filter to prevent infinite recursion.
\remove_filter( 'http_response', array( self::class, 'maybe_double_knock' ) );
// Remove this filter to prevent infinite recursion.
\remove_filter( 'http_response', array( self::class, 'maybe_double_knock' ) );
// Bail if there's nothing to sign with. It's likely an unrelated request getting processed first.
if ( ! isset( $args['key_id'], $args['private_key'], $args['headers']['Date'] ) ) {
return $response;
}

Copilot uses AI. Check for mistakes.

@pfefferle pfefferle merged commit 8818868 into trunk Jul 23, 2025
12 of 13 checks passed
@pfefferle pfefferle deleted the revert/1986 branch July 23, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. [Type] Revert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants