referrer-policy
它能做什么
这个技能检查网站发送的响应头,并设置 Referrer-Policy,限制与其他网站共享的地址信息。它面向希望保护敏感链接和令牌的开发者。
适用场景
- ✓你请智能体检查网站安全响应头的时候。
- ✓你的页面网址中包含私密令牌或 ID,而你想防止它们泄露的时候。
- ✓你在加固处理登录或会话的应用的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/referrer-policy/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的密码重置链接中带有令牌。请帮我确保访客点击链接时,这些令牌不会泄露给其他网站吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查是否已发送 Referrer-Policy 响应头,并将其设为推荐的默认值 strict-origin-when-cross-origin。对于特别敏感的地址页面,它会建议更严格的设置。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Set a Referrer-Policy header
Without a Referrer-Policy, a password reset link like https://example.com/reset?token=abc123 is included in the Referer header when the user clicks an external link on that page — leaking the token to third parties.
Quick Reference
- Use
Referrer-Policy: strict-origin-when-cross-origin— the recommended modern default strict-origin-when-cross-originsends the full URL for same-origin requests, only the origin for cross-origin HTTPS, and nothing for HTTPS→HTTP- Never use
unsafe-url— it sends the full URL including path and query string to every external site - Can be set via HTTP header,
<meta>tag, or thereferrerpolicyattribute on individual<a>and<img>elements - Sensitive URLs (reset tokens, private IDs) in query strings can be exposed via the Referer header if policy is too permissive
Check
Check whether the server sends a Referrer-Policy header and verify the value is appropriate. The recommended value is strict-origin-when-cross-origin. Check for any pages with sensitive URL parameters that could be leaked via the Referer header.
Fix
Add Referrer-Policy: strict-origin-when-cross-origin to all HTTP responses. Configure it in your web server, CDN, or application framework. For pages with particularly sensitive URLs, consider no-referrer or same-origin.
Explain
Explain what the Referer header contains, how a permissive Referrer-Policy can leak sensitive URL parameters to third parties, and what the difference is between the various Referrer-Policy values.
Code Review
Review server config, headers, forms, and integration points related to Set a Referrer-Policy header. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/security/referrer-policy
常见问题
strict-origin-when-cross-origin 有什么作用?
它会把完整地址发送给你自己的网站,对其他 HTTPS 网站只发送网站名称,而从 HTTPS 切换到 HTTP 时则不发送任何内容。
为什么应该避免 unsafe-url?
这个技能说,它会把包括路径和查询参数在内的完整地址发送给每个外部网站。
这个策略还能在哪里设置?
这个技能说,也可以通过 meta 标签设置,或针对单个链接和图片设置。
详情
作者的原始描述
Use when reviewing HTTP response headers for privacy hardening on any website that handles authentication, session state, or sensitive URL parameters.
热度
- GitHub 星标
- 75k
- 排名
- #2993
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。