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/05-burst.k6.js
View on GitHub// Phase 4.4 — k6 burst test (separate from run-all.sh — invoke manually).
// Run: k6 run 05-burst.k6.js -e TARGET=https://api.example.com -e RATE_PATH=/api/data
//
// Validates that the API rate-limits (returns 429) under sustained burst load.
// Outputs a k6 summary; pair findings with the bash burst probe (05-rate-limit.sh).
import http from "k6/http";
import { check, sleep } from "k6";
const TARGET = __ENV.TARGET || "https://localhost";
const RATE_PATH = __ENV.RATE_PATH || "/api/data";
const TOKEN = __ENV.TOKEN || "";
const VUS = parseInt(__ENV.VUS || "100", 10);
const DURATION = __ENV.DURATION || "10s";
export const options = {
vus: VUS,
duration: DURATION,
thresholds: {
// We *want* 429s under burst load. If <5% of responses are 429, the API is not protecting itself.
"http_req_failed{expected_response:true}": ["rate>0.0"],
"checks{name:limited_or_authed}": ["rate>0.95"],
},
};
export default function () {
const headers = { "Content-Type": "application/json" };
if (TOKEN) headers["Authorization"] = `Bearer ${TOKEN}`;
const res = http.get(`${TARGET}${RATE_PATH}`, { headers });
check(res, {
"limited_or_authed": (r) => r.status === 429 || r.status === 200 || r.status === 401,
}, { name: "limited_or_authed" });
// brief jitter so the burst is not perfectly synchronized
sleep(Math.random() * 0.05);
}
export function handleSummary(data) {
const codes = data.metrics.http_reqs?.values || {};
const summary = {
target: `${TARGET}${RATE_PATH}`,
vus: VUS,
duration: DURATION,
requests: data.metrics.http_reqs?.values?.count || 0,
failed: data.metrics.http_req_failed?.values?.rate || 0,
p95_ms: data.metrics.http_req_duration?.values?.["p(95)"] || 0,
};
return {
stdout: `\n=== k6 burst summary ===\n${JSON.stringify(summary, null, 2)}\n`,
};
}
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 |