/papi:security-auditfrom papi
Scans entire codebase for OWASP top 10, secret exposure, dependency vulnerabilities, auth gaps, and unprotected endpoints. Use for periodic full reviews or before releases.
Ships in papi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Perform a comprehensive security audit of the entire codebase. This is NOT a branch diff review — it scans all source files for security issues.
/security-auditSearch for hardcoded secrets, API keys, tokens, and credentials in source code.
Patterns to check:
grep -r for patterns: sk-, sk_live, sk_test, SUPABASE_SERVICE_ROLE, eyJ (JWT prefixes), ghp_, npm_, Bearer .ts, .tsx, .js files for process.env usage — verify each env var is listed in .env.example.env and .env.local are in .gitignoreIMPORTANT: Never include actual secret values in the report. Reference file:line only.
Severity: Critical if secrets found in source, Warning if env var not in .env.example
Review auth middleware and access control.
Files to read:
middleware.ts — auth middleware, route protectionlib/auth.ts or similar — auth helper functionsapp/api/**/route.ts — every API routeCheck for:
getServerSession or equivalent)user_id scoping on all tables with user dataSeverity: Critical for unprotected endpoints, High for weak auth patterns
Check for unsafe database queries.
Check for:
Severity: Critical for SQL injection vectors, High for data exposure
Check React components for XSS vectors.
Check for:
dangerouslySetInnerHTML usage — verify input is sanitizedeval(), new Function(), or dynamic script injectionSeverity: High for XSS vectors, Medium for potential issues
Read next.config.ts or next.config.js for security headers.
Required headers:
Content-Security-Policy — verify it's not too permissiveStrict-Transport-Security (HSTS)X-Content-Type-Options: nosniffX-Frame-Options: DENY or SAMEORIGINReferrer-PolicySeverity: Medium for missing headers, Low for suboptimal values
Use the project's authorized dependency audit path and existing dependency tree. Keep its complete JSON and exit code in a quoted, uniquely owned TASK_STAGING path, then summarize. Do not truncate the source or install a scanner. Apply framework-specific checks only where that framework exists.
npm audit --json > $TASK_STAGING/dependency-audit.json
Report: Count of critical/high/moderate/low vulnerabilities. Flag any with known exploits.
Severity: Critical/High matching npm audit severity
Check for configuration security issues.
Check for:
* in productionSeverity: High for exposed debug info, Medium for missing rate limits
Background: A common latent vulnerability class: a fix adds proper user/tenant scoping only for the happy path — when the auth or DB client initializes successfully — and leaves the unhappy path (the dependency is unavailable, misconfigured, or an env var is missing) falling through to an unscoped or default-tenant response. The app then fails open in exactly the condition where it should fail closed.
Check every auth and data-scoping path for what happens when a dependency is unavailable:
What to check:
getDbClient(), getSupabaseServer(), getSession()) — what does it return when required env vars or connections are missing?Pattern to flag: Any code path of the form:
const client = getScopedClient();
if (client) {
// scope data by user_id / tenant_id
}
// falls through here WITHOUT scoping if client is null/undefined
Required behaviour: If a request is authenticated but the system cannot verify its scope (tenant/user/project), the response MUST be an error (e.g. 503) — never a fallback to a default, global, or owner-level dataset.
Severity: Critical if fail-open exposes another user's/tenant's data, High if fail-open exposes any unscoped data
Background: Many frameworks gate auth with an allowlist of "public" paths matched by prefix (e.g. PUBLIC_PATHS.some(p => pathname.startsWith(p))). A broad prefix like /api/auth makes every future route added under that prefix public by default — a developer (or LLM) adding a new route there won't know they just created an unauthenticated endpoint.
Files to check:
middleware.ts, proxy.ts, or your framework's equivalent) — find the public-path/allowlist definition.Check for:
/api/auth, /api/internal) rather than a specific pathRequired pattern: Each entry in the allowlist must be a specific, fully-qualified path (e.g. /api/auth/callback), not a prefix that would match a whole directory of routes.
Also check: Any PR or recent commit that modified the allowlist — these changes are high-risk and should always be reviewed manually.
Severity: High if broad prefix found that covers routes not intended to be public, Medium if path was added without documented rationale
Present findings as a structured report:
# Security Audit Report — [date]
## Summary
- Critical: N findings
- High: N findings
- Medium: N findings
- Low: N findings
## Critical Findings
### [CRIT-1] Title
- **File:** path/to/file.ts:line
- **Issue:** Description
- **Fix:** Recommended remediation
## High Findings
### [HIGH-1] Title
...
## Medium Findings
...
## Low Findings
...
## What Was Checked
- [ ] Secret exposure scan
- [ ] Auth & authorization review
- [ ] SQL injection & data access
- [ ] XSS & client-side security
- [ ] HTTP security headers
- [ ] Dependency vulnerabilities
- [ ] Environment & configuration
- [ ] Degraded-mode analysis (fail open vs fail closed)
- [ ] Route-guard / public-path audit
## Recommendations
Prioritized list of next actions.
These are real vulnerability classes found in production multi-tenant apps. Use them as a checklist baseline, not a complete list:
| Pattern | Root Cause | Fix |
|---|---|---|
| Permissive fallback policies override scoped ones | A base/default schema or policy created broad-access rules that a later, narrower rule didn't fully replace | Audit and remove all default-allow policies once scoped ones exist |
| Cross-tenant data leak via missing scoping | A route falls back to a default/global ID when the request-specific ID is absent | Add explicit scoping with no fallback; return empty/error instead |
| Latent fail-open on dependency unavailability | Scoping logic only runs in the if (client) branch; the implicit else path serves unscoped data | Fail closed (e.g. 503) before the scoping check, not after |
| Broad prefix in a public-path allowlist | A prefix like /api/auth was added for convenience and never revisited as new routes were added under it | Replace prefixes with explicit, fully-qualified paths |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
papi@buildwithclaude is listed by davepoon/buildwithclaude — review the source before installing
npx claudepluginhub davepoon/buildwithclaude --plugin papi14 skills in this plugin
/check-mcpDiagnose why PAPI tools are missing or failing. Use when the user says "check mcp", "is papi connected", "papi isn't working", "mcp status", or when PAPI tools are expected but do not appear in the available tools list./deployment-completeness-auditRead-only audit of changes that were built but not wired, deployed or exercised. Trace the target project's actual release path, runtime, migrations and adapters; report evidence and missing access honestly./designDesign and critique any visible UI, before and after building. Trigger on UI work: "improve the UI", "redesign", "polish", "make it look better", "visual upgrade", "design review", "design audit", "layout fix", "UX improvement", or any task whose deliverable is a page, screen, or component that renders. Shapes a direction, critiques the surface, builds, and verifies. Reads the project's own DESIGN.md and PRODUCT.md at run time. If you are about to write or edit anything that renders visible UI, use this skill first.
Other plugins' skills for the same job