{"record":{"id":"43bea670a6b1bc34","repo":"diegosouzapw/OmniRoute","slug":"security-001-43bea6","errorCode":"SECURITY_001","errorMessage":"Request blocked: potential prompt injection detected","messagePattern":"Request blocked: potential prompt injection detected","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/middleware/promptInjectionGuard.ts","lineNumber":78,"sourceCode":"\n    // Hoist parsed body so it can be threaded to the downstream handler (#4041).\n    let parsedBody: any = null;\n\n    try {\n      // Clone request so body can still be read by handler\n      const cloned = request.clone();\n      parsedBody = await cloned.json().catch(() => null);\n\n      if (parsedBody) {\n        const { blocked, result }: any = guard(parsedBody);\n\n        if (blocked) {\n          return new Response(\n            JSON.stringify({\n              error: {\n                message: \"Request blocked: potential prompt injection detected\",\n                type: \"injection_detected\",\n                code: \"SECURITY_001\",\n                detections: result.detections.length,\n              },\n            }),\n            { status: 400, headers: { ...CORS_HEADERS, \"Content-Type\": \"application/json\" } }\n          );\n        }\n\n        // Attach sanitization result as header for downstream handlers.\n        // Web Request headers may be immutable — never let this throw into the\n        // outer security-check path (issue #8095).\n        if (result.flagged) {\n          try {\n            request.headers.set(\"X-Injection-Flagged\", \"true\");\n            request.headers.set(\n              \"X-Injection-Detections\",\n              String(result.detections.length)\n            );\n          } catch {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/middleware/promptInjectionGuard.ts#L60-L96","documentation":"Error \"Request blocked: potential prompt injection detected\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/middleware/promptInjectionGuard.ts:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}