Cso

From shenxingy/Clade · View interactive version

Cso is an AI agent skill from the GitHub repository shenxingy/Clade. Security audit skill — systematic OWASP + STRIDE review of a project. Covers attack surface, secrets archaeology, dependency supply chain, OWASP Top 10, threat modeling, and false-positive filtering. Outputs a prioritized findings report.

How to use this skill

Skill file

Clade for Codex

This workflow runs directly in Codex. Do not launch the claude CLI or

delegate the workflow to Clade's MCP bridge.

Codex compatibility rules:

$clade:cso; a bare $name does not select the installed Clade plugin.

has only CLAUDE.md, treat it as legacy project guidance and read it too.

state). Existing legacy Claude state may be read for migration, but do not

create new vendor-specific state.

$clade:skill-name plugin skill, or the same workflow invoked naturally when

explicit skill invocation is not available.

workflow names a vendor-specific tool. If a capability is unavailable, use

the documented fallback instead of spawning another agent CLI.

containing this SKILL.md; resolve that root before invoking a helper.

Canonical Clade workflow

You are the CSO (Chief Security Officer) skill. You perform a systematic security audit of the project.

Mode


Weigh findings by whether the layer runs

Before ranking anything, read docs/layers.json. It declares which surfaces of

this repository are actually run and how much a finding in each one is worth:

them below any load-bearing finding. Do not propose deleting the layer and

do not present its gaps as debt; new work there is opt-in.

plus its regen script, not in the copy.

This exists because an audit of this repository spent most of its effort on the

orchestrator, a layer the owner had switched off months earlier. Nothing in the

tree said so, so the effort looked well spent right up until it was reported.


Phase 0: Context Gathering

git branch --show-current
ls -la                    # project structure
cat AGENTS.md 2>/dev/null | head -30   # tech stack

Identify:


Phase 1: Attack Surface Census

Map all entry points where attacker-controlled data enters the system:

Code surface:

Infrastructure surface:


Phase 2: Secrets Archaeology

Search for hardcoded secrets and credential exposure:

# Hardcoded secrets patterns
grep -rn "sk-\|api_key\s*=\|password\s*=\|secret\s*=\|token\s*=" \
     --include="*.py" --include="*.ts" --include="*.js" --include="*.env*" \
     . | grep -v ".git" | grep -v "__pycache__" | grep -v "node_modules"

# Check for .env files committed to git
git log --all --full-history -- "**/.env" "*.env"

# Check git history for removed secrets (they're still there)
git log --all -S "password" --oneline | head -10
git log --all -S "sk-" --oneline | head -10

Check CI/CD configs for exposed secrets:

find .github -name "*.yml" -o -name "*.yaml" 2>/dev/null | xargs grep -l "secret\|password\|key" 2>/dev/null

Phase 3: Dependency Supply Chain

# Python
pip-audit 2>/dev/null || safety check 2>/dev/null || \
  pip list --format=json | python3 -c "import sys,json; pkgs=json.load(sys.stdin); print(f'{len(pkgs)} packages — run pip-audit for vuln scan')"

# Node.js
npm audit --json 2>/dev/null | python3 -c "
import sys, json
try:
    d = json.load(sys.stdin)
    vulns = d.get('metadata', {}).get('vulnerabilities', {})
    print(f'Vulnerabilities: critical={vulns.get(\"critical\",0)}, high={vulns.get(\"high\",0)}, moderate={vulns.get(\"moderate\",0)}')
except: pass
" 2>/dev/null || true

Flag: unpinned major dependencies (e.g., requests>=2.0.0 instead of requests==2.31.0).


Phase 4: OWASP Top 10 Analysis

Load references/owasp-top10.md now — it contains the full checklist, high-signal grep patterns, and confidence guidance for each category.

Check each of the 10 categories using that reference. For each finding, confirm it's exploitable before flagging (skip if false positive — see Phase 6).


Phase 5: STRIDE Threat Model

Load references/stride.md now — it contains the full STRIDE analysis table, component template, and priority matrix.

For each major component (web server, database, auth service, background workers), work through S-T-R-I-D-E using that reference. Only flag items with a plausible attack path for this project's threat model.


Phase 6: False Positive Filter

Load references/false-positive-filter.md now — it contains 12 auto-discard rules, a self-check protocol, and confidence level definitions.

Apply all 12 rules to every finding. For each surviving finding, confirm there's a concrete attack path and real impact specific to this codebase. Assign a confidence level (HIGH/MEDIUM/LOW) per the reference.


Phase 7: Findings Report

Output a prioritized report:

SECURITY AUDIT REPORT
════════════════════════════════════════
Project: [name]   Branch: [branch]   Date: [date]
Mode: daily | comprehensive
Threat model: [brief description of attacker profile]

CRITICAL (must fix before ship)
  [C1] [A03-Injection] SQL injection at routes/users.py:87
       Attack: GET /users?id=1 OR 1=1--
       Impact: Full DB read access
       Fix: Use parameterized query — `cursor.execute("SELECT ... WHERE id = %s", (id,))`

HIGH (fix in this sprint)
  [H1] ...

MEDIUM (fix in next sprint)
  [M1] ...

LOW / Informational
  [L1] ...

DISCARDED (false positives filtered)
  - [DoS exclusion] Rate limiting on /api/generate — LLM cost risk is LOW (auth required)
  - [Test-only exclusion] Hardcoded credentials in tests/fixtures/

Summary: N critical, M high, P medium, Q low
════════════════════════════════════════

Save report to .clade/security-reports/YYYY-MM-DD.md.


Completion Status

Scope note: This is an AI-assisted audit, not a penetration test. Flag findings confidently but caveat that manual verification is needed before treating any finding as confirmed exploitable.


Deep-Dive Mode (optional)

For HIGH-confidence findings in critical files, spawn the security-auditor subagent for line-by-line analysis:

Use a Codex subagent when available with subagent_type="security-auditor":
  "Audit [file path] for [specific vulnerability category]. Context: [what you already know about this component]"

Merge the subagent's findings into the main report. The subagent has no Write access — it only reads and reports.


Error Handling

| Scenario | Action |

|----------|--------|

| Cannot read key source files (permission denied) | Note in report as "Partial audit — [file] unreadable". Continue with what's accessible. |

| No package manager detected (no requirements.txt, package.json, etc.) | Skip Phase 3, note "Dependency audit skipped — no package manifest found" |

| Git history unavailable | Skip git-based secret archaeology, note it |

| Project is non-code (docs-only, config-only) | Output "No attack surface found — this directory contains no executable code" |

| Ambiguous tech stack | List what was detected, ask user to confirm before proceeding with OWASP analysis |

Delivery completion

If this workflow changes files or external state:

repository task.

$clade:delivery and create a repository-compliant checkpoint or preserve

the work when committing is unavailable.

deployment, or live verification part of the task, do not silently downgrade

the result to local-only work.

or reachable external state, report BLOCKED or NEEDS_CONTEXT rather than

appending a "not committed/pushed/deployed" caveat after DONE.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.