Skip to content

HanlynnKe/reqpatch

Repository files navigation

ReqPatch icon

ReqPatch

Patch requests. Switch lanes. Test faster.

English · 中文

ReqPatch is an open-source Chrome extension for modifying request headers, response headers, Cookie headers, redirects, and Content-Security-Policy during development and multi-lane testing.

ReqPatch 是一款开源 Chrome 扩展,用于在开发和多泳道测试中修改请求头、响应头、Cookie Header、重定向与 Content-Security-Policy。

ReqPatch is an independent project. It is not affiliated with or endorsed by ModHeader or Open ModHeader.

ReqPatch profile editor

English

Features

  • Multiple profiles with create, switch, rename, duplicate, delete, and reorder actions.
  • One active profile at a time, plus global, section, and individual rule switches.
  • Request and response header rules with Set and Remove operations.
  • Cookie Header modification without reading or writing Chrome's cookie database.
  • URL redirects using wildcard URL patterns and absolute destinations.
  • Content-Security-Policy directives compiled into a response header.
  • Optional profile filters for URL patterns, URL regexes, resource types, HTTP methods, and tabs.
  • Rule comments, duplication, conversion between rule types, search, and per-profile undo.
  • Local-only profile storage and debounced autosave that does not interrupt active text editing.
  • Import and export support for the basic ModHeader v2 headers and respHeaders profile format.
  • No content scripts, analytics, telemetry, remote code, or extension-initiated network requests.

Without filters, enabled rules in the active profile apply to all websites and request types supported by Chrome Declarative Net Request. ReqPatch does not maintain separate HTTP, HTTPS, WS, or WSS configurations.

Install from source

  1. Download or clone this repository.
  2. Open chrome://extensions in Chrome.
  3. Enable Developer mode.
  4. Select Load unpacked.
  5. Choose the repository directory containing manifest.json.

After updating the source, select Reload on the ReqPatch extension card.

Usage

  1. Create or select a profile.
  2. Select Patch, then choose Request headers, Response headers, Cookies, URL redirects, or Content-Security-Policy.
  3. Enter the rule name and value, then enable the rule.
  4. Add a Filter only when you need to limit the profile to specific requests.
  5. Use the rule menu to add a comment, duplicate the rule, or convert it to another type.

Header values are intentionally displayed as plain text because ReqPatch is designed for controlled development and testing environments.

Permissions and privacy

ReqPatch requests only:

  • storage — stores profiles, filters, rules, comments, and values in chrome.storage.local.
  • declarativeNetRequest — asks Chrome to apply the rules without reading network traffic in extension code.
  • <all_urls> — allows user-authored rules to work on any website and supported request type.

ReqPatch does not transmit configuration data to the developer or any third party. See the full Privacy Policy and Security Model.

Import and export

ReqPatch can import the basic ModHeader v2 headers and respHeaders profile format. Exported profiles preserve the compatible base fields and include ReqPatch-specific data for complete ReqPatch round trips.

Cookies, redirects, CSP, filters, comments, and other extended fields may not be preserved by other extensions.

Development

ReqPatch requires Node.js 20 or later. It has no third-party runtime or development dependencies.

npm run check

This command validates source syntax, runs the automated test suite, and checks the exact dimensions of every Chrome Web Store image asset.

Create the Chrome Web Store ZIP:

npm run package

Security

Do not include production credentials in public issues. Security reports should contain a minimal reproduction, the affected version, and the expected behavior. See SECURITY.md for trust boundaries and release checks.

License and attribution

ReqPatch is released under the MIT License. Third-party licenses and Open ModHeader attribution are listed in THIRD_PARTY_NOTICES.md.

中文

功能

  • 多 Profile:支持新建、切换、重命名、复制、删除与排序。
  • 任一时刻仅当前 Profile 生效,并提供全局、Section 和单条规则开关。
  • Request headers 与 Response headers 支持 SetRemove
  • 通过 DNR 修改请求中的 Cookie Header,不读取或写入 Chrome Cookie 数据库。
  • 按 URL pattern 重定向到指定的绝对 URL。
  • 将 CSP directive/value 组合为响应的 Content-Security-Policy Header。
  • 可选 Profile Filter:URL pattern、URL regex、resource type、HTTP method 与 tab。
  • 支持规则 Comment、复制、类型转换、搜索与按 Profile 撤销。
  • 配置仅保存在本地;自动保存采用防抖处理,不会打断正在进行的文本输入。
  • 兼容导入和导出 ModHeader v2 基础 headers / respHeaders Profile 格式。
  • 不包含内容脚本、分析、遥测、远程代码或插件主动发起的网络请求。

没有 Filter 时,当前 Profile 中启用的规则会作用于全部网站和 Chrome Declarative Net Request 支持的请求类型。ReqPatch 不为 HTTP、HTTPS、WS 或 WSS 维护不同配置。

从源码安装

  1. 下载或克隆本仓库。
  2. 在 Chrome 中打开 chrome://extensions
  3. 启用右上角的“开发者模式”。
  4. 点击“加载已解压的扩展程序”。
  5. 选择包含 manifest.json 的仓库目录。

更新源码后,在 ReqPatch 扩展卡片上点击“重新加载”。

使用

  1. 新建或选择一个 Profile。
  2. 点击 Patch,选择 Request headers、Response headers、Cookies、URL redirects 或 Content-Security-Policy。
  3. 填写规则名称和值,并启用规则。
  4. 默认规则作用于全部网站;只有需要缩小范围时才添加 Filter
  5. 使用规则菜单添加 Comment、复制规则或转换规则类型。

ReqPatch 面向受控的开发和测试环境,因此 Header 值会直接以明文显示。

权限与隐私

ReqPatch 只申请以下权限:

  • storage:在 chrome.storage.local 中保存 Profile、Filter、规则、Comment 与值。
  • declarativeNetRequest:由 Chrome 应用规则,扩展代码不读取网络流量。
  • <all_urls>:允许用户创建的规则作用于任意网站和受支持的请求类型。

ReqPatch 不会把配置数据传输给开发者或任何第三方。详细说明见隐私政策安全模型

导入与导出

ReqPatch 可导入 ModHeader v2 基础 headers / respHeaders Profile 格式。导出文件会保留兼容字段,并附带 ReqPatch 扩展数据,以支持 ReqPatch 内的完整往返。

Cookie、redirect、CSP、Filter、Comment 等扩展字段不保证能被其他插件完整保留。

开发与打包

需要 Node.js 20 或以上版本,不需要安装第三方运行时或开发依赖。

npm run check

该命令会检查源码语法、运行自动化测试,并验证全部 Chrome Web Store 图片素材的精确尺寸。

创建 Chrome Web Store 发布 ZIP:

npm run package

安全

请勿在公开 Issue 中提交生产凭据。漏洞报告应包含最小复现、受影响版本与预期行为。信任边界和发布检查见 SECURITY.md

许可证与署名

ReqPatch 使用 MIT License。第三方许可证与 Open ModHeader 署名见 THIRD_PARTY_NOTICES.md

About

Developer-friendly Chrome request and response rule manager for headers, cookies, redirects, CSP, and multi-lane testing.

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors