Skip to content

maxwellokumu/okaudit-claude-skills / application-security/appsec-playbook

appsec-playbook

Verified

Guide Claude through a structured application security audit covering threat modeling, testing, pipeline review, dependency risk, and vulnerability management.

FileKindSize
README.mdmarkdown634 B
SKILL.mdskill md1.6 KB
main.pyscript13.4 KB
skill.yamlconfig698 B
"""Application Security Audit Playbook.

Six-step guide covering threat modelling, SAST, DAST, supply chain,
DevSecOps pipeline review, and vulnerability management.
"""

import argparse
import sys
from typing import Dict, List

STEPS: Dict[int, Dict] = {
    1: {
        "title": "Threat Modeling & Attack Surface Review",
        "objective": (
            "Identify and document the application's attack surface, data flows, trust boundaries, "
            "and potential threat actors before any technical testing begins."
        ),
        "artefacts": [
            "Application architecture diagram (system context, container, component level)",
            "Data flow diagrams (DFDs) with trust boundaries marked",
            "STRIDE threat model document",
            "Attack surface inventory: endpoints, APIs, input vectors, authentication entry points",
            "OWASP Threat Dragon or Microsoft Threat Modeling Tool export",
        ],
        "tools_commands": [
            "# Generate DFD and STRIDE model using Threat Dragon",
            "# threat-dragon --project app.json --output threat_model.pdf",
            "# List all exposed endpoints",
            "# nmap -sV -p- --open target.example.com",
            "# Enumerate API surface",
            "# ffuf -w /usr/share/wordlists/api_endpoints.txt -u https://api.example.com/FUZZ",
        ],
        "must_do_checks": [
            "Document all entry points: web, API, mobile, IoT, CLI, batch jobs",
            "Identify authentication and authorisation boundaries",
            "Map all third-party integrations and data flows to/from external systems",
            "Classify data sensitivity (PII, financial, health, credentials)",
            "Apply STRIDE to each DFD element: Spoofing, Tampering, Repudiation, Info Disclosure, DoS, Elevation",
            "Confirm threat model is reviewed by application owner and security team",
            "Link identified threats to OWASP Top 10 and relevant compliance controls",
        ],
        "linked_skills": [],
    },
    2: {
        "title": "SAST & Code Review",
        "objective": (
            "Identify security vulnerabilities in source code using automated static analysis "
            "and targeted manual code review for high-risk code paths."
        ),
        "artefacts": [
            "SAST scan report (Semgrep, Bandit, SonarQube, or similar)",
            "Code Security Review report (generated by code-review-helper)",
            "Manual code review findings for authentication, authorisation, and crypto",
            "Secrets scan results (Gitleaks / TruffleHog)",
        ],
        "tools_commands": [
            "python application-security/code-review-helper/main.py --code src/app.py --language python",
            "python application-security/code-review-helper/main.py --code src/app.js --language javascript",
            "semgrep --config=auto --json --output=semgrep.json .",
            "bandit -r . -f json -o bandit.json",
            "gitleaks detect --source . --report-format json --report-path gitleaks.json",
        ],
        "must_do_checks": [
            "Run at least one automated SAST tool against the full codebase",
            "Manually review authentication logic: session management, JWT handling, OAuth flows",
            "Check all SQL queries and ORM usage for injection risks",
            "Review file upload and download handlers for path traversal",
            "Verify all cryptographic operations use approved algorithms (AES-256, SHA-256+)",
            "Confirm no secrets, keys, or passwords in source code or git history",
            "Review error handling — ensure stack traces not exposed to users",
            "Check for insecure direct object references (IDOR) in API endpoints",
        ],
        "linked_skills": ["application-security/code-review-helper"],
    },
    3: {
        "title": "DAST & Penetration Testing",
        "objective": (
            "Test the running application for vulnerabilities that only manifest at runtime, "
            "including injection flaws, authentication bypasses, and business logic errors."
        ),
        "artefacts": [
            "OWASP ZAP or Burp Suite scan report",
            "Penetration test report (if scope includes manual pentest)",
            "Authentication bypass and session management test results",
            "API security test results (OWASP API Security Top 10)",
        ],
        "tools_commands": [
            "# OWASP ZAP baseline scan",
            "docker run -t owasp/zap2docker-stable zap-baseline.py -t https://staging.example.com -r zap_report.html",
            "# Full ZAP active scan",
            "docker run -t owasp/zap2docker-stable zap-full-scan.py -t https://staging.example.com",
            "# Nikto web server scan",
            "nikto -h https://staging.example.com -o nikto_report.html -Format html",
        ],
        "must_do_checks": [
            "Run DAST against staging/non-production environment only",
            "Test all OWASP Top 10 categories: injection, auth, XSS, IDOR, misconfig, etc.",
            "Test OWASP API Security Top 10 for all REST/GraphQL endpoints",
            "Verify session tokens are invalidated on logout",
            "Test password reset and account recovery flows for weaknesses",
            "Check for clickjacking, CSRF, and open redirect vulnerabilities",
            "Verify rate limiting is enforced on authentication and sensitive endpoints",
            "Test for server-side request forgery (SSRF) on any URL-fetching functionality",
        ],
        "linked_skills": [],
    },
    4: {
        "title": "Dependency & Supply Chain Security",
        "objective": (
            "Assess the security of all third-party libraries, packages, and build-time "
            "dependencies to reduce software supply chain risk."
        ),
        "artefacts": [
            "Software Bill of Materials (SBOM) in SPDX or CycloneDX format",
            "Dependency vulnerability scan report (Snyk, OWASP Dependency-Check, Safety)",
            "Licence compliance review",
            "Container image vulnerability scan (Trivy or Grype)",
        ],
        "tools_commands": [
            "# Generate SBOM",
            "syft . -o spdx-json=sbom.spdx.json",
            "# Python dependency check",
            "safety check -r requirements.txt --full-report",
            "pip-audit -r requirements.txt",
            "# Node.js",
            "npm audit --json > npm_audit.json",
            "# Container image",
            "trivy image --severity CRITICAL,HIGH --format json myapp:latest > trivy.json",
            "grype myapp:latest -o json > grype.json",
        ],
        "must_do_checks": [
            "Generate SBOM for all applications — include transitive dependencies",
            "Identify and remediate all Critical and High CVEs in dependencies",
            "Check for end-of-life (EOL) packages with no security support",
            "Verify licence compliance — flag copyleft licences (GPL) in commercial software",
            "Confirm package checksums/hashes are pinned in lock files",
            "Review container base image — use minimal images (distroless, Alpine)",
            "Check for dependency confusion attacks — verify private package names are not typosquattable",
            "Implement automated SCA scanning in CI/CD pipeline",
        ],
        "linked_skills": [],
    },
    5: {
        "title": "DevSecOps Pipeline Review",
        "objective": (
            "Evaluate the CI/CD pipeline configuration to ensure security controls "
            "are integrated at every stage from commit to production deployment."
        ),
        "artefacts": [
            "CI/CD pipeline configuration files (GitHub Actions, GitLab CI, Jenkins)",
            "DevSecOps Pipeline Security Report (generated by devsecops-checker)",
            "Pipeline security maturity score",
            "Gap analysis and remediation roadmap",
        ],
        "tools_commands": [
            "python application-security/devsecops-checker/main.py --config .github/workflows/ci.yml",
            "python application-security/devsecops-checker/main.py --config .gitlab-ci.yml",
            "python application-security/devsecops-checker/main.py --config Jenkinsfile --output json",
        ],
        "must_do_checks": [
            "Confirm SAST, SCA, and secrets scanning run on every pull request",
            "Verify security scan failures block merge — exit codes are non-zero on critical findings",
            "Confirm manual approval gate exists before every production deployment",
            "Check that staging and production are separate environments with different credentials",
            "Verify build artifacts are cryptographically signed (Cosign/Sigstore)",
            "Confirm pipeline secrets are stored in a secrets manager (not plaintext in YAML)",
            "Check branch protection rules: require PR reviews, signed commits, status checks",
            "Verify OIDC is used for cloud provider authentication — no long-lived service account keys",
        ],
        "linked_skills": ["application-security/devsecops-checker"],
    },
    6: {
        "title": "Vulnerability Management & Reporting",
        "objective": (
            "Consolidate all AppSec findings into a prioritised vulnerability register and "
            "produce a management-ready report with remediation timelines."
        ),
        "artefacts": [
            "Consolidated vulnerability scan report (generated by vuln-parser)",
            "Risk-ranked vulnerability register (CSV/JSON)",
            "Executive summary with OWASP Top 10 mapping",
            "Remediation tracking spreadsheet with owners and SLA deadlines",
            "Retest evidence for closed findings",
        ],
        "tools_commands": [
            "python application-security/vuln-parser/main.py --scan all_findings.csv --top-hosts 10",
            "python application-security/vuln-parser/main.py --scan all_findings.csv --output json > findings.json",
            "# Generate executive summary",
            "python lead-it-auditor/exec-summary-writer/main.py --findings findings.json",
        ],
        "must_do_checks": [
            "Assign CVSS score and business impact rating to each finding",
            "Map each finding to OWASP Top 10 and relevant compliance framework (PCI DSS, ISO 27001)",
            "Set SLA deadlines: Critical=24h, High=7 days, Medium=30 days, Low=90 days",
            "Obtain developer and management sign-off on the vulnerability register",
            "Confirm retesting plan for all Critical and High findings",
            "Include positive findings (secure coding practices, strong controls) in executive summary",
            "Track vulnerability trends over time — compare against previous assessment",
            "Publish results to security dashboard for ongoing visibility",
        ],
        "linked_skills": [
            "application-security/vuln-parser",
            "lead-it-auditor/exec-summary-writer",
        ],
    },
}


