Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

`Utils::validateHmac` fails if the query params contains non url-safe characters.

Geschlossen
#412 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

@brutal-factories arbeitet bereits daran.

Seit 02.5.2025.

  • #413 von @brutal-factories — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
php

Rechercherichtung

Beginne bei Utils::validateHmac und reproduziere den OAuth-Callback mit einem state, der codierte Zeichen wie Base64 oder JSON enthält. Verfolge, wie die Query-Parameter des Callbacks vor der HMAC-Validierung verarbeitet werden; abgeschlossen ist die Aufgabe, wenn die Validierung für eine korrekt signierte URL, die diese Zeichen enthält, true zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Issue summary

Utils::validateHmac fails if the query params contains non url-safe characters. For example, for a oauth authorization callback, if the state is a base64-encoded string, the trailing = character will make the HMAC validation fail. After talking with the Shopify support, I was told that the HMAC sent from Shopify is computed based on the original query params, instead of the URL-encoded version.

Expected behavior

HMAC validation should still work if the HMAC comes for a URL containing encoded characters

Actual behavior

Utils::validateHmac returns false, even if I can manually confirm that the HMAC is correct

Steps to reproduce the problem

  1. Initiate an OAuth autorization request. For the state, use non url-safe characters (i.e. JSON, Base64, or colons :). In my case, I use an app I'm developping, and requesting access for that app to a test shop.
  2. When the autorization request is accepted, the user is redirected to your redirect_uri with the resulting query parameters. Save those for next step
  3. use Utils::validateHmac to validate the callback. It will fail if the state indeed contains encoded characters.

Reduced test case

The best way to get your bug fixed is to provide a reduced test case.


Checklist

  • I have described this issue in a way that is actionable (if possible)
Vorherrschende Sprache
PHP
Sterne
473
Forks
193
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.