swain-security-check
Run all security scanners against the project and produce a unified, severity-bucketed report. Orchestrates gitleaks (secrets), osv-scanner/trivy (dependency vulns), semgrep (static analysis), context-file injection scanner (built-in), and repo hygiene checks (built-in). Missing scanners are skipped with install hints — the scan always completes. Triggers on: 'security check', 'security scan', 'run security', 'scan for secrets', 'check for vulnerabilities', 'security audit', 'audit dependencies', 'check secrets', 'find vulnerabilities', 'scan codebase'.
What this skill does
<!-- swain-model-hint: sonnet, effort: medium --> # Security Check <!-- session-check: SPEC-121 --> Before proceeding with any state-changing operation, check for an active session: ```bash REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" bash "$REPO_ROOT/.agents/bin/swain-session-check.sh" 2>/dev/null ``` If the JSON output has `"status"` other than `"active"`, inform the operator: "No active session — start one with `/swain-init`?" Proceed if they dismiss. Unified security scanning orchestrator. Checks scanner availability, runs all available scanners against the project, normalizes findings into a severity-bucketed report, and presents results in both JSON and markdown formats. ## When invoked Run the security check script: ```bash REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" SEC_SCRIPT="$REPO_ROOT/.agents/bin/security_check.py" [ -n "$SEC_SCRIPT" ] && python3 "$SEC_SCRIPT" . || echo "security_check.py not found" ``` For JSON output: ```bash REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" SEC_SCRIPT="$REPO_ROOT/.agents/bin/security_check.py" [ -n "$SEC_SCRIPT" ] && python3 "$SEC_SCRIPT" --json . || echo "security_check.py not found" ``` ## Orchestration flow 1. **Check availability** — detect which external scanners are installed (per SPEC-059) 2. **Run scanners** — invoke each available scanner against the project: - **gitleaks** (secrets) — `gitleaks detect --source . --report-format json` - **osv-scanner** or **trivy** (dependency vulns) — scan lockfiles and manifests - **semgrep** (static analysis) — `semgrep --config p/ai-best-practices` - **Context-file scanner** (built-in, always runs) — scan all agentic context files for injection patterns (SPEC-058, categories A-J) - **Repo hygiene** (built-in, always runs) — .gitignore completeness, tracked .env files 3. **Normalize** — map all findings to unified format (scanner, file, line, severity, description, remediation) 4. **Report** — severity-bucketed output (critical/high/medium/low) with summary line ## Graceful degradation Missing external scanners are **skipped with a warning** — the scan never fails due to a missing tool. The two built-in scanners (context-file scanner and repo hygiene) always run, so the scan always produces results. Each skipped scanner includes an install hint in the report. ## Exit codes | Code | Meaning | |------|---------| | 0 | No findings | | 1 | Findings present | | 2 | Error (e.g., invalid path) | ## Report format ### Severity levels - **Critical** — secrets in source, tracked .env files, instruction override patterns - **High** — role hijacking, privilege escalation, encoding obfuscation - **Medium** — missing .gitignore patterns, dependency vulnerabilities - **Low** — informational findings ### Per-finding fields | Field | Description | |-------|-------------| | scanner | Which scanner produced the finding | | file_path | File where the finding was detected | | line | Line number (0 if not applicable) | | severity | critical, high, medium, or low | | description | What was found | | remediation | How to fix it | ### Summary line Example: `1 critical, 2 high, 0 medium, 0 low findings (3 total) across 4 scanners` ## Integration points - **swain-doctor** (SPEC-061) — runs a lightweight context-file scan during session startup - **swain-do** (SPEC-063) — pre-claim security briefing for security-sensitive tasks - **swain-init** — configures gitleaks pre-commit hook during project onboarding - **External security skills** (SPEC-065) — hook interface for third-party security skills ## External Security Skill Hook Interface Read [references/external-hook-api.md](references/external-hook-api.md) for the hook registration contract, event schema, and integration patterns. ## Dependencies - SPEC-058: Context-file injection scanner (`context_file_scanner.py`) - SPEC-059: Scanner availability detection (`scanner_availability.py`) - SPEC-065: External security skill hook interface (`external_hooks.py`)
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.