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.

ci(pages): page-audit workflow + ssrf/rate-limit hardening

nirholas0d0b2a1bf2ea
diff --git a/.github/workflows/page-audit.yml b/.github/workflows/page-audit.yml
new file mode 100644
index 000000000..061fa0f7b
--- /dev/null
+++ b/.github/workflows/page-audit.yml
@@ -0,0 +1,60 @@
+# Full-site page audit — drives a real Chromium across every public route on
+# the Vercel preview deploy and fails the check on any error-severity finding:
+# console errors, uncaught exceptions, failed requests, HTTP >= 500, and broken
+# navigation. This is the automated version of opening the dev console on every
+# page — it stops console/network regressions before they reach production
+# instead of a human finding them later.
+#
+# Mirrors lighthouse.yml: triggered by the Vercel deployment-status event so it
+# tests the actual artifact bound for prod, not a fresh local build. Runs only
+# against preview deploys (never production) so a red gate blocks the PR, not a
+# live site.
+
+name: Page audit
+
+on:
+ deployment_status:
+
+jobs:
+ page-audit:
+ if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment != 'production'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v6
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ cache: npm
+
+ # The audit harness only needs Playwright + its Chromium; install just
+ # that rather than the full workspace to keep the gate fast.
+ - name: Install Playwright
+ run: |
+ npm install --no-save playwright@^1
+ npx playwright install --with-deps chromium
+
+ - name: Audit Vercel preview
+ env:
+ BASE_URL: ${{ github.event.deployment_status.target_url }}
+ # --strict exits 1 on any error-severity finding, failing the check.
+ run: node scripts/page-audit.mjs --strict
+
+ - name: Upload audit report
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: page-audit-report
+ path: reports/page-audit-*.md
+ if-no-files-found: ignore
+
+ - name: Comment result on PR
+ if: always()
+ uses: marocchino/sticky-pull-request-comment@v3
+ continue-on-error: true
+ with:
+ header: page-audit
+ message: |
+ 🖥️ **Page audit** ran against the preview deploy — full console / network / error sweep across every public route.
+ ${{ job.status == 'success' && '✅ No error-severity findings.' || '🔴 Error-severity findings detected — download the `page-audit-report` artifact for the per-page detail.' }}
diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.js
index 726a43e2b..9010af672 100644
--- a/api/_lib/rate-limit.js
+++ b/api/_lib/rate-limit.js
@@ -321,7 +321,8 @@ export const limits = {
// On-chain agent registration (register_agent MCP tool). Each call may mint a
// Core asset + Agent Identity PDA — real SOL spend — so this is deliberately
// tight, keyed per authenticated user.
- agentRegister: (userId) => getLimiter('agent:register', { limit: 12, window: '1 h' }).limit(userId),
+ agentRegister: (userId) =>
+ getLimiter('agent:register', { limit: 12, window: '1 h' }).limit(userId),
read: (ip) => getLimiter('permissions:read', { limit: 300, window: '1 m' }).limit(ip),
permissionsGrant: (userId) =>
getLimiter('permissions:grant', { limit: 10, window: '1 h' }).limit(userId),
diff --git a/api/a-page.js b/api/a-page.js
index 922912f7d..0227782cd 100644
--- a/api/a-page.js
+++ b/api/a-page.js
@@ -189,7 +189,12 @@ ${escapeJsonLd({
'@type': 'BreadcrumbList',
itemListElement: [
{ '@type': 'ListItem', position: 1, name: 'Home', item: 'https://three.ws/' },
- { '@type': 'ListItem', position: 2, name: 'Discover', item: 'https://three.ws/discover' },
+ {
+ '@type': 'ListItem',
+ position: 2,
+ name: 'Discover',
+ item: 'https://three.ws/discover',
+ },
{ '@type': 'ListItem', position: 3, name: p.title, item: p.pageUrl },
],
},
diff --git a/api/img.js b/api/img.js
index 3a4bc0f80..a669c7719 100644
--- a/api/img.js
+++ b/api/img.js
@@ -79,7 +79,10 @@ export default wrap(async function handler(req, res) {
let image = null;
for (const candidate of candidates(target)) {
try {
- const result = await fetchModel(candidate, { maxBytes: MAX_BYTES, timeoutMs: TIMEOUT_MS });
+ const result = await fetchModel(candidate, {
+ maxBytes: MAX_BYTES,
+ timeoutMs: TIMEOUT_MS,
+ });
if (!result.contentType.startsWith('image/')) continue; // HTML error page etc. — try next
image = result;
break;
diff --git a/api/solana-rpc.js b/api/solana-rpc.js
index 901ea69f9..dca7a3a3d 100644
--- a/api/solana-rpc.js
+++ b/api/solana-rpc.js
@@ -20,7 +20,7 @@ import { cors, method, wrap, readJson, error, rateLimited } from './_lib/http.js
import { limits, clientIp } from './_lib/rate-limit.js';
const PUBLIC_MAINNET = 'https://api.mainnet-beta.solana.com';
-const PUBLIC_DEVNET = 'https://api.devnet.solana.com';
+const PUBLIC_DEVNET = 'https://api.devnet.solana.com';
// Methods a browser Connection needs to read balances/accounts, build, simulate,
// send, and confirm transactions. Deliberately excludes getProgramAccounts and
diff --git a/api/watsonx/embed.js b/api/watsonx/embed.js
index 9838ce79c..28f77fdc7 100644
--- a/api/watsonx/embed.js
+++ b/api/watsonx/embed.js
@@ -111,8 +111,12 @@ export default wrap(async function handler(req, res) {
if (!cfg.configured && !openaiReady) {
// No provider at all. No fabricated vectors — tell the client exactly
// what's missing so the UI can render an honest "not configured" state.
- return error(res, 503, 'embed_unconfigured',
- 'No embedding provider is configured. Set WATSONX_API_KEY + WATSONX_PROJECT_ID (IBM Granite) or OPENAI_API_KEY (fallback) to enable embeddings.');
+ return error(
+ res,
+ 503,
+ 'embed_unconfigured',
+ 'No embedding provider is configured. Set WATSONX_API_KEY + WATSONX_PROJECT_ID (IBM Granite) or OPENAI_API_KEY (fallback) to enable embeddings.',
+ );
}
// Provider chain: Granite (primary) → OpenAI (fallback). The first provider
@@ -122,9 +126,10 @@ export default wrap(async function handler(req, res) {
let lastError = null;
if (cfg.configured) {
- const model = typeof body.model === 'string' && body.model.trim()
- ? body.model.trim()
- : cfg.embedModel;
+ const model =
+ typeof body.model === 'string' && body.model.trim()
+ ? body.model.trim()
+ : cfg.embedModel;
try {
result = await embedBatch(texts, model, (inputs) =>
watsonxEmbed(cfg, { inputs, model }).then((r) => ({
@@ -183,7 +188,10 @@ async function embedBatch(texts, model, fetcher) {
for (let i = 0; i < texts.length; i++) {
const hit = cacheGet(cacheKey(model, texts[i]));
if (hit) vectors[i] = hit;
- else { missIdx.push(i); missText.push(texts[i]); }
+ else {
+ missIdx.push(i);
+ missText.push(texts[i]);
+ }
}
let dimensions = vectors.find((v) => v)?.length ?? 0;
diff --git a/public/agents/index.html b/public/agents/index.html
index a6dbe0d7a..f4accffda 100644
--- a/public/agents/index.html
+++ b/public/agents/index.html
@@ -423,7 +423,7 @@
<div id="footer-container"></div>
<script src="/footer.js" defer></script>
- <script type="module" src="/agents/boot.js"></script>
+ <script type="module" src="./boot.js"></script>
<script src="/brand.js" defer></script>
</body>
</html>
diff --git a/src/footer-bot.js b/src/footer-bot.js
index 7158a7ab9..c531cacf0 100644
--- a/src/footer-bot.js
+++ b/src/footer-bot.js
@@ -102,14 +102,20 @@ function syncRunning() {
const next = onScreen && document.visibilityState !== 'hidden';
if (next === running) return;
running = next;
- if (running) { clock.getDelta(); animate(); }
+ if (running) {
+ clock.getDelta();
+ animate();
+ }
}
if (typeof IntersectionObserver !== 'undefined') {
- new IntersectionObserver((entries) => {
- onScreen = entries[0].isIntersecting;
- syncRunning();
- }, { threshold: 0 }).observe(canvas);
+ new IntersectionObserver(
+ (entries) => {
+ onScreen = entries[0].isIntersecting;
+ syncRunning();
+ },
+ { threshold: 0 },
+ ).observe(canvas);
} else {
onScreen = true;
}