Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Refactor safeNext function to use Unicode control character range for validation

nirholas851dc8325496
diff --git a/public/login.html b/public/login.html
index 89129d0b3..dbfef4089 100644
--- a/public/login.html
+++ b/public/login.html
@@ -972,7 +972,7 @@ function safeNext(raw, fallback = '/dashboard') {
if (raw.includes('\\')) return fallback;
// Control characters can smuggle a scheme past naive prefix checks.
// eslint-disable-next-line no-control-regex
- if (/[ -]/.test(raw)) return fallback;
+ if (/[\u0000-\u001f]/.test(raw)) return fallback;
return raw;
}
const next = safeNext(
diff --git a/public/paywall.js b/public/paywall.js
index f70448129..39ec7f85d 100644
--- a/public/paywall.js
+++ b/public/paywall.js
@@ -36,7 +36,7 @@
function safeNavUrl(raw, fallback = '/') {
if (typeof raw !== 'string' || raw.length === 0) return fallback;
// eslint-disable-next-line no-control-regex
- if (raw.includes('\\') || /[ -]/.test(raw)) return fallback;
+ if (raw.includes('\\') || /[\u0000-\u001f]/.test(raw)) return fallback;
// Same-origin relative path.
if (raw.startsWith('/') && !raw.startsWith('//')) return raw;
// Absolute URL: http(s) only, so javascript:/data:/vbscript: can never
diff --git a/public/register.html b/public/register.html
index 73e48d472..67e7668f6 100644
--- a/public/register.html
+++ b/public/register.html
@@ -829,7 +829,7 @@ function safeNext(raw, fallback = '/dashboard') {
if (raw.includes('\\')) return fallback;
// Control characters can smuggle a scheme past naive prefix checks.
// eslint-disable-next-line no-control-regex
- if (/[ -]/.test(raw)) return fallback;
+ if (/[\u0000-\u001f]/.test(raw)) return fallback;
return raw;
}
const next = safeNext(
diff --git a/public/wallet-connect-demo.html b/public/wallet-connect-demo.html
index e679b9bd7..7ff0131d5 100644
--- a/public/wallet-connect-demo.html
+++ b/public/wallet-connect-demo.html
@@ -99,7 +99,7 @@ function safeNext(raw, fallback = '/dashboard') {
if (raw.includes('\\')) return fallback;
// Control characters can smuggle a scheme past naive prefix checks.
// eslint-disable-next-line no-control-regex
- if (/[ -]/.test(raw)) return fallback;
+ if (/[\u0000-\u001f]/.test(raw)) return fallback;
return raw;
}
const next = safeNext(params.get('next'), '/dashboard/');
diff --git a/public/wallet-login.js b/public/wallet-login.js
index 42c20ad10..35c280239 100644
--- a/public/wallet-login.js
+++ b/public/wallet-login.js
@@ -41,7 +41,7 @@ function safeNext(raw, fallback = '/dashboard') {
if (raw.includes('\\')) return fallback;
// Control characters can smuggle a scheme past naive prefix checks.
// eslint-disable-next-line no-control-regex
- if (/[ -]/.test(raw)) return fallback;
+ if (/[\u0000-\u001f]/.test(raw)) return fallback;
return raw;
}
const next = safeNext(window.__loginNext || params.get('next') || sessionStorage.getItem('login_redirect'), '/dashboard');