fix(security): guard plugin modelPatterns with compileSafeRegex · openclaw/openclaw@117e082
SebTardif
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1705,6 +1705,24 @@ describe("resolvePluginProviders", () => {
|
1705 | 1705 | expectModelOwningPluginIds("gpt-5.4", ["workspace-openai"]); |
1706 | 1706 | }); |
1707 | 1707 | |
| 1708 | +it("rejects ReDoS modelPatterns via compileSafeRegex guard", () => { |
| 1709 | +setManifestPlugins([ |
| 1710 | +createManifestProviderPlugin({ |
| 1711 | +id: "malicious", |
| 1712 | +providerIds: ["malicious"], |
| 1713 | +modelSupport: { |
| 1714 | +modelPatterns: ["(a+)+$"], |
| 1715 | +}, |
| 1716 | +}), |
| 1717 | +]); |
| 1718 | + |
| 1719 | +// Without the guard, this input causes catastrophic backtracking. |
| 1720 | +// With compileSafeRegex, the pattern is rejected and the plugin is not matched. |
| 1721 | +const start = performance.now(); |
| 1722 | +expectModelOwningPluginIds("a".repeat(30) + "!", undefined); |
| 1723 | +expect(performance.now() - start).toBeLessThan(50); |
| 1724 | +}); |
| 1725 | + |
1708 | 1726 | it("preserves LM Studio @iq* quant suffixes when resolving model-owned provider plugins", () => { |
1709 | 1727 | setManifestPlugins([ |
1710 | 1728 | createManifestProviderPlugin({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。