Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51495 closed defect (bug) (fixed)

The code in mod_rewrite_rules() to write to .htaccess is wrong.

Reported by: nendeb55's profile nendeb55 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: critical Version: 5.6
Component: Rewrite Rules Keywords: has-patch
Focuses: rest-api Cc:

Description (last modified by SergeyBiryukov)

Code in the rewrite_rules function

<?php
$rules .= 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]';

1.There are no newlines, so the next line comes after it.
1.The .* - in is not ^(.*) - in RewriteRule.

Change History (10)

#1 @johnbillion
4 years ago

  • Focuses rest-api added
  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 5.6

Thanks for the report.

This change was introduced in [42790]. @georgestephanis @timothyblynjacobs can you take a look?

Version 0, edited 4 years ago by johnbillion (next)

#2 @johnbillion
4 years ago

  • Keywords needs-patch added; needs-testing removed

#3 @georgestephanis
4 years ago

Thanks for the report! I'll get a pr/patch together this afternoon/evening. Kid wrangling solo atm. :)

This ticket was mentioned in PR #584 on WordPress/wordpress-develop by georgestephanis.


4 years ago
#4

  • Keywords has-patch added; needs-patch removed

I didn't add the suggested parentheses, as I don't believe they are necessary to do the regex capture, and the prior working art for this seemed to run perfectly without them -- https://github.com/WordPress/application-passwords/wiki/Basic-Authorization-Header----Missing

Trac ticket: https://core.trac.wordpress.org/ticket/51495

This ticket was mentioned in Slack in #core-passwords by georgestephanis. View the logs.


4 years ago

#6 @georgestephanis
4 years ago

updated the pr after a minor oops in the first pass, should be a-ok now. :)

I skipped the parentheses as noted in the PR as we're not using them for capture so they shouldn't be needed here.

#7 @SergeyBiryukov
4 years ago

  • Description modified (diff)

#8 @SergeyBiryukov
4 years ago

  • Summary changed from The code in mod_rewrite_rules() to write to .htaccsess is wrong. to The code in mod_rewrite_rules() to write to .htaccess is wrong.

#9 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 49131:

Rewrite Rules: Add missing newline to the HTTP_AUTHORIZATION rewrite rule.

Follow-up to [49109].

Props nendeb55, georgestephanis, johnbillion.
Fixes #51495. See #42790.

TimothyBJacobs commented on PR #584:


4 years ago
#10

Merged in 405a561.

Note: See TracTickets for help on using tickets.