Back to skill

Security audit

OpenCode Discord Thread

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-aligned but should be reviewed because it can send broad, unredacted coding-session content to Discord and unnecessarily exposes the Discord bot token to the OpenCode subprocess.

Review before installing. Use this only for repositories and prompts you are comfortable sharing with the target Discord audience, prefer restricted/private threads, and use a minimally privileged Discord bot token. Avoid running it on sensitive repos until it supports redaction, transcript opt-in/opt-out, and removal of DISCORD_BOT_TOKEN from the OpenCode subprocess environment.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_opencode_discord_bridge.py:371
Finding

Unredacted OpenCode Execution Data Is Transmitted to Discord

Content
View full analysis
list[str]: results: list[str] = [] if value is None: return results if isinstance(value, str): stripped = value.strip() if stripped: results.append(stripped) return results if isinstance(value, list): for item in value: results.extend(extract_text(item)) return results if isinstance(value, dict): preferred_keys = ( "text", "delta", "content", "message", "summary", "error", "input", "output", "name", "tool", "title", ) for key in preferred_keys: if key in value: results.extend(extract_text(value[key])) for item in value.values(): if isinstance(item, (dict, list)): results.extend(extract_text(item)) return results return results ``` ```python def render_status( state: dict[str, Any], prompt: str, command: list[str], done: bool = False, ) -> str: heading = "OpenCode run finished" if done else "OpenCode run in progress" preview = "\n".join(state["lines"][-STATUS_PREVIEW_LINES:]) or "(waiting for events)" stderr_preview = "\n".join(state["stderr"][-6:]) result = textwrap.dedent( f""" {heading} Repo: `{state["repo"]}` Model: `{state["model"]}` Command: `{shlex.join(command)}` Prompt: `{shorten(prompt, 180)}` Events: `{state["event_count"]}` Recent events: {preview} """ ).strip() if stderr_preview: resu ...[truncated 3640 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/run_opencode_discord_bridge.py:353
Finding

Discord Bot Token Is Inherited by the OpenCode Subprocess

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The text extraction logic intentionally pulls human-readable content from many fields including text, message, summary, error, input, and output, then uses those values in Discord-visible summaries and transcript posts. In this skill’s context, that creates a broad natural-language exfiltration path for sensitive prompts, source code, tool inputs, tool outputs, error traces, credentials, or proprietary data surfaced during the OpenCode run.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

At completion, the script posts the deduplicated transcript of extracted event text to Discord in chunks, which can disclose a large portion of the session’s content beyond brief status updates. This is especially risky in a coding-assistant workflow because prompts, repository-derived code, stack traces, generated patches, and secrets encountered during execution may all be mirrored into an external communications platform.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill explicitly instructs use of shell execution, local repository access, environment-based credentials, and Discord network posting, but it does not declare any tool restrictions or permission boundaries. In a delegation skill that bridges local code execution to an external service, missing scope declarations materially increase the risk of overbroad access, unintended secret exposure, and unsafe command execution under the agent's authority.

Content

No source excerpt is available for this finding.

Indirect Prompt Extraction

Medium
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains patterns that could indirectly extract system prompts through rephrasing, translation, summarization, or side-channel techniques.

Content

Scanner excerpt · SKILL.md (reported line 32)May include surrounding context.

md
## Workflow

1. Confirm that the repository path, Discord target, and OpenCode prompt are known.
2. Prefer reusing a warm OpenCode backend with `--attach http://host:port` when available.
3. Pass the exact model only if the caller already knows the current Z.AI Coding Plan model id.
4. Use `scripts/run_opencode_discord_bridge.py` to launch `opencode run --format json`, summarize event output, and mirror that stream into Discord.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The header and status rendering include prompt previews and the fully rendered command line, which may expose sensitive instructions, repository paths, attachment URLs, session identifiers, model/provider metadata, or secrets embedded in arguments. Because these values are posted to Discord repeatedly during execution, accidental disclosure becomes more likely and more persistent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script explicitly sends prompt content, command details, live event summaries, stderr, and later transcript material to a Discord thread, but does not require explicit acknowledgement that repository data or sensitive instructions may be exfiltrated to a third-party service. In this skill context, the bridge is specifically designed to mirror execution into Discord, which makes the data-sharing intentional but still dangerous if prompts, code, secrets, tokens, or internal output are present.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/run_opencode_discord_bridge.py (reported line 366)May include surrounding context.

python
"stderr": [],
    }

    process = subprocess.Popen(
        command,
        cwd=repo,
        stdout=subprocess.PIPE,

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The script reads a sensitive credential from DISCORD_BOT_TOKEN, but there is no nearby comment, help text, or user-facing disclosure explaining this credential requirement or its sensitivity. For code-file warning checks, access to sensitive environment variables should have some visible disclosure unless clearly covered elsewhere.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.