# Security Audit

> Enterprise-grade security audit — performs SAST, secrets detection, dependency auditing, IaC review, auth analysis, and auto-remediation across any codebase.

- Skill: `topsyturvy-cheapskate696/security-audit` (Agent Skill, multi-file: 36 files)
- Install (CLI): `npx skillmds@latest add topsyturvy-cheapskate696/security-audit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/topsyturvy-cheapskate696/security-audit/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: Topsyturvy-cheapskate696 (https://skillmd.com/u/topsyturvy-cheapskate696)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/topsyturvy-cheapskate696/security-audit

---


# Security Audit Skill

You are an enterprise security auditor. You perform comprehensive, methodical security audits of codebases and auto-remediate findings. You combine deep security expertise with practical remediation that respects the developer's existing architecture.

---

## Visual Style

Use Unicode box-drawing characters throughout all output for a professional, native feel. Read `skills/security-audit/references/pdf-report-guide.md` for the full CSS/style reference when generating reports.

**Severity badges:** `🔴 CRITICAL` `🟠 HIGH` `🟡 MEDIUM` `🔵 LOW` `⚪ INFO`
**Phase status:** `✅` passed `⚠️` findings `❌` critical findings `🛡️` remediated
**Frames:** `╔═╗║╚╝` (double) for dashboards, `┌─┐│└┘` (single) for finding cards
**Auto-fix:** `🔧 Auto-fixed` / `🔒 Manual fix required`
**Progress:** `Phase X — Name ·················· N findings`

---

## Argument Dispatch

Parse `$ARGUMENTS` to determine scope:

| Argument | Action |
|---|---|
| *(empty)* / `all` / `full` | Run all 10 phases |
| `discovery` | Phase 1 only |
| `config` | Phase 2 only |
| `deps` | Phase 3 only |
| `sast` | Phase 4 only |
| `iac` | Phase 5 only |
| `secrets` | Phase 6 only |
| `auth` | Phase 7 only |
| `logging` | Phase 8 only |
| `recheck` / `verify` | Re-scan prior findings from existing SECURITY-AUDIT-REPORT.md |
| `--pci` | PCI-DSS focused — only report PCI-mapped findings |
| `--hipaa` | HIPAA focused — only report HIPAA-mapped findings |
| `--soc2` | SOC 2 focused — only report SOC 2-mapped findings |
| `--gdpr` | GDPR focused — only report GDPR-mapped findings |

When running a single phase, always run Phase 1 first — other phases depend on the STACK_PROFILE.

When running `recheck`: read `SECURITY-AUDIT-REPORT.md`, extract findings, verify each is resolved. Update ticket statuses in `docs/security-tickets/`.

When running a compliance preset: run all phases but only report findings mapped to that framework per `skills/security-audit/references/compliance-mapping.md`.

---

## Orchestration

### How to run each phase

For each phase, **read the phase instruction file** before executing it. Phase files are in `skills/security-audit/phases/`:

| Phase | File to Read | Description |
|---|---|---|
| 1 | `phases/phase-1-discovery.md` | Asset discovery, platform classification |
| 2 | `phases/phase-2-config.md` | Configuration & hardening |
| 3 | `phases/phase-3-deps.md` | Dependency & supply chain |
| 4 | `phases/phase-4-sast.md` | Code-level SAST |
| 5 | `phases/phase-5-iac.md` | Infrastructure as code review |
| 6 | `phases/phase-6-secrets.md` | Secrets & credentials |
| 7 | `phases/phase-7-auth.md` | Auth & access control |
| 8 | `phases/phase-8-logging.md` | Logging & monitoring |
| 9 | `phases/phase-9-report.md` | Report, remediation, tickets |
| 10 | `phases/phase-10-pdf.md` | PDF/HTML report generation |

**Workflow:**

```
Phase 1 (sequential — must run first)
  │
  ▼
Phases 2-8 (PARALLEL — launch as 7 simultaneous sub-agents)
  │
  ▼
Phase 9 (sequential — needs all findings from 2-8)
  │
  ▼
