跳到正文
Skillpedia
安全75k · #2977

permissions-policy

它能做什么

这个技能检查网站发送的安全响应头,并添加 Permissions-Policy 响应头来限制强大的浏览器功能。它面向希望为网络应用多加一层保护的开发者。

适用场景

  • ✓你请智能体检查网站安全响应头的时候。
  • ✓你的网站不使用摄像头或地理位置等功能,并希望默认阻止它们的时候。
  • ✓你在加固网络应用,并希望减少注入攻击成功后攻击者可访问的范围的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/permissions-policy/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/permissions-policy/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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-Policy to 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2977
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能