Skip to content

Bruno-Cunha-Souza/ValarMindSkills / skills/code-security-review

code-security-review

Flagged

Web/API security lifecycle for Go, Next.js, Python, and Bun — design controls, active testing, supply-chain/CI-CD, and LLM/agentic/MCP coverage. Maps to OWASP Web Top 10 2025 + API 2023 + LLM 2025 + Agentic 2026. Triggers: 'security review', 'revisão de segurança', 'auditar segurança', 'pentest', '/code-security-review'.

FileKindSize
SKILL.mdskill md17.3 KB
references/AI_SECURITY.mdmarkdown9.5 KB
references/DESIGN_CONTROLS.mdmarkdown18.0 KB
references/REPORT_TEMPLATE.mdmarkdown2.6 KB
references/SUPPLY_CHAIN_CICD.mdmarkdown9.1 KB
references/TESTING_PHASES.mdmarkdown17.5 KB
references/WEB_VULNERABILITIES.mdmarkdown22.1 KB
references/golang/API.mdmarkdown27.6 KB
references/golang/MIDDLEWARE.mdmarkdown14.4 KB
references/golang/PATCHES.mdmarkdown15.0 KB
references/golang/TESTING_PAYLOADS.mdmarkdown10.9 KB
references/golang/VULNERABILITIES.mdmarkdown20.6 KB
references/nextjs/API.mdmarkdown38.5 KB
references/nextjs/CONFIGURATION.mdmarkdown15.7 KB
references/nextjs/PATCHES.mdmarkdown16.7 KB
references/nextjs/TESTING_PAYLOADS.mdmarkdown11.9 KB
references/nextjs/VULNERABILITIES.mdmarkdown35.7 KB
references/python/API.mdmarkdown36.0 KB
references/python/CONFIGURATION.mdmarkdown22.4 KB
references/python/PATCHES.mdmarkdown12.1 KB
references/python/TESTING_PAYLOADS.mdmarkdown12.8 KB
references/python/VULNERABILITIES.mdmarkdown28.1 KB
scripts/00-pre-checks.shexecutablescript3.7 KB
scripts/01-auth-probes.shexecutablescript5.4 KB
scripts/02-jwt-attacks.pyexecutablescript10.1 KB
scripts/03-bola-probes.shexecutablescript6.4 KB
scripts/04-injection-probes.shexecutablescript7.3 KB
scripts/05-burst.k6.jsscript1.9 KB
scripts/05-rate-limit.shexecutablescript5.0 KB
scripts/06-info-disclosure.shexecutablescript5.2 KB
scripts/07-supply-chain.shexecutablescript7.9 KB
scripts/08-cors-headers.shexecutablescript5.5 KB
scripts/09-cicd-workflows.shexecutablescript6.1 KB
scripts/10-secrets-scan.shexecutablescript5.2 KB
scripts/11-ai-llm-probes.shexecutablescript8.8 KB
scripts/README.mdmarkdown8.0 KB
scripts/lib/common.shscript4.8 KB
scripts/lib/report.pyscript5.4 KB
scripts/run-all.shexecutablescript4.8 KB

scripts/lib/report.py

View on GitHub
#!/usr/bin/env python3
"""Aggregate findings.jsonl into a human-readable Markdown report.

Usage:
    python3 lib/report.py out/findings.jsonl > out/report.md
    python3 lib/report.py out/findings.jsonl --json > out/summary.json
"""

# Findings are JSON records with intentionally heterogeneous evidence shapes; Any is deliberate.
# pyright: reportAny=false, reportExplicitAny=false, reportUnknownMemberType=false, reportUnknownArgumentType=false, reportUnknownVariableType=false

from __future__ import annotations

import json
import sys
from collections import Counter, defaultdict
from pathlib import Path
from typing import Any

SEVERITY_ORDER: tuple[str, ...] = ("critical", "high", "medium", "low", "info")
SEVERITY_BADGE: dict[str, str] = {
    "critical": "[CRITICAL]",
    "high":     "[HIGH]",
    "medium":   "[MEDIUM]",
    "low":      "[LOW]",
    "info":     "[INFO]",
}

Finding = dict[str, Any]


