`Utils::validateHmac` fails if the query params contains non url-safe characters.
評価
- 難易度
- 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
- 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. - When the autorization request is accepted, the user is redirected to your
redirect_uriwith the resulting query parameters. Save those for next step - use
Utils::validateHmacto validate the callback. It will fail if thestateindeed 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 はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
backend bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
smarty-php/smarty#1215 ·