Open
Conversation
新增 CSP (Content-Security-Policy) 规则管理模块,支持移除或修改网页 CSP 头。 功能特性: - 全局开关:一键移除所有网页 CSP 头,无需配置规则 - 规则管理:创建/编辑/删除/启用/禁用 CSP 规则 - 匹配模式:支持精确匹配、通配符、正则表达式、域名匹配四种模式 - 模式匹配引擎:参考 wproxy/whistle 规范实现 - *.domain 单级子域 / **.domain 多级子域 / ***.domain 根域+多级子域 - ^ 前缀路径通配符:* 单级 / ** 多级 / *** 任意字符 - 协议通配符 http*:// / 混合通配符 test.abc**.com - 模式测试:Drawer 内置测试工具,实时验证匹配结果 - 帮助文档:右侧 Drawer 展示匹配模式指南 - 优先级自动递增:创建/更新时自动避免 priority 冲突 技术实现: - 基于 chrome.declarativeNetRequest API 拦截并修改响应头 - Service/Client/Repo 三层架构,直接回调模式确保 DNR 规则实时更新 - chrome.storage.local 持久化配置和规则数据 - 63 个单元测试覆盖所有匹配模式 新增文件: - src/app/repo/cspRule.ts (数据层) - src/app/service/service_worker/cspRule.ts (服务层) - src/app/service/service_worker/cspInterceptor.ts (拦截器) - src/pages/options/routes/CSPRule/index.tsx (UI 页面) - src/pkg/utils/patternMatcher.ts (匹配引擎) - tests/pkg/utils/patternMatcher.test.ts (单元测试)
Member
|
级别提这么高吗?我觉得做在设置中就差不多了 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新增 CSP (Content-Security-Policy) 规则管理模块,支持移除或修改网页 CSP 头。
功能特性:
技术实现:
新增文件:
Checklist / 检查清单
Description / 描述
Screenshots / 截图
成功截图

测试代码
历史讨论:#1264