-
Notifications
You must be signed in to change notification settings - Fork 60
fix(plugins): stop exposing workspace keys in observer links #1405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,13 +189,16 @@ remove_agent(name: "reviewer-1", reason: "Review accepted") | |
|
|
||
| ## Current CLI Reference | ||
|
|
||
| Startup and status commands are intentionally omitted from these agent-facing | ||
| examples. Published Agent Relay versions through 11.3.0 can print live | ||
| workspace credentials when those commands run in a transcribed session. Upgrade | ||
| to Agent Relay 11.3.1 or later before running them there. | ||
|
Comment on lines
+192
to
+195
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file around lines =="
nl -ba .agents/skills/using-agent-relay/SKILL.md | sed -n '170,215p'
echo
echo "== related commands in file =="
rg -n "agent-relay|node status|node up|credentials|Agent Relay|workspace credentials|11\.3\.[01]" .agents/skills/using-agent-relay/SKILL.md
echo
echo "== git diff context if available =="
git diff -- .agents/skills/using-agent-relay/SKILL.md | sed -n '1,220p' || trueRepository: AgentWorkforce/relay Length of output: 222 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file around lines =="
awk '{printf "%5d\t%s\n", NR, $0}' .agents/skills/using-agent-relay/SKILL.md | sed -n '170,215p'
echo
echo "== related commands in file =="
rg -n "agent-relay|node status|node up|credentials|Agent Relay|workspace credentials|11\.3\.[01]" .agents/skills/using-agent-relay/SKILL.md || true
echo
echo "== git diff context if available =="
git diff -- .agents/skills/using-agent-relay/SKILL.md 2>/dev/null | sed -n '1,220p' || trueRepository: AgentWorkforce/relay Length of output: 4530 Name the omitted commands and fix the credential-safety wording. Line 192 says startup and status commands are omitted, but 🧰 Tools🪛 SkillSpector (2.4.4)[warning] 21: [AS3] Skill Enumeration: Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills. Remediation: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation. (Agent Snooping (AS3)) [warning] 54: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 75: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 90: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 92: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 93: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 94: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 95: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 98: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 227: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) 🤖 Prompt for AI Agents |
||
|
|
||
| These are the current CLI forms for local broker and SDK-backed messaging | ||
| operations: | ||
|
|
||
| ```bash | ||
| agent-relay status | ||
| agent-relay node up --verbose | ||
| agent-relay node status --wait-for 10 | ||
| agent-relay node agent list | ||
| agent-relay node agent spawn claude --name Worker --task "Use https://agentrelay.com/skill and ACK over Relay." | ||
| agent-relay node tail --agent Worker | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -189,13 +189,16 @@ remove_agent(name: "reviewer-1", reason: "Review accepted") | |||||||||||||||||||
|
|
||||||||||||||||||||
| ## Current CLI Reference | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Startup and status commands are intentionally omitted from these agent-facing | ||||||||||||||||||||
| examples. Published Agent Relay versions through 11.3.0 can print live | ||||||||||||||||||||
| workspace credentials when those commands run in a transcribed session. Upgrade | ||||||||||||||||||||
| to Agent Relay 11.3.1 or later before running them there. | ||||||||||||||||||||
|
Comment on lines
+192
to
+195
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Name the exact omitted commands. The reference retains Proposed wording-Startup and status commands are intentionally omitted from these agent-facing
-examples.
+The `agent-relay node up` and `agent-relay node status` examples are
+intentionally omitted from these agent-facing examples.📝 Committable suggestion
Suggested change
🧰 Tools🪛 SkillSpector (2.4.4)[warning] 21: [AS3] Skill Enumeration: Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills. Remediation: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation. (Agent Snooping (AS3)) [warning] 54: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 75: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 90: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 92: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 93: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 94: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 95: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 98: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) [warning] 227: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries. Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content. (Memory Poisoning (MP2)) 🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| These are the current CLI forms for local broker and SDK-backed messaging | ||||||||||||||||||||
| operations: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ```bash | ||||||||||||||||||||
| agent-relay status | ||||||||||||||||||||
| agent-relay node up --verbose | ||||||||||||||||||||
| agent-relay node status --wait-for 10 | ||||||||||||||||||||
| agent-relay node agent list | ||||||||||||||||||||
| agent-relay node agent spawn claude --name Worker --task "Use https://agentrelay.com/skill and ACK over Relay." | ||||||||||||||||||||
| agent-relay node tail --agent Worker | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { readFileSync, readdirSync } from 'node:fs'; | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| import { dirname, join, resolve } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../../..'); | ||
|
|
||
| const agentFacingSkillFiles = [ | ||
| '.agents/skills/using-agent-relay/SKILL.md', | ||
| '.claude/skills/using-agent-relay/SKILL.md', | ||
| ] as const; | ||
|
|
||
| function readRepoFile(path: string): string { | ||
| return readFileSync(join(repoRoot, path), 'utf8'); | ||
| } | ||
|
|
||
| function listPluginFiles(directory: string): string[] { | ||
| return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { | ||
| if (entry.name.startsWith('.') || entry.name === 'node_modules') return []; | ||
|
|
||
| const path = join(directory, entry.name); | ||
| return entry.isDirectory() ? listPluginFiles(path) : [path]; | ||
| }); | ||
| } | ||
|
|
||
| describe('shipped relay plugin credential safety', () => { | ||
| it('does not construct observer URLs from workspace keys in shipped plugin assets', () => { | ||
| const pluginFiles = listPluginFiles(join(repoRoot, 'plugins')); | ||
|
|
||
| for (const path of pluginFiles) { | ||
| const source = readFileSync(path, 'utf8'); | ||
| expect(source, path).not.toMatch(/agentrelay\.com\/observer\?key=/i); | ||
| } | ||
| }); | ||
|
|
||
| it('does not instruct agents to print real workspace keys or observer links', () => { | ||
| const pluginFiles = listPluginFiles(join(repoRoot, 'plugins')); | ||
|
|
||
| for (const path of pluginFiles) { | ||
| const source = readFileSync(path, 'utf8'); | ||
| expect(source, path).not.toMatch(/\b(?:actual key|real clickable URL)\b/i); | ||
| expect(source, path).not.toMatch(/\bprint the observer URL\b/i); | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
|
|
||
| const credentialPrintLines = source | ||
| .split('\n') | ||
| .filter((line) => /\bprint\b/i.test(line) && /(?:workspace key|observer URL|ot_live_)/i.test(line)); | ||
|
|
||
| for (const line of credentialPrintLines) { | ||
| expect(line, `${path}: ${line}`).toMatch(/\b(?:never|do not)\b[^\n]*\bprint\b/i); | ||
| } | ||
| } | ||
|
|
||
| const sessionStartHook = readRepoFile('plugins/gemini-relay-extension/hooks/session-start.sh'); | ||
| expect(sessionStartHook).not.toMatch(/\bWORKSPACE_KEY\s*=/); | ||
| expect(sessionStartHook).not.toMatch(/\$\{?WORKSPACE_KEY\b/); | ||
| }); | ||
|
|
||
| it('keeps credential-printing startup commands out of mirrored agent-facing skills', () => { | ||
| const [agentsSkill, claudeSkill] = agentFacingSkillFiles.map(readRepoFile); | ||
|
|
||
| expect(agentsSkill).toBe(claudeSkill); | ||
| expect(agentsSkill).not.toMatch(/\bagent-relay node (?:up|status)\b/); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| prompt = """Check the relay status: | ||
| 1. Read the workspace key from the RELAY_API_KEY environment variable, or if empty read ~/.relay/workspace-key. Print the observer URL: https://agentrelay.com/observer?key=<the actual key>. Do not print a placeholder — print the real clickable URL. | ||
| 1. Do not read or print the workspace key and do not construct an observer URL from it. Observation requires a separately provisioned, read-only observer token delivered through an explicit secret handoff. If none is available, omit the observer link. | ||
| 2. Call mcp_agent_relay_list_agents to see who's online | ||
| 3. Call mcp_agent_relay_check_inbox to see unread messages | ||
| 4. Report a summary of the observer URL, agents, and any pending messages""" | ||
| 4. Report a summary of the agents and any pending messages""" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,10 +21,11 @@ load_env() { | |||||
|
|
||||||
| load_env | ||||||
|
|
||||||
| # Resolve workspace key: env > persisted key file | ||||||
| WORKSPACE_KEY="${RELAY_API_KEY:-}" | ||||||
| if [ -z "$WORKSPACE_KEY" ] && [ -s "$KEY_FILE" ]; then | ||||||
| WORKSPACE_KEY=$(cat "$KEY_FILE" 2>/dev/null || true) | ||||||
| # Track whether Relay is configured without reading credential material into | ||||||
| # this hook. Workspace keys must never be placed in injected context. | ||||||
| WORKSPACE_CONFIGURED=0 | ||||||
| if [ -n "${RELAY_API_KEY:-}" ] || [ -s "$KEY_FILE" ]; then | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: A whitespace-only persisted key file is reported as configured even though the relay server trims it to an empty key, so SessionStart can inject misleading registration/configuration guidance. Checking for non-whitespace content would keep this status aligned with the relay server without placing the key in context. Prompt for AI agents
Suggested change
|
||||||
| WORKSPACE_CONFIGURED=1 | ||||||
| fi | ||||||
|
|
||||||
| TOKEN="" | ||||||
|
|
@@ -39,13 +40,13 @@ if [ -f "$STATE_FILE" ] && command -v jq >/dev/null 2>&1; then | |||||
| fi | ||||||
|
|
||||||
| if [ -n "${TOKEN:-}" ] && [ -n "${AGENT_NAME:-}" ]; then | ||||||
| if [ -n "${WORKSPACE_KEY:-}" ]; then | ||||||
| CONTEXT=$(printf 'Relaycast is connected as %s. Use the Agent Relay MCP tools for DMs, channels, inbox checks, and worker coordination. Follow the ACK/DONE protocol: acknowledge new assignments promptly, and send DONE when the task is complete. To spawn workers, use run_shell_command with: RELAY_AGENT_NAME=WorkerName gemini -y -i "task prompt" &. The user can observe agent conversations at: https://agentrelay.com/observer?key=%s' "$AGENT_NAME" "$WORKSPACE_KEY") | ||||||
| if [ "$WORKSPACE_CONFIGURED" -eq 1 ]; then | ||||||
| CONTEXT=$(printf 'Relaycast is connected as %s. Use the Agent Relay MCP tools for DMs, channels, inbox checks, and worker coordination. Follow the ACK/DONE protocol: acknowledge new assignments promptly, and send DONE when the task is complete. To spawn workers, use run_shell_command with: RELAY_AGENT_NAME=WorkerName gemini -y -i "task prompt" &. Never print the workspace key or construct an observer URL from it. Observation requires a separately provisioned, read-only observer token delivered through an explicit secret handoff.' "$AGENT_NAME") | ||||||
| else | ||||||
| CONTEXT=$(printf 'Relaycast is connected as %s. Use the Agent Relay MCP tools for DMs, channels, inbox checks, and worker coordination. Follow the ACK/DONE protocol: acknowledge new assignments promptly, and send DONE when the task is complete. To spawn workers, use run_shell_command with: RELAY_AGENT_NAME=WorkerName gemini -y -i "task prompt" &.' "$AGENT_NAME") | ||||||
| fi | ||||||
| elif [ -n "${WORKSPACE_KEY:-}" ]; then | ||||||
| CONTEXT=$(printf 'Relaycast workspace key is configured. If the relay tools report "Not registered", call the register tool with your exact agent name before using messaging tools. The user can observe agent conversations at: https://agentrelay.com/observer?key=%s' "$WORKSPACE_KEY") | ||||||
| elif [ "$WORKSPACE_CONFIGURED" -eq 1 ]; then | ||||||
| CONTEXT='Relaycast workspace key is configured. If the relay tools report "Not registered", call the register tool with your exact agent name before using messaging tools. Never print the workspace key or construct an observer URL from it. Observation requires a separately provisioned, read-only observer token delivered through an explicit secret handoff.' | ||||||
| else | ||||||
| CONTEXT='Relaycast is connected. A workspace was auto-created. Use the Agent Relay MCP tools for messaging and worker coordination.' | ||||||
| fi | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: The new security note says status commands are omitted because they can print live workspace credentials in a transcribed session, yet the same CLI reference block still lists
agent-relay statusas the first safe example. Ifagent-relay statusbehaves like the removednode status/node upcommands, this leaves a credential-printing command in the examples; if it is genuinely safe, the note's blanket 'status commands' wording is misleading. Consider clarifying whetheragent-relay statusis safe (and if not, remove it) so an agent in a transcribed session isn't misled into running it.Prompt for AI agents