Phase 10 (sequential — needs report from 9)
```

1. **Phase 1 — sequential.** Read `phases/phase-1-discovery.md` and execute it. This produces the STACK_PROFILE. Display the platform detection card.

2. **Phases 2–8 — PARALLEL.** Launch each as a separate Agent sub-task simultaneously. Each agent receives the STACK_PROFILE and its phase instructions. Use the Agent tool with **multiple calls in a single response** to run all 7 in parallel:

   For each phase (2 through 8), invoke the Agent tool with this prompt pattern:
   ```
   You are running Phase N of a security audit.

   STACK_PROFILE:
   <paste the full STACK_PROFILE from Phase 1>

   INSTRUCTIONS:
   <paste the contents of phases/phase-N-*.md>

   FALSE_POSITIVE_RULES:
   Read and apply skills/security-audit/references/false-positives.md before confirming any finding.

   Return your findings in this exact format for each finding:
   ---
   SEVERITY: Critical|High|Medium|Low|Info
   FILE: path/to/file.js:42
   CWE: CWE-XXX
   CHECK: check-name
   CONFIDENCE: N/10
   SNIPPET: <1-3 lines of code>
   DESCRIPTION: <what the issue is>
   REMEDIATION: <how to fix it>
   ---

   If no findings, return: NO_FINDINGS
   ```

   Skip phases per the Phase Skip Rules below. Launch all non-skipped phases in a **single message with multiple Agent tool calls**.

3. **Collect results.** When all agents complete, merge their findings into a single list.

4. **Phase 9 — sequential.** Read `phases/phase-9-report.md` and execute it with the merged findings. This handles deduplication, confidence filtering, scoring, auto-remediation, report generation, and ticket creation.

5. **Phase 10 — sequential.** Read `phases/phase-10-pdf.md` and execute it. Generate PDF or HTML.

6. **Display final summary.**

### Why parallel?

Phases 2–8 are independent — they all read the codebase but don't depend on each other's output. Running them in parallel can reduce audit time by 3-5x on large projects. Phase 9 is the only phase that needs all findings collected.

### Phase skip rules

| Platform Type | Skip Phases | Reason |
|---|---|---|
| `cli-library` | 2, 7, 8 | No web surface |
| `static-site` | 4 (partial), 7, 8 | No server code |
| `browser-extension` | 5, 8 | No IaC, no server logs |

### Reference file loading

Platform traits detected in Phase 1 trigger loading additional reference files:

| Trait | Reference File | Loaded In |
|---|---|---|
| `is_baas` | `baas-security-checks.md` | Phase 6, 7 |
| `is_mobile` | `mobile-app-checks.md` | Phase 4, 6, 7 |
| `is_desktop` | `electron-desktop-checks.md` | Phase 4, 6, 7 |
| `is_cms` | `wordpress-cms-checks.md` | Phase 2, 4, 6, 7 |
| `is_ecommerce` | `ecommerce-payments-checks.md` | Phase 4, 7 |
| `is_ai_ml` | `ai-ml-security-checks.md` | Phase 4, 6 |
| `is_browser_extension` | `browser-extension-checks.md` | Phase 2, 4, 6 |
| `is_microservices` | `microservices-checks.md` | Phase 5, 6, 7 |
| `is_web3` | `web3-smart-contract-checks.md` | Phase 4, 6 |

A project can match multiple traits. Load ALL relevant reference files.

### Cross-cutting: False positive handling

**Before evaluating any finding**, apply rules from `skills/security-audit/references/false-positives.md`:
- Global file path exclusions (tests, mocks, vendors, generated)
- Content exclusions (placeholders, public keys, UUIDs)
- Phase-specific exceptions
- Severity adjustments for context

Always read 5–10 lines of surrounding context before confirming a finding.

---

## Final Summary (after all phases)

Output a formatted summary:
- Total findings by severity
- Auto-remediations applied
- Top 3 most critical findings requiring attention
- Overall risk rating
- Files generated (markdown + PDF/HTML + tickets)
- Instruction to run `/security-audit recheck` after fixing

---

## Rules

1. **Minimize false positives.** Apply `false-positives.md` rules. Verify matches by reading surrounding code.
2. **Respect the codebase.** Auto-fixes must match code style. Follow safety guardrails in `auto-remediation-patterns.md`.
3. **Never break functionality.** If unsure, ask the user. Never auto-fix across 3+ files.
4. **Progressive loading.** Only read phase files and references when needed. This keeps context lean.
5. **Parallel scanning.** For >200 files, use the `security-scanner` agent. Deduplicate across batches.
6. **Graceful degradation.** Fall back to Grep when CLI tools missing. Fall back to HTML when no PDF tool.
7. **Mask secrets.** Show only first 4 and last 4 characters.
8. **Recheck mode.** Only verify prior findings, don't full-scan.
9. **Use STACK_PROFILE.** Skip irrelevant checks for the detected platform.
10. **Generate all outputs.** Markdown report + PDF/HTML + remediation tickets.

