Default cookie setter in OAuth is not setting samesite = None
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- php
调研方向
检查 src/Auth/OAuth.php 第 351 行附近设置 OAuth cookie 的位置,并审查嵌入式 Shopify 管理后台流程中涉及的 cookie 行为。使用 iframe 复现 online-mode 下的令牌交换,或者在 repository 提供测试的情况下添加一个有针对性的测试;当 cookies 被保存且 OAuth 在 Shopify 管理后台中成功时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Issue summary
The samesite parameter is being ommited from setcookie function in OAuth2 process: https://github.com/Shopify/shopify-api-php/blob/main/src/Auth/OAuth.php#L351, causing the default Lax mode to be selected.
This causes "Perform Token Exchange" step in https://shopify.dev/docs/apps/build/authentication-authorization/session-tokens#request-flow-using-a-session-token to fail when embedded page is loaded through an iframe (for example from Shopify admin panel), because the cookies will not be saved.
Expected behavior
The cookies should be set and OAuth should succeed in Shopify admin panel.
Actual behavior
The cookies are not set and OAuth fails in Shopify admin panel.
Steps to reproduce the problem
- Implement minimal application implementing Shopify's OAuth2 authentication (online mode = true), using this library, with default cookie setter.
- Install application into any Shopify store.
- Delete the initial customer's session. (Simulating different admin user or expired session).
- Try to perform "Token Exchange" from Shopify admin panel.
Reduced test case
Checklist
- I have described this issue in a way that is actionable (if possible)
- I have created a merge request fixing this issue.
- 主要语言
- PHP
- 星标
- 473
- 派生
- 193
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
难度 2/5 1-3 小时 新手友好度 76/100
dependabot/dependabot-core#16547 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
glpi-project/glpi#25922 ·
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/safe-publish#726 ·
维护者通常 1 天内回复
-
[Translation][TwigBridge][TwigBundle] Add `HtmlTranslator` and the `tra…可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Translation TwigBridge
难度 2/5 1-3 小时 新手友好度 68/100
symfony/symfony-docs#23308 ·
维护者通常 3 天内回复