Regex Safety Audit

io.github.tylerscomic-lab由 GitHub 帳號 tylerscomic-lab 發布v1.0.0更新於 Oct 24, 2026

Detects catastrophic-backtracking (ReDoS) regex risk via AST parsing, with JS-safe rewrites.

發布方自己的服務:audit.domains - Domain Valuation

已驗證Streamable HTTP可網頁執行開發者工具安全與監控

概覽

AI 產生的概覽

透過 AST 解析稽核正規表達式的災難性回溯(ReDoS)風險,並提供 JavaScript 安全的重寫建議。

可以做什麼
將正規表達式解析為手寫 AST,在不執行模式本身的情況下偵測災難性回溯(ReDoS)風險。可辨識嵌套無界量詞、重複群組內的歧義選擇以及反向引用。analyze_redos_risk 傳回風險等級、附原因的各項發現以及 JavaScript 相關注意事項;generate_attack_string 產生候選概念驗證輸入與帶硬性子程序逾時的 Node 程式碼片段;suggest_safe_rewrite 提供具體的 JS 安全重寫,或在無法機械修復時如實說明。
適用情境
適合在審查或強化 JavaScript 程式碼中的正規表達式時使用,尤其是希望進行結構化 ReDoS 偵測而非字串啟發式判斷的情境。適用於安全審查、程式碼稽核,以及需要為被標記的模式提供安全重寫或有界概念驗證測試的流程。若只需測試模式是否相符,則不太適用。
執行需求
遠端 streamable HTTP 端點 OAuth 身分驗證。未宣告任何套件、環境變數或標頭。README 說明也可透過 npm install 與 node server.js 自行託管,這需要 Node.js。
安裝前請注意
託管端點需要 OAuth 身分驗證。README 提到有免費方案以及每月 7 美元的 Pro 方案,可能涉及付費使用。generate_attack_string 會產生概念驗證輸入與一段 Node 程式碼片段,供在本機執行;針對真正災難性的模式執行正是硬性子程序逾時所要控制的場景,因此請謹慎處理產生的程式碼片段。未宣告任何密鑰或環境變數。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Regex Safety Audit,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.tylerscomic-lab%2Fregex-safety-audit-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。

{
  "mcpServers": {
    "regex-safety-audit": {
      "type": "http",
      "url": "https://regex-safety-audit-mcp.mcpize.run/mcp"
    }
  }
}

README

regex-safety-audit-mcp

[License: MIT] [Live on MCPize]

An MCP server that parses a regex into a real hand-written AST to detect catastrophic-backtracking (ReDoS) risk — without ever executing the pattern itself. A ReDoS scanner that runs the regex it's scanning would be able to hang itself; this one never calls new RegExp(...).test() on anything.

What it catches

Nested unbounded quantifiers ((a+)+), ambiguous alternation inside a repeated group ((a|ab)+), and backreferences — the three shapes behind almost every real-world ReDoS incident. Detection is structural (a real parser, not regex-on-regex string heuristics), verified against the canonical literature examples during testing.

The JS-specific trap

Generic ReDoS advice tells you to wrap the offending group in an atomic group or use a possessive quantifier. JavaScript has neither. analyze_redos_risk says so explicitly, and suggest_safe_rewrite gives the actual JS-safe fix (collapsing redundant nesting, or restructuring with a negated character class) instead of advice that would 400 as a syntax error if you tried it.

Tools

analyze_redos_risk

Full structural analysis. Returns a risk level, every finding with its exact reason, and the JS atomic-group/ possessive-quantifier caveat.

generate_attack_string

For a flagged pattern, generates candidate proof-of-concept inputs at a few sizes, plus a ready-to-run Node snippet that times the match with a hard OS-level subprocess timeout — so testing a genuinely catastrophic regex can't hang your own test process either.

suggest_safe_rewrite

Concrete rewritten pattern for the mechanically-fixable shapes; honest "no mechanical fix, here's what to change by hand" for the ones that aren't.

Use it

Hosted (recommended): MCPize — free tier, $7/mo Pro.

Self-host:

bash
npm installnode server.js

Part of a small suite

mcp-schema-audit-mcp, cron-schedule-audit-mcp, claude-cost-audit-mcp.

License

MIT

來源:README.md,提交 12fa26e

工具

0
該伺服器需要登入,因此 SourceWeft 無法在沒有帳號的情況下讀取其工具,也未收錄。已連接帳號所能看到的內容可能因帳號及其權限而異。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 85%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Audit 整合