permissions-policy
它能做什么
这个技能检查网站发送的安全响应头,并添加 Permissions-Policy 响应头来限制强大的浏览器功能。它面向希望为网络应用多加一层保护的开发者。
适用场景
- ✓你请智能体检查网站安全响应头的时候。
- ✓你的网站不使用摄像头或地理位置等功能,并希望默认阻止它们的时候。
- ✓你在加固网络应用,并希望减少注入攻击成功后攻击者可访问的范围的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/permissions-policy/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查网站的安全响应头,并添加一个关闭我未使用功能的 Permissions-Policy 吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查是否已发送 Permissions-Policy 响应头,以及允许哪些强大功能。然后它会添加一个拒绝未使用功能的响应头,例如摄像头、麦克风和地理位置,并且只为应用需要的功能扩展列表。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Set a Permissions-Policy header
A site compromised by XSS that has unrestricted camera and microphone access can silently record the user. Permissions-Policy limits which browser APIs are available, reducing attacker capabilities even after a successful injection.
Quick Reference
- Use
Permissions-Policyto disable browser features your site does not use (camera, microphone, geolocation, payment) - Syntax:
Permissions-Policy: camera=(), microphone=(), geolocation=()— empty()means denied to all - Previously called
Feature-Policy— the old syntax is deprecated and only supported in older browsers - Restricting unused features limits the blast radius if your site is compromised by XSS
- Third-party iframes inherit page restrictions unless you explicitly grant them permissions
Check
Check whether the server sends a Permissions-Policy header and review which browser features are allowed or denied. Identify any powerful features (camera, microphone, geolocation, payment, USB) that are enabled but not required by the application.
Fix
Add a Permissions-Policy header that disables all browser features your site does not use. Start with camera=(), microphone=(), geolocation=() and expand the list based on what the application actually needs.
Explain
Explain what the Permissions-Policy header does, how it restricts browser APIs like camera and geolocation, and why disabling unused features improves security.
Code Review
Review server config, headers, forms, and integration points related to Set a Permissions-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/permissions-policy
常见问题
一对空括号是什么意思?
这个技能说,像 camera=() 这样的空括号表示对所有网站拒绝该功能。
Feature-Policy 还在使用吗?
这个技能说,它是旧的、已弃用的名称,只在较旧的浏览器中受支持。
第三方 iframe 会获得这些权限吗?
除非网站明确授予权限,它们会继承页面的限制。
详情
作者的原始描述
Use when reviewing HTTP response headers for defense-in-depth security hardening on any web application.
热度
- GitHub 星标
- 75k
- 排名
- #2977
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。