def load_findings(path: Path) -> list[Finding]:
    findings: list[Finding] = []
    if not path.exists() or path.stat().st_size == 0:
        return findings
    for lineno, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
        line = line.strip()
        if not line:
            continue
        try:
            findings.append(json.loads(line))
        except json.JSONDecodeError as e:
            print(f"# warning: skipping malformed line {lineno}: {e}", file=sys.stderr)
    return findings


def render_markdown(findings: list[Finding]) -> str:
    counts: Counter[str] = Counter(str(f.get("severity", "info")) for f in findings)
    by_phase: dict[str, list[Finding]] = defaultdict(list)
    for f in findings:
        by_phase[str(f.get("phase", "unknown"))].append(f)

    lines: list[str] = []
    lines.append("# Code Security Review — Active Probe Report")
    lines.append("")
    lines.append(f"_Generated from {len(findings)} finding(s)._")
    lines.append("")

    # --- Summary table ---
    lines.append("## Summary")
    lines.append("")
    lines.append("| Severity | Count |")
    lines.append("| --- | --- |")
    for sev in SEVERITY_ORDER:
        lines.append(f"| {SEVERITY_BADGE[sev]} | {counts.get(sev, 0)} |")
    lines.append(f"| **Total** | **{len(findings)}** |")
    lines.append("")

    if not findings:
        lines.append("> No findings recorded. Either the API passed all probes or no scripts were run.")
        lines.append("")
        return "\n".join(lines)

    # --- Verdict ---
    if counts.get("critical", 0) > 0:
        verdict = "FAIL — critical findings present, do not deploy"
    elif counts.get("high", 0) > 0:
        verdict = "FAIL — high-severity findings require remediation before deploy"
    elif counts.get("medium", 0) > 0:
        verdict = "REVIEW — medium-severity findings require triage"
    elif counts.get("low", 0) > 0:
        verdict = "PASS WITH NOTES — only low-severity findings"
    else:
        verdict = "PASS — only informational findings"
    lines.append(f"**Verdict:** {verdict}")
    lines.append("")

    # --- Findings grouped by severity ---
    for sev in SEVERITY_ORDER:
        sev_findings = [f for f in findings if f.get("severity") == sev]
        if not sev_findings:
            continue
        lines.append(f"## {SEVERITY_BADGE[sev]} ({len(sev_findings)})")
        lines.append("")
        for f in sev_findings:
            lines.append(f"### `{f.get('id', '?')}` — {f.get('endpoint', '?')}")
            lines.append("")
            lines.append(f"- **Phase:** `{f.get('phase', '?')}`")
            lines.append(f"- **OWASP:** {f.get('owasp', '—')}")
            lines.append(f"- **Timestamp:** {f.get('timestamp', '—')}")
            lines.append(f"- **Impact:** {f.get('impact', '—')}")
            lines.append(f"- **Remediation:** {f.get('remediation', '—')}")
            evidence = f.get("evidence") or {}
            if evidence:
                lines.append("")
                lines.append("```json")
                lines.append(json.dumps(evidence, indent=2, sort_keys=True))
                lines.append("```")
            lines.append("")

    # --- Findings grouped by phase (compact) ---
    lines.append("## By Phase")
    lines.append("")
    lines.append("| Phase | Findings | Highest severity |")
    lines.append("| --- | --- | --- |")
    for phase, items in sorted(by_phase.items()):
        sevs = {item.get("severity") for item in items}
        for sev in SEVERITY_ORDER:
            if sev in sevs:
                highest = sev.upper()
                break
        else:
            highest = "—"
        lines.append(f"| `{phase}` | {len(items)} | {highest} |")
    lines.append("")

    return "\n".join(lines)


def render_json_summary(findings: list[Finding]) -> str:
    counts: Counter[str] = Counter(str(f.get("severity", "info")) for f in findings)
    summary: dict[str, Any] = {
        "total":  len(findings),
        "counts": {sev: counts.get(sev, 0) for sev in SEVERITY_ORDER},
        "verdict_fail": counts.get("critical", 0) > 0 or counts.get("high", 0) > 0,
    }
    return json.dumps(summary, indent=2)


def main(argv: list[str]) -> int:
    if len(argv) < 2:
        print(__doc__, file=sys.stderr)
        return 1
    path = Path(argv[1])
    findings = load_findings(path)
    if "--json" in argv[2:]:
        print(render_json_summary(findings))
    else:
        print(render_markdown(findings))
    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv))
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: 471kUpdated 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: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated 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