Fase 8 · Bloco D — injection-guard em todas as rotas LLM + red-team (#3857)

Integrated into release/v3.8.25 — Fase 8 Bloco D (injection-guard em todas as rotas LLM + red-team).
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-14 18:02:18 -03:00
committed by GitHub
parent d3146a1751
commit d728bfbb1e
19 changed files with 260 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import {
type PromptInjectionGuardrailOptions,
} from "@/lib/guardrails/promptInjection";
import { resolveDisabledGuardrails } from "@/lib/guardrails/registry";
import { CORS_HEADERS } from "@/shared/utils/cors";
/**
* Create a prompt injection guard middleware.
@@ -71,10 +72,11 @@ export function withInjectionGuard(handler: any, options: any = {}) {
error: {
message: "Request blocked: potential prompt injection detected",
type: "injection_detected",
code: "SECURITY_001",
detections: result.detections.length,
},
}),
{ status: 400, headers: { "Content-Type": "application/json" } }
{ status: 400, headers: { ...CORS_HEADERS, "Content-Type": "application/json" } }
);
}