Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

已关闭
#412 3 条评论 0 个 reaction 已指派 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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。