def render_step(step_num: int, step: Dict) -> str:
    """Render a single playbook step as Markdown.

    Args:
        step_num: Step number.
        step: Step data dict.

    Returns:
        Markdown string.
    """
    lines: List[str] = []
    lines.append(f"## Step {step_num}: {step['title']}\n")
    lines.append(f"**Objective:** {step['objective']}\n")

    lines.append("### Artefacts to Collect\n")
    for a in step["artefacts"]:
        lines.append(f"- {a}")

    lines.append("\n### Tools & Commands\n")
    lines.append("```bash")
    for cmd in step["tools_commands"]:
        lines.append(cmd)
    lines.append("```")

    lines.append("\n### Must-Do Checks\n")
    for i, check in enumerate(step["must_do_checks"], start=1):
        lines.append(f"{i}. {check}")

    if step["linked_skills"]:
        lines.append("\n### Linked Skills\n")
        for skill in step["linked_skills"]:
            lines.append(f"- `{skill}`")

    return "\n".join(lines)


def parse_args() -> argparse.Namespace:
    """Parse CLI arguments."""
    parser = argparse.ArgumentParser(
        description="Application Security Audit Playbook"
    )
    parser.add_argument(
        "--step",
        default="full",
        help="Step number (1-6) or 'full' (default: full)",
    )
    return parser.parse_args()


def main() -> None:
    """Main entry point."""
    args = parse_args()

    lines: List[str] = []
    lines.append("# Application Security Audit Playbook\n")
    lines.append(
        "A structured guide for conducting a comprehensive application security audit "
        "covering the full secure development lifecycle.\n"
    )
    lines.append("| Step | Title |")
    lines.append("|------|-------|")
    for num, step in STEPS.items():
        lines.append(f"| {num} | {step['title']} |")

    if args.step == "full":
        lines.append("")
        for num, step in STEPS.items():
            lines.append("")
            lines.append(render_step(num, step))
    else:
        try:
            step_num = int(args.step)
        except ValueError:
            print(
                f"ERROR: --step must be 1-6 or 'full', got '{args.step}'",
                file=sys.stderr,
            )
            sys.exit(1)
        if step_num not in STEPS:
            print(
                f"ERROR: Step {step_num} not found. Valid steps: 1-6.",
                file=sys.stderr,
            )
            sys.exit(1)
        lines.append("")
        lines.append(render_step(step_num, STEPS[step_num]))

    print("\n".join(lines))


if __name__ == "__main__":
    main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall