Problem

hash verification uses the server-host variable instead of the drupal-base url

Steps to reproduce

see

  public function verifyHash(string $providedHash, int $timestamp, ?string $productionHost = NULL): bool {
...
    // Use $_SERVER['HTTP_HOST'] if production host not provided.
    $host = $productionHost ?? $_SERVER['HTTP_HOST'];
    $expectedHash = $this->generateVerificationHash($host, $timestamp);
    return hash_equals($expectedHash, $providedHash);
  }

Proposed resolution

use the same production host as used in the UI when determining whether the current environment is prod - that works!

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review

the logic has been updated as proposed + test coverage is extended to verify this case works now. Furthermore existing tests were adapted as need to keep them passing by using the right production-url.

arthur_lorenz’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

  • fago committed 58408d74 on 1.x
    Issue #3536058 by fago: Hash verification fails when CDN is used
    
fago’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.