diegosouzapw/OmniRoute · error

SECURITY_001

SECURITY_001

Error message

Request blocked: potential prompt injection detected

What it means

Error "Request blocked: potential prompt injection detected" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/middleware/promptInjectionGuard.ts:78

    // Hoist parsed body so it can be threaded to the downstream handler (#4041).
    let parsedBody: any = null;

    try {
      // Clone request so body can still be read by handler
      const cloned = request.clone();
      parsedBody = await cloned.json().catch(() => null);

      if (parsedBody) {
        const { blocked, result }: any = guard(parsedBody);

        if (blocked) {
          return new Response(
            JSON.stringify({
              error: {
                message: "Request blocked: potential prompt injection detected",
                type: "injection_detected",
                code: "SECURITY_001",
                detections: result.detections.length,
              },
            }),
            { status: 400, headers: { ...CORS_HEADERS, "Content-Type": "application/json" } }
          );
        }

        // Attach sanitization result as header for downstream handlers.
        // Web Request headers may be immutable — never let this throw into the
        // outer security-check path (issue #8095).
        if (result.flagged) {
          try {
            request.headers.set("X-Injection-Flagged", "true");
            request.headers.set(
              "X-Injection-Detections",
              String(result.detections.length)
            );
          } catch {

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/middleware/promptInjectionGuard.ts:78 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/43bea670a6b1bc34. Report an issue: GitHub.