agentleFS
ebibibiebibibi/ebi-agent-chat-relay/.claude/skills/security-audit/SKILL.md

security-audit

Skill59 starsChanged 10 months agoMITView on GitHub

Security checklist specific to claude-code-discord-bridge — subprocess injection, env leaks, input validation

  • Reads credentials

140 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use asset-spec, create-control-manifest and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • cenconq25Skill

    asset-spec

    Generates per-asset visual specifications and AI-generation prompts from PRDs and the design bible. Produces structured spec files and updates a master asset manifest. Use after design bible is approved and a UX spec or PRD identifies assets to produce. Output: design/assets/<asset>.md plus design/assets/manifest.md.

    Also in 5 projects that use this

  • cenconq25Skill

    create-control-manifest

    Produces a flat, immediately-actionable rules sheet — do this, never do that, per system and per layer — extracted from accepted ADRs, technical preferences, and framework reference docs. More directly usable than ADRs for day-to-day implementation. Run after /architecture-review passes.

    Also in 5 projects that use this

  • +10 more from cenconq25

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 118 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before any commit that changes runner.py, _run_helper.py, or any Cog

    line 12
  2. Distinctive:

    When adding new user-facing commands

    line 13
  3. Distinctive:

    When modifying subprocess execution or argument passing

    line 14
  4. Distinctive:

    When adding new environment variables or configuration

    line 15

“Common” is measured: kept by at least 6 in 10 of the 118 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Audit — claude-code-discord-bridge Specific

This project runs arbitrary Claude Code sessions triggered by Discord messages. Security is the #1 priority.

When to Activate

  • Before any commit that changes runner.py, _run_helper.py, or any Cog
  • When adding new user-facing commands
  • When modifying subprocess execution or argument passing
  • When adding new environment variables or configuration
  • Periodically as a full audit

Threat Model

ThreatVectorMitigation
Command injectionUser message passed to CLI argscreate_subprocess_exec (no shell), -- separator
Flag injectionPrompt starting with --- separator before prompt
Session hijackFake session IDStrict regex validation ^[a-f0-9\-]+$
Skill injectionMalicious skill nameStrict regex validation ^[\w-]+$
Secret exfiltrationClaude Bash tool reads envStrip secrets from subprocess env
Nesting attackClaude spawns another claude-code-discord-bridgeStrip CLAUDECODE from env
Token theftBot token in logs/errorsNever log tokens, strip from env

Checklist

Subprocess Safety

  • All subprocess calls use asyncio.create_subprocess_exec (NEVER shell=True)
  • -- separator is always placed before user-provided prompt text
  • No string formatting/interpolation of user input into command strings
  • Session IDs validated with re.match(r"^[a-f0-9\-]+$", session_id)
  • Skill names validated with re.match(r"^[\w-]+$", name)

Environment Security

  • _STRIPPED_ENV_KEYS includes all secret environment variables
  • DISCORD_BOT_TOKEN is stripped from subprocess env
  • CLAUDECODE is stripped (prevents nesting detection bypass)
  • No secrets in log output (check logger.info/debug/warning/error calls)
  • .env file is in .gitignore

Input Validation

  • All user-provided strings are validated before use
  • Discord message content is never directly interpolated into commands
  • Thread IDs and channel IDs are validated as integers
  • No user input reaches dangerous evaluation functions

Error Handling

  • Error messages don't leak internal paths or secrets
  • Stack traces are logged (not sent to Discord)
  • Failed sessions clean up properly (no zombie processes)

Dependencies

  • All dependencies are pinned in uv.lock
  • No unnecessary dependencies
  • discord.py is from the official PyPI package

Quick Scan Commands

# Search for dangerous patterns
grep -rn "shell=True" claude_discord/
grep -rn "subprocess\.call" claude_discord/
grep -rn "subprocess\.run" claude_discord/

# Check that secrets are stripped
grep -n "_STRIPPED_ENV_KEYS" claude_discord/claude/runner.py

# Verify .env is gitignored
grep "\.env" .gitignore

Response Protocol

  • CRITICAL (injection, secret leak): Stop immediately. Fix before any other work.
  • HIGH (missing validation): Fix before committing.
  • MEDIUM (logging concern): Fix in the same PR.
  • LOW (style/hardening): Track as a follow-up issue.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.