Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

fix(skills): restrict installs to configured hub (#126)

OKNOTOK6fdcba21cf19
diff --git a/server/src/__tests__/agents-skills-install-ssrf.test.ts b/server/src/__tests__/agents-skills-install-ssrf.test.ts
new file mode 100644
index 0000000..96c2496
--- /dev/null
+++ b/server/src/__tests__/agents-skills-install-ssrf.test.ts
@@ -0,0 +1,60 @@
+import assert from 'node:assert/strict'
+import { afterEach, test } from 'node:test'
+
+process.env.OPENAI_API_KEY ??= 'test-key'
+
+const { fetchSkillManifest } = await import('../agents/skills.js')
+
+const savedFetch = globalThis.fetch
+
+afterEach(() => {
+ globalThis.fetch = savedFetch
+})
+
+test('skill manifest fetch rejects an explicit HTTP URL before any network request', async () => {
+ let fetchCalls = 0
+ globalThis.fetch = (async () => {
+ fetchCalls += 1
+ throw new Error('network must not be reached')
+ }) as typeof fetch
+
+ await assert.rejects(
+ fetchSkillManifest('http://169.254.169.254/latest/meta-data/', 'https://skills.example.test'),
+ /explicit install URLs are not allowed/i,
+ )
+ assert.equal(fetchCalls, 0)
+})
+
+test('skill ids are encoded beneath the configured hub and redirects are disabled', async () => {
+ let seenUrl = ''
+ let seenInit: RequestInit | undefined
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
+ seenUrl = String(input)
+ seenInit = init
+ return new Response(JSON.stringify({
+ name: 'safe-skill',
+ description: 'A safe test skill',
+ files: [{ path: 'SKILL.md', body: '---\nname: safe-skill\ndescription: A safe test skill\n---\n' }],
+ }), { status: 200, headers: { 'content-type': 'application/json' } })
+ }) as typeof fetch
+
+ const manifest = await fetchSkillManifest('safe/../skill', 'https://skills.example.test/catalog')
+
+ assert.equal(seenUrl, 'https://skills.example.test/catalog/skills/safe%2F..%2Fskill')
+ assert.equal(seenInit?.redirect, 'error')
+ assert.equal(manifest.name, 'safe-skill')
+})
+
+test('protocol-relative install targets are rejected before any network request', async () => {
+ let fetchCalls = 0
+ globalThis.fetch = (async () => {
+ fetchCalls += 1
+ throw new Error('network must not be reached')
+ }) as typeof fetch
+
+ await assert.rejects(
+ fetchSkillManifest('//internal.service/manifest', 'https://skills.example.test'),
+ /explicit install URLs are not allowed/i,
+ )
+ assert.equal(fetchCalls, 0)
+})
diff --git a/server/src/agents/cli.ts b/server/src/agents/cli.ts
index fce61c0..29c1f08 100644
--- a/server/src/agents/cli.ts
+++ b/server/src/agents/cli.ts
@@ -375,7 +375,7 @@ SKILLS (progressive-disclosure capability packs in your own workspace):
skills read <name> [<sub-path>] load full SKILL.md (or a bundled file)
skills create <name> "<description>" scaffold a new skill
skills search <query> search SkillHub (requires SKILLHUB_URL)
- skills install <id_or_url> install from SkillHub or any compatible URL
+ skills install <id> install from the configured SkillHub
skills delete <name> remove a skill
react <message_id> <emoji> toggle an emoji reaction on any message
palette "<brief>" generate a 5-color hex palette
@@ -2423,8 +2423,7 @@ on demand via \`cumora skills read ${name} references/<file>\`._
// verbatim so the agent can paste/run it without thinking.
return ok(hits.map((h) => {
const meta = [h.version && `v${h.version}`, h.author && `by ${h.author}`].filter(Boolean).join(' · ')
- const tag = h.install_url ?? h.name
- return ` ${h.name}${meta ? ` (${meta})` : ''}\n ${h.description}\n → cumora skills install ${tag}`
+ return ` ${h.name}${meta ? ` (${meta})` : ''}\n ${h.description}\n → cumora skills install ${h.name}`
}).join('\n\n'))
} catch (e) {
return err(`skills search failed: ${e instanceof Error ? e.message : String(e)}`)
@@ -2432,12 +2431,12 @@ on demand via \`cumora skills read ${name} references/<file>\`._
}
if (op === 'install') {
- const idOrUrl = parsed.positional[1]
- if (!idOrUrl) return err('usage: skills install <skill_id_or_install_url>')
+ const skillId = parsed.positional[1]
+ if (!skillId) return err('usage: skills install <skill_id>')
try {
const { env } = await import('../env.js')
const { fetchSkillManifest, installSkillFromManifest } = await import('./skills.js')
- const manifest = await fetchSkillManifest(idOrUrl, env.SKILLHUB_URL)
+ const manifest = await fetchSkillManifest(skillId, env.SKILLHUB_URL)
const result = await installSkillFromManifest({ agentId: me, manifest })
return ok(
`installed skill "${result.name}" (${result.files} file${result.files === 1 ? '' : 's'})\n` +
@@ -2448,7 +2447,7 @@ on demand via \`cumora skills read ${name} references/<file>\`._
agentId: me,
skillName: result.name,
fileCount: result.files,
- source: idOrUrl,
+ source: skillId,
}],
)
} catch (e) {
@@ -2462,7 +2461,7 @@ on demand via \`cumora skills read ${name} references/<file>\`._
' skills read <name> [<sub-path>] load full SKILL.md (or a bundled file)\n' +
' skills create <name> "<description>" scaffold a new skill\n' +
' skills search <query> search the configured SkillHub\n' +
- ' skills install <id_or_url> install a skill from SkillHub (or any compatible URL)\n' +
+ ' skills install <id> install a skill from the configured SkillHub\n' +
' skills delete <name> remove a skill and all its files',
)
}
diff --git a/server/src/agents/personas.ts b/server/src/agents/personas.ts
index 7ac9dbd..cb8cf05 100644
--- a/server/src/agents/personas.ts
+++ b/server/src/agents/personas.ts
@@ -158,7 +158,7 @@ CAPABILITIES — every other capability is a subcommand of the \`cumora\` CLI on
The wake prompt already lists each installed skill's name + description for you. Run \`cumora skills read <name>\`
to pull the FULL instructions into context only when a task calls for them — the progressive-disclosure pattern
that keeps your base prompt small while letting you keep many skills on hand. When you don't yet have the right
- skill, run \`cumora skills search '<query>'\` against SkillHub, then \`cumora skills install <id>\` to add it to
+ skill, run \`cumora skills search '<query>'\` against the operator-configured SkillHub, then \`cumora skills install <id>\` to add it to
your workspace.
Attachments — you actually READ / SEE them, not just notice them:
diff --git a/server/src/agents/skills.ts b/server/src/agents/skills.ts
index fcdf5d7..1c21964 100644
--- a/server/src/agents/skills.ts
+++ b/server/src/agents/skills.ts
@@ -108,8 +108,10 @@ export interface SkillHubSearchHit {
description: string
version?: string
author?: string
- /** Full URL to fetch the install manifest. Optional — if absent we
- * fall back to `<hub>/skills/<name>`. */
+ /** Optional hub metadata. Cumora deliberately does not fetch this URL:
+ * install requests are always rebuilt from the operator-configured hub
+ * plus the skill id, so an agent or a compromised search response cannot
+ * turn the server into an arbitrary HTTP client. */
install_url?: string
}
@@ -134,24 +136,32 @@ const MAX_FILE_BODY_BYTES = 256 * 1024 // 256KB per file
export async function searchSkillHub(query: string, hubUrl: string): Promise<SkillHubSearchHit[]> {
if (!hubUrl) throw new Error('SkillHub URL not configured — set SKILLHUB_URL on the server')
const url = `${hubUrl.replace(/\/+$/, '')}/search?q=${encodeURIComponent(query)}`
- const r = await fetch(url, { signal: AbortSignal.timeout(HUB_TIMEOUT_MS) })
+ const r = await fetch(url, {
+ redirect: 'error',
+ signal: AbortSignal.timeout(HUB_TIMEOUT_MS),
+ })
if (!r.ok) throw new Error(`hub search failed: HTTP ${r.status}`)
const json = await r.json()
if (!Array.isArray(json)) throw new Error('hub search returned non-array')
return json as SkillHubSearchHit[]
}
-/** Resolve a skill id (or full install URL) to a manifest. When called
- * with a bare id we look it up on the configured hub; with an http(s)
- * URL we fetch directly (lets agents install from non-hub sources). */
-export async function fetchSkillManifest(idOrUrl: string, hubUrl: string): Promise<SkillManifest> {
- const url = /^https?:\/\//.test(idOrUrl)
- ? idOrUrl
- : (() => {
- if (!hubUrl) throw new Error('SkillHub URL not configured — set SKILLHUB_URL or pass a full install URL')
- return `${hubUrl.replace(/\/+$/, '')}/skills/${encodeURIComponent(idOrUrl)}`
- })()
- const r = await fetch(url, { signal: AbortSignal.timeout(HUB_TIMEOUT_MS) })
+/** Resolve a skill id to a manifest on the operator-configured hub.
+ *
+ * Agent-controlled URLs are intentionally rejected. The server owns the
+ * network destination; the agent controls only an encoded path segment.
+ * Redirects are disabled as well, so a trusted-looking hub response cannot
+ * pivot the request to metadata, loopback, or another internal service. */
+export async function fetchSkillManifest(skillId: string, hubUrl: string): Promise<SkillManifest> {
+ if (/^https?:\/\//i.test(skillId) || skillId.startsWith('//')) {
+ throw new Error('explicit install URLs are not allowed — install by skill id from the configured SkillHub')
+ }
+ if (!hubUrl) throw new Error('SkillHub URL not configured — set SKILLHUB_URL')
+ const url = `${hubUrl.replace(/\/+$/, '')}/skills/${encodeURIComponent(skillId)}`
+ const r = await fetch(url, {
+ redirect: 'error',
+ signal: AbortSignal.timeout(HUB_TIMEOUT_MS),
+ })
if (!r.ok) throw new Error(`hub install failed: HTTP ${r.status}`)
const json = await r.json() as Partial<SkillManifest>
if (!json || typeof json !== 'object') throw new Error('manifest is not an object')
diff --git a/server/src/agents/turn.ts b/server/src/agents/turn.ts
index e8e4b83..f1e13e5 100644
--- a/server/src/agents/turn.ts
+++ b/server/src/agents/turn.ts
@@ -2212,7 +2212,7 @@ Now decide — like a real teammate would. World actions use bash(); turn state
bash("cumora skills read <name>") — load a skill's full SKILL.md when a task calls for it
bash("cumora skills create <name> '<description>'") — scaffold a new skill (then edit the SKILL.md to flesh out instructions / examples / edge cases)
bash("cumora skills search '<query>'") — search SkillHub for a skill that solves the task at hand
- bash("cumora skills install <id_or_url>") — install a skill from SkillHub (or any URL returning a compatible manifest)
+ bash("cumora skills install <id>") — install a skill from the operator-configured SkillHub
bash("cumora calendar create '<title>' --at <iso> --assignee ${agentId} --prompt '<what future-you should do>' [--private]")
— SCHEDULE YOURSELF (or someone else). At <iso>, the assignee gets woken with <prompt> as their brief. Add \`--every daily|weekly|monthly|yearly\` (optionally \`--interval N\`, \`--byweekday 0,1,2\`, \`--until <iso>\`, \`--count N\`) to make it RECURRING. Use this whenever you'd otherwise say "I'll do X later / tomorrow / next Monday / every morning / every Friday at 5pm" — instead of telling the user you'll come back, schedule the wake so future-you actually comes back. Add \`--private\` for internal scratch reminders you don't want to clutter the shared workspace calendar — only you (and the workspace owner) will see it. Examples:
cumora calendar create 'Daily standup digest' --at 2026-05-24T09:00:00Z --assignee ${agentId} --prompt 'Summarize yesterday's group activity and post into <convo_id>' --every daily
diff --git a/server/src/env.ts b/server/src/env.ts
index b30b98f..d1332e2 100644
--- a/server/src/env.ts
+++ b/server/src/env.ts
@@ -154,7 +154,7 @@ export const env = {
* GET <hub>/search?q=<query>
* → [{ name, description, version?, author?, install_url }]
*
- * GET <hub>/skills/<name> (also any explicit install_url)
+ * GET <hub>/skills/<name>
* → { name, description, version?, author?, files: [
* { path: 'SKILL.md', body: '...' },
* { path: 'scripts/foo.py', body: '...' },