GitHub 将从 2027 年 2 月 1 日起拒绝含 URL 片段的 OAuth 重定向 URI
GitHub 将自 2027 年 2 月 1 日起拒绝重定向 URI 中包含 URL 片段(即 # 之后的部分)的 OAuth 授权请求。该变更适用于 github.com 上的 OAuth 应用和 GitHub Apps,不影响 GitHub Enterprise Server 实例。
其依据是 OAuth 2.0 规范中重定向 URI 并不包含片段,而片段出现在重定向目标中可能被用来拦截授权码或访问令牌。通过拒绝携带片段的请求,GitHub 能在授权流程完成之前消除一类基于重定向的令牌泄露风险场景。
集成 GitHub 登录的开发者应检查 OAuth 应用与 GitHub App 设置中已登记的重定向 URI,移除其中的片段部分,并在 2027 年截止日期前验证清理后的 URI 回调处理正常。运行 GHES 的团队不受该策略影响。
GitHub to Reject OAuth Redirect URIs Containing URL Fragments Starting Feb 1, 2027
GitHub will begin rejecting OAuth authorization requests whose redirect URI includes a URL fragment (the portion after a # character), effective February 1, 2027. The change applies to both OAuth apps and GitHub Apps on github.com, and does not affect GitHub Enterprise Server instances.
The rationale is that fragments are not part of the OAuth 2.0 specification for redirect URIs, and their presence in a redirect target can be used to intercept an authorization code or access token. By refusing requests that carry fragments, GitHub removes a class of redirect-based token leakage scenarios before authorization ever completes.
Developers integrating GitHub sign-in should audit registered redirect URIs in their OAuth app and GitHub App settings and drop any fragment components, then verify callback handling works with the cleaned-up URI before the 2027 deadline. Teams running GHES are unaffected by this specific policy.
猎鹰不保存原文正文。标题与摘要用于快速发现信息,事实细节请以来源原文为准。