agentleFS
MangroveTechnologiesMangroveTechnologies/mangrove-agent/.claude/skills/audit-security/SKILL.md

audit-security

Skill8 starsChanged 14 days agoMITView on GitHub

Run a focused security audit of the mangrove-agent trading bot. Covers wallet signing surfaces, EIP-7702 / arbitrary-signing risks, MCP tool permissions, Fernet key handling, DEX executor paths, hook-enforcement gaps, OWASP Top 10, and dependency CVEs. Use when the user asks for "security audit", "audit security", "security review", "check for vulnerabilities", "OWASP audit", or "/audit-security". Adapted from the Mangrove workspace `audit-security` skill with a trading-bot lens added after the 2026-04-24 EIP-7702 incident.

  • Reads credentials
  • Installs packages

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use retro, implement and 2 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.
  • AWSSkill

    retro

    Conduct a retrospective on a coding session.

    Also in 4 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

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

    Read-only audit against the mangrove-agent repo.

    line 10
  2. Distinctive:

    Wallet + signing invariants: Verify:

    line 23
  3. Very specific:

    No tool returns encrypted_secret, raw Fernet ciphertext, or secret fields in its response.

    line 38
  4. Distinctive:

    No endpoint returns wallet plaintext.

    line 43
  5. Very specific:

    Check .env.example and server/src/config/*-config.json for accidentally committed real keys.

    line 54
  6. Very specific:

    Write a report to agent-data/audits/YYYY-MM-DD-mangrove-agent-security-audit.md with this shape:

    line 64
  7. Distinctive:

    Read-only: Never modify source code, tests, or configuration.

    line 92
  8. Very specific:

    Redact secrets: If you encounter a plaintext key or API token in any file, replace with * in the report.

    line 93
  9. Distinctive:

    No exploits: Never run network-level attack tests or modify running services.

    line 94

“Common” is measured: kept by at least 6 in 10 of the 17 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 - mangrove-agent trading bot

Read-only audit against the mangrove-agent repo. Covers:

  • Wallet + signing surfaces (post-2026-04-24 incident focus)
  • Web3 / crypto-specific threats (EIP-7702 delegation, permit abuse, tx replay, router allowlist drift, private-key lifetime, Fernet at rest)
  • MCP tool layer (auth tier assignments, tool input validation, response leakage)
  • OWASP Top 10 + CWE/SANS Top 25 (SQL injection via SQLite, SSRF via webhook URLs, path traversal via config files, etc.)
  • Dependency CVEs (pip-audit / safety check against server/requirements.txt)
  • Infrastructure (hook registration, docker-compose exposure, default API key shipping)

Process

  1. Check for prior audits at agent-data/audits/*-security-audit.md (local and gitignored; audit reports are not published). If a recent one exists, read it to avoid re-flagging fixed issues and to track remediation.
  2. Wallet + signing invariants. Verify:
    • transaction_intent.validate_transaction rejects unsupported types/chains/selectors, authorization lists, malformed ABI, mismatched chain/assets/recipient/amounts, native value and excessive fees before key access.
    • The isolated custody broker independently pins wallet, router, executor, input/output floor, payees, validity, lifetime spending/fee budgets and replay state; request arguments cannot authorize wider limits.
    • Custody runs as a distinct non-root UID with private state and root-owned immutable code/runtime/policy. Check ACLs and peer credentials; same-user processes and agent-controlled containers are insufficient.
    • sign_message() still refuses general signing. Dedicated x402/SIWX/marketplace proofs retain their own structure, identity, expiry and approval checks.
    • Plaintext loading is custody-internal; ordinary API/MCP/RPC has no export, stash, import, backup-confirmation or budget-reset authority.
    • Human backup/import use direct independent custody administration. Verify recovery and guarded legacy retirement before calling an old installation migrated.
  3. Hook-enforcement gaps. For each hook in .claude/hooks/*.sh:
    • Confirm it's registered in .claude/settings.json under the right matcher.
    • Confirm it set -uo pipefail, handles malformed JSON without crashing, and uses proper exit codes (0 = allow, 2 = block).
    • Confirm it doesn't log or exfiltrate secrets in its stderr message (particularly block-wallet-secrets.sh).
  4. MCP tool layer. For each tool in server/src/mcp/tools.py:
    • Auth tier matches the sensitivity (no auth-gated tool slipped into free tier).
    • No tool returns encrypted_secret, raw Fernet ciphertext, or secret fields in its response.
    • api_key param is validated via _require() before the tool body runs.
  5. REST routes. For each route in server/src/api/routes/*.py:
    • Auth dependency is wired correctly.
    • No endpoint returns wallet plaintext. Both former reveal routes, stash/import and backup confirmation return 410; disabled local authentication refuses privileged access.
    • Pydantic validators enforce slippage caps, chain allowlists, and amount bounds.
  6. Dependency CVEs.
    cd server && pip install pip-audit && pip-audit -r requirements.txt
    Report HIGH / CRITICAL findings only.
  7. Secret handling.
    • grep -rE "(private_key|seed_phrase|mnemonic|secret|API_KEY)" server/src/ - every hit should be a name, not a plaintext value.
    • Check .env.example and server/src/config/*-config.json for accidentally committed real keys.
    • git log --all -p -- '*.env*' '*config*' - check git history for leaked secrets.
  8. Infrastructure.
    • docker-compose.yml - no bind mounts exposing host secrets; port bindings match the documented 9080.
    • .github/workflows/ci.yml - no secret leakage in logs; ${{ secrets.* }} usage is minimal.
    • scripts/*.sh - input validated; no command injection via user input.

Output

Write a report to agent-data/audits/YYYY-MM-DD-mangrove-agent-security-audit.md with this shape:

# Security Audit - YYYY-MM-DD

## Summary
Overall severity + high-level findings count by CRITICAL / HIGH / MEDIUM / LOW.

## Findings
### [CRITICAL] <short title>
- **Location:** `path/to/file.py:LN`
- **CWE:** CWE-N - Name
- **Description:** what's wrong
- **Impact:** what could happen
- **Remediation:** concrete fix

(repeat per finding)

## Done Well
- Strict transaction-intent validation and isolated custody refuse new EIP-7702 authorization signing
- (etc.)

## Dependencies
List of CVEs from pip-audit with fix recommendations.

Constraints

  • Read-only. Never modify source code, tests, or configuration.
  • Redact secrets. If you encounter a plaintext key or API token in any file, replace with *** in the report.
  • No exploits. Never run network-level attack tests or modify running services.
  • Cite every finding. File path + line number + CWE ID. No generic "this could be exploited" language without a specific pointer.
  • Acknowledge good practices. The "Done Well" section matters - the encrypted custody state, OS boundary and narrow signing policies need evidence for their actual deployment, and the audit should record what's working.

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.