Basic auth returns 403 when username & password supplied but not needed.

Created on 25 December 2016, almost 8 years ago
Updated 6 September 2024, 4 months ago

See Drupal\basic_auth\Authentication\Provider

  public function applies(Request $request) {
    $username = $request->headers->get('PHP_AUTH_USER');
    $password = $request->headers->get('PHP_AUTH_PW');
    return isset($username) && isset($password);
  }

This means that basic auth applies whenever the user submits a username and password. However my route has _access = TRUE and I've spent a long time wondering why that was overridden and I was still getting a 403.
Sure basic auth should apply according to some route parameter, not according to what the user does?

Steps to reproduce

This is attempting to recreate the problem with a re-world scenario.

  1. Basic auth is on
  2. Site is pre-prod, shield (contrib) is also on
  3. End user has been asked for shield creds, cached in browser
  4. Go live, shield removed
  5. Requests still send auth headers
  6. End user gets 403 everywhere

If you uninstall basic_auth OR use private window the problem goes away. Or clear enough browser history/credentials...

Remaining tasks

PHP unit test case fail needs to be fix.

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Basic authย  โ†’

Last updated 3 months ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024