mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 15:22:12 +03:00
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:
committed by
GitHub
parent
d3146a1751
commit
d728bfbb1e
@@ -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" } }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user