Bruno-Cunha-Souza/ValarMindSkills / skills/code-security-review
code-security-review
FlaggedWeb/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'.
scripts/run-all.sh
View on GitHub#!/usr/bin/env bash
# Orchestrator — runs all probe phases in order, then aggregates findings into report.md.
#
# AUTHORIZATION REQUIRED: set I_HAVE_AUTHORIZATION=1 to confirm you have written
# permission to test the target. Refuses to run otherwise.
#
# STATIC_ONLY=1 runs only the static phases (07/09/10/11 — supply chain, CI/CD,
# secrets, AI/LLM static) against PROJECT_ROOT. No TARGET and no authorization
# needed, because static phases read files and send no attack traffic.
#
# Reads: TARGET, I_HAVE_AUTHORIZATION, STATIC_ONLY, plus per-script env vars (see README.md)
# Writes: out/findings.jsonl, out/report.md, out/summary.json
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/common.sh
source "$SCRIPT_DIR/lib/common.sh"
if [ "${STATIC_ONLY:-}" = "1" ]; then
log_info "STATIC_ONLY=1 — running static phases only (no live target)."
phases=(
"07-supply-chain.sh"
"09-cicd-workflows.sh"
"10-secrets-scan.sh"
"11-ai-llm-probes.sh"
)
else
require_env TARGET
# -------------------------------------------------------------------------
# Authorization gate (active phases send attack-shaped traffic)
# -------------------------------------------------------------------------
if [ "${I_HAVE_AUTHORIZATION:-}" != "1" ]; then
log_error "Refusing to run without explicit authorization."
log_dim ""
log_dim "These probes send real attack-shaped traffic to $TARGET."
log_dim "Running without authorization is a crime in most jurisdictions."
log_dim ""
log_dim "If you have written permission to test (pentest agreement, bug bounty"
log_dim "scope, ownership of the target), set:"
log_dim ""
log_dim " export I_HAVE_AUTHORIZATION=1"
log_dim ""
log_dim "and rerun. (For file-only static checks, use STATIC_ONLY=1 instead.)"
exit 2
fi
phases=(
"00-pre-checks.sh"
"01-auth-probes.sh"
"02-jwt-attacks.py"
"03-bola-probes.sh"
"04-injection-probes.sh"
"05-rate-limit.sh"
"06-info-disclosure.sh"
"07-supply-chain.sh"
"08-cors-headers.sh"
"09-cicd-workflows.sh"
"10-secrets-scan.sh"
"11-ai-llm-probes.sh"
)
fi
# ---------------------------------------------------------------------------
# Reset findings file for a fresh run (back up previous if it exists)
# ---------------------------------------------------------------------------
if [ -s "$FINDINGS_FILE" ]; then
backup="$OUT_DIR/findings.$(date +%Y%m%d-%H%M%S).jsonl"
mv "$FINDINGS_FILE" "$backup"
log_info "Previous findings backed up to $backup"
fi
: > "$FINDINGS_FILE"
run_phase() {
local script="$1"
local path="$SCRIPT_DIR/$script"
if [ ! -f "$path" ]; then
log_warn "Skipping $script — file not found"
return 0
fi
log_info "============================================================"
log_info "Running $script"
log_info "============================================================"
case "$script" in
*.py)
if ! python3 "$path"; then
log_warn "$script exited non-zero (continuing)"
fi
;;
*.sh)
if ! bash "$path"; then
log_warn "$script exited non-zero (continuing)"
fi
;;
esac
}
for phase in "${phases[@]}"; do
run_phase "$phase"
done
# ---------------------------------------------------------------------------
# Aggregate
# ---------------------------------------------------------------------------
log_info "============================================================"
log_info "Aggregating findings..."
log_info "============================================================"
if [ ! -f "$SCRIPT_DIR/lib/report.py" ]; then
log_error "lib/report.py not found — cannot aggregate."
exit 1
fi
python3 "$SCRIPT_DIR/lib/report.py" "$FINDINGS_FILE" > "$OUT_DIR/report.md"
python3 "$SCRIPT_DIR/lib/report.py" "$FINDINGS_FILE" --json > "$OUT_DIR/summary.json"
# ---------------------------------------------------------------------------
# Summary line for CI consumption
# ---------------------------------------------------------------------------
total_findings=$(wc -l < "$FINDINGS_FILE" | tr -d ' ')
log_ok "Run complete. $total_findings finding(s) recorded."
log_dim " Markdown report: $OUT_DIR/report.md"
log_dim " JSON summary: $OUT_DIR/summary.json"
log_dim " Raw findings: $FINDINGS_FILE"
# Print one-line summary to stdout for CI
if command -v jq >/dev/null 2>&1; then
jq -s '{
total: length,
critical: ([.[] | select(.severity == "critical")] | length),
high: ([.[] | select(.severity == "high")] | length),
medium: ([.[] | select(.severity == "medium")] | length),
low: ([.[] | select(.severity == "low")] | length),
info: ([.[] | select(.severity == "info")] | length)
}' "$FINDINGS_FILE"
else
cat "$OUT_DIR/summary.json"
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |