Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

use the shared escapeRegExp in the hidden-markup rule instead of re-inlining it

[._.]/ Adam Eivy2b02996101e0
diff --git a/server/lib/modelAbuseGuard.js b/server/lib/modelAbuseGuard.js
index dc489b6ed9..e5a9594e48 100644
--- a/server/lib/modelAbuseGuard.js
+++ b/server/lib/modelAbuseGuard.js
@@ -1,4 +1,5 @@
import { createHash } from 'node:crypto';
+import { escapeRegExp } from './textUtils.js';
/**
* Static contract for PortOS's model-abuse boundary.
@@ -544,7 +545,7 @@ function hasHiddenMarkupInstruction(value) {
const rest = value.slice(match.index + match[0].length, match.index + match[0].length + 4000);
// Escape the tag name: it reaches a regex, and a namespaced JSX name
// (`item.icon`) carries a metacharacter.
- const tagName = match[1].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ const tagName = escapeRegExp(match[1]);
const close = rest.match(new RegExp(`^([\\s\\S]*?)</${tagName}\\s*>`, 'i'));
// No close tag in range: scan the whole window. Stopping at the first `<`
// would be a bypass of its own — `<div hidden><p>payload</p>` truncates to