Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ
#412 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

@brutal-factories がすでに取り組んでいます。

2025年5月2日 から。

  • #413 @brutal-factories による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php

調査の方向性

Utils::validateHmac から始め、Base64 や JSON のようなエンコードされた文字を含む state で OAuth コールバックを再現します。HMAC 検証の前にコールバックのクエリパラメータがどのように処理されるかを追跡します。これらの文字を含む正しく署名された URL に対して検証が true を返せば完了です。

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
PHP
スター
473
フォーク
193
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。