Skip to content
This repository was archived by the owner on Jul 5, 2026. It is now read-only.

fix(security): generate agent catalog snippets client-side#277

Merged
JSONbored merged 2 commits into
mainfrom
codex/fix-untrusted-agent-snippets-vulnerability
Jun 28, 2026
Merged

fix(security): generate agent catalog snippets client-side#277
JSONbored merged 2 commits into
mainfrom
codex/fix-untrusted-agent-snippets-vulnerability

Conversation

@JSONbored

@JSONbored JSONbored commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

Generate agent-catalog copy snippets in the UI instead of trusting executable snippet strings from the backend payload.

What changed

  • Dropped backend-provided snippets during agent-catalog service normalization.
  • Removed snippets from the normalized AgentCatalogService type surface.
  • Rendered callable-service snippets from apiSnippet(service.base_url) for curl, Python, and JavaScript.
  • Added regression tests proving backend snippets are not preserved and generated snippets are escaped.

Why

Backend-provided executable snippets are too risky to expose through a one-click copy affordance. The UI still gives users paste-ready examples, but now those examples are generated from the normalized service URL instead of copied verbatim from API data.

Validation

  • bun install --frozen-lockfile
  • bun run test src/lib/metagraphed/queries.test.ts src/components/metagraphed/endpoint-snippet.test.ts
  • bun run typecheck
  • bunx eslint src/lib/metagraphed/queries.ts src/lib/metagraphed/queries.test.ts src/lib/metagraphed/types.ts src/components/metagraphed/endpoint-snippet.test.ts src/routes/subnets.$netuid.tsx
  • bunx prettier --check src/lib/metagraphed/queries.ts src/lib/metagraphed/queries.test.ts src/lib/metagraphed/types.ts src/components/metagraphed/endpoint-snippet.test.ts src/routes/subnets.$netuid.tsx
  • bun run build
  • git diff --check

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-ui b7bc71b Commit Preview URL

Branch Preview URL
Jun 28 2026, 12:42 PM

@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored merged commit 4a75dd3 into main Jun 28, 2026
6 of 7 checks passed
@JSONbored JSONbored deleted the codex/fix-untrusted-agent-snippets-vulnerability branch June 28, 2026 12:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant