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/00-pre-checks.sh

View on GitHub
#!/usr/bin/env bash
# Phase 0 — Pre-test checks.
# Confirms the target is reachable and probes a few common production-misconfiguration
# flags (FastAPI docs exposure, debug-mode hints in headers, version disclosure).
# Reads:  TARGET
# Writes: out/findings.jsonl

set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/common.sh
source "$SCRIPT_DIR/lib/common.sh"

require_env TARGET
ensure_target_reachable

# ---------------------------------------------------------------------------
# Check 1 — FastAPI / OpenAPI doc exposure
# ---------------------------------------------------------------------------
log_info "Checking exposed documentation paths..."
for path in /docs /redoc /openapi.json /swagger.json /api-docs; do
  result=$(http_request GET "$path" --max-time 10 || true)
  status="${result%% *}"
  if [ "$status" = "200" ]; then
    body_excerpt=$(head -c 200 "$RESP_BODY" 2>/dev/null | tr -d '\000-\031')
    evidence=$(build_evidence \
      "status=$status" \
      "path=$path" \
      "body_excerpt=$body_excerpt")
    emit_finding \
      "PRE-001" "medium" "API8:2023 Security Misconfiguration" \
      "GET $path" \
      "API documentation is exposed in production. Reveals endpoints, request schemas, and may aid further attacks." \
      "Disable docs in production: FastAPI(docs_url=None, redoc_url=None, openapi_url=None). Apply equivalent in other frameworks." \
      "$evidence"
  fi
done

# ---------------------------------------------------------------------------
# Check 2 — Server / X-Powered-By version disclosure
# ---------------------------------------------------------------------------
log_info "Checking for version-disclosing response headers..."
http_request GET "/" --max-time 10 >/dev/null || true

while IFS= read -r line; do
  case "${line,,}" in
    server:*|x-powered-by:*|x-aspnet-version:*|x-runtime:*|x-rack-cache:*)
      header_value="${line#*:}"
      header_value="${header_value## }"
      header_value="${header_value%$'\r'}"
      # only flag when there is a version-like substring (digit + dot)
      if [[ "$header_value" =~ [0-9]+\.[0-9]+ ]]; then
        evidence=$(build_evidence \
          "header=${line%%:*}" \
          "value=$header_value")
        emit_finding \
          "PRE-002" "low" "API8:2023 Security Misconfiguration" \
          "GET /" \
          "Server response reveals technology and version information ($header_value), aiding targeted exploitation." \
          "Strip or rewrite identifying headers at the reverse proxy / framework level." \
          "$evidence"
      fi
      ;;
  esac
done < "$RESP_HEADERS"

# ---------------------------------------------------------------------------
# Check 3 — Debug error verbosity (force a 404 with garbage path)
# ---------------------------------------------------------------------------
log_info "Probing error response verbosity..."
result=$(http_request GET "/__nonexistent_$$_$(date +%s)" --max-time 10 || true)
status="${result%% *}"
if [ -s "$RESP_BODY" ]; then
  body=$(head -c 1000 "$RESP_BODY")
  if echo "$body" | grep -qiE 'traceback|stack trace|at [a-zA-Z0-9_\.]+\.[a-zA-Z0-9_]+\(|file ".*\.py"|panic:|goroutine [0-9]+|nodejs|node_modules|/Users/|/home/'; then
    excerpt=$(printf '%s' "$body" | head -c 300 | tr -d '\000-\031')
    evidence=$(build_evidence \
      "status=$status" \
      "body_excerpt=$excerpt")
    emit_finding \
      "PRE-003" "medium" "API8:2023 Security Misconfiguration" \
      "GET /<nonexistent>" \
      "Error response leaks stack trace, file paths, or framework internals — aids fingerprinting and exploitation." \
      "Install a global error handler that returns a generic message in production. Log details server-side only." \
      "$evidence"
  fi
fi

log_ok "Pre-checks complete."
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