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.

fix(registry): withhold slur-named Solana registry agents from every public feed

nirholas96088eb00c71
diff --git a/api/_lib/solana-agents-crawl.js b/api/_lib/solana-agents-crawl.js
index 446ca3a16..fc1247447 100644
--- a/api/_lib/solana-agents-crawl.js
+++ b/api/_lib/solana-agents-crawl.js
@@ -12,6 +12,7 @@
// module only pulls them in when the crawl cron actually runs.
import { sql } from './db.js';
+import { matchedSlurStem } from './display-name-safety.js';
import { solanaConnection, solanaRpcEndpoints } from './solana/connection.js';
import { fetchSafePublicUrlPinned } from './ssrf-guard.js';
import {
@@ -294,7 +295,21 @@ async function freshlyEnrichedRefs(source) {
// Upsert one external Solana agent. registered_at is set to now() only on first
// insert (a stable "first seen" proxy — these registries expose no cheap on-chain
// creation timestamp) and preserved on every later sync.
-async function upsertAgent(row) {
+//
+// Names and descriptions come from attacker-controlled registry metadata, so the
+// same slur gate the ERC-8004 hydration applies decides `active` here too: every
+// public feed (/deployments, explore, discover) filters on it, and a re-sync
+// after an on-chain rename restores the row.
+export async function upsertAgent(row) {
+ const slur = matchedSlurStem(`${row.name || ''} ${row.description || ''}`);
+ if (slur) {
+ console.warn('[solana-crawl] withholding agent: slur in registry metadata', {
+ source: row.source,
+ ref: row.ref,
+ matched: slur,
+ });
+ row = { ...row, active: false };
+ }
await sql`
INSERT INTO solana_agents_index
(source, ref, network, owner, asset, agent_id, name, description, image,
@@ -323,7 +338,12 @@ async function upsertAgent(row) {
status = COALESCE(excluded.status, solana_agents_index.status),
has_3d = solana_agents_index.has_3d OR excluded.has_3d,
x402_support = solana_agents_index.x402_support OR excluded.x402_support,
- active = excluded.active,
+ -- A pass that carried no name or description judged nothing, so it keeps
+ -- the verdict an earlier metadata pass recorded (a withheld slur stays
+ -- withheld while the structural scan re-upserts the row every tick).
+ active = CASE WHEN ${row.name == null && row.description == null}
+ THEN excluded.active AND solana_agents_index.active
+ ELSE excluded.active END,
last_metadata_at = CASE WHEN ${!!row.enriched} THEN now() ELSE solana_agents_index.last_metadata_at END,
metadata_error = CASE WHEN ${!!row.preserveMetadataError}
THEN solana_agents_index.metadata_error
diff --git a/scripts/deactivate-slur-agents.mjs b/scripts/deactivate-slur-agents.mjs
index 734406b93..c99169f78 100644
--- a/scripts/deactivate-slur-agents.mjs
+++ b/scripts/deactivate-slur-agents.mjs
@@ -1,6 +1,7 @@
#!/usr/bin/env node
/**
- * Withhold already-indexed ERC-8004 agents whose on-chain metadata carries a hate slur.
+ * Withhold already-indexed ERC-8004 and Solana registry agents whose on-chain
+ * metadata carries a hate slur.
*
* The crawler hydrates every registered agent's display name, description and image
* from attacker-controlled on-chain metadata, and until the gate in
@@ -16,6 +17,10 @@
* Slurs only, never general profanity: every false positive silently delists a
* legitimate agent. Run with --dry-run first; it prints counts, never the names.
*
+ * The Solana registry index (solana_agents_index: Metaplex, AgenC and the other
+ * crawled registries) is gated the same way at upsert in
+ * api/_lib/solana-agents-crawl.js since 2026-10-08, and is scanned here too.
+ *
* Usage:
* node --env-file=.env.local scripts/deactivate-slur-agents.mjs --dry-run
* node --env-file=.env.local scripts/deactivate-slur-agents.mjs
@@ -41,23 +46,36 @@ const rows = await sql`
AND (name IS NOT NULL OR description IS NOT NULL)
`;
-console.log(`[slur-scan] scanning ${rows.length} active indexed agents`);
+const solRows = await sql`
+ SELECT source, ref, name, description
+ FROM solana_agents_index
+ WHERE active = true
+ AND (name IS NOT NULL OR description IS NOT NULL)
+`;
+
+console.log(`[slur-scan] scanning ${rows.length} active ERC-8004 and ${solRows.length} active Solana indexed agents`);
const hits = [];
for (const r of rows) {
const stem = matchedSlurStem(`${r.name || ''} ${r.description || ''}`);
if (stem) hits.push({ ...r, stem });
}
+const solHits = [];
+for (const r of solRows) {
+ const stem = matchedSlurStem(`${r.name || ''} ${r.description || ''}`);
+ if (stem) solHits.push({ source: r.source, ref: r.ref, stem });
+}
-if (!hits.length) {
+if (!hits.length && !solHits.length) {
console.log('[slur-scan] clean — no active agent carries a slur');
process.exit(0);
}
// Report the stem and the chain/agent id, never the offending text itself.
-const byStem = hits.reduce((a, h) => ((a[h.stem] = (a[h.stem] || 0) + 1), a), {});
-console.log(`[slur-scan] ${hits.length} offending row(s):`, byStem);
+const byStem = [...hits, ...solHits].reduce((a, h) => ((a[h.stem] = (a[h.stem] || 0) + 1), a), {});
+console.log(`[slur-scan] ${hits.length + solHits.length} offending row(s):`, byStem);
for (const h of hits) console.log(` chain ${h.chain_id} agent ${h.agent_id} — matched "${h.stem}"`);
+for (const h of solHits) console.log(` solana ${h.source} ${h.ref} matched "${h.stem}"`);
if (DRY) {
console.log('[slur-scan] --dry-run: nothing written');
@@ -73,5 +91,13 @@ for (const h of hits) {
`;
n++;
}
+for (const h of solHits) {
+ await sql`
+ UPDATE solana_agents_index
+ SET active = false
+ WHERE source = ${h.source} AND ref = ${h.ref}
+ `;
+ n++;
+}
console.log(`[slur-scan] withheld ${n} agent(s) — they no longer appear on any public feed`);
process.exit(0);
diff --git a/tests/solana-agents-crawl-slur-gate.test.js b/tests/solana-agents-crawl-slur-gate.test.js
new file mode 100644
index 000000000..a813d9487
--- /dev/null
+++ b/tests/solana-agents-crawl-slur-gate.test.js
@@ -0,0 +1,58 @@
+// The Solana registry crawl indexes names and descriptions straight from
+// attacker-controlled registry metadata, and /deploy-onchain's "latest to land"
+// strip rendered a slur-named Metaplex agent verbatim (found 2026-10-08). The
+// upsert now applies the same slur gate as the ERC-8004 hydration, and the
+// structural pass (no name, every 30 minutes) must not re-activate a row an
+// earlier metadata pass withheld.
+
+import { describe, expect, it, vi, beforeEach } from 'vitest';
+
+const calls = [];
+vi.mock('../api/_lib/db.js', () => ({
+ sql: Object.assign(
+ async (strings, ...values) => {
+ calls.push({ strings: [...strings], values });
+ return [];
+ },
+ { unsafe: async () => [] },
+ ),
+}));
+
+const { upsertAgent } = await import('../api/_lib/solana-agents-crawl.js');
+
+const squash = (s) => s.replace(/\s+/g, '');
+
+// The INSERT's `active` value: the one followed by `, now(),` in the VALUES list.
+function insertedActive(call) {
+ const i = call.strings.findIndex((s, k) => k > 0 && squash(s).startsWith(',now(),'));
+ return call.values[i - 1];
+}
+// The ON CONFLICT guard: true when this pass carried no name or description.
+function judgedNothing(call) {
+ const k = call.strings.findIndex((str) => str.includes('THEN excluded.active AND solana_agents_index.active'));
+ return call.values[k - 1];
+}
+
+beforeEach(() => {
+ calls.length = 0;
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+});
+
+describe('solana registry upsert slur gate', () => {
+ it('withholds an agent whose registry name carries a slur', async () => {
+ await upsertAgent({ source: 'metaplex', ref: 'THREEsynthetic1111111111111111111111111A', name: 'nigga bot', active: true });
+ expect(insertedActive(calls[0])).toBe(false);
+ expect(judgedNothing(calls[0])).toBe(false);
+ });
+
+ it('keeps an ordinary agent active, crude names included', async () => {
+ await upsertAgent({ source: 'metaplex', ref: 'THREEsynthetic1111111111111111111111111B', name: 'damn good agent', active: true });
+ expect(insertedActive(calls[0])).toBe(true);
+ });
+
+ it('flags a name-less structural pass so it keeps the stored verdict', async () => {
+ await upsertAgent({ source: 'metaplex', ref: 'THREEsynthetic1111111111111111111111111C', active: true, enriched: false });
+ expect(insertedActive(calls[0])).toBe(true);
+ expect(judgedNothing(calls[0])).toBe(true);
+ });
+});