mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
fix(guardrails): prevent duplicate prompt-injection-guard log output (#11936)
Boarded with 8 other PRs in one combined worktree: typecheck:core, check:file-size, check:changelog-integrity, check:complexity, check:cognitive-complexity, check:cycles, check-native-deps all green; 75/75 focused tests pass. Verified the console fallback → null fix removes the duplicate plain-text line while the structured pino log is unaffected. Thanks.
This commit is contained in:
committed by
GitHub
parent
ff0743071e
commit
8bed101303
@@ -111,7 +111,7 @@ function shouldBlock(detections: Detection[], threshold: "low" | "medium" | "hig
|
||||
}
|
||||
|
||||
function getLogger(options: PromptInjectionGuardrailOptions, context: GuardrailContext) {
|
||||
return options.logger || context.log || console;
|
||||
return options.logger ?? context.log ?? null;
|
||||
}
|
||||
|
||||
function emitGuardrailLog(
|
||||
|
||||
@@ -33,7 +33,7 @@ export function createInjectionGuard(options: PromptInjectionGuardrailOptions =
|
||||
|
||||
const decision = evaluatePromptInjection(body, options, {
|
||||
disabledGuardrails: resolveDisabledGuardrails({ body }),
|
||||
log: options.logger || console,
|
||||
log: options.logger ?? null,
|
||||
});
|
||||
return {
|
||||
blocked: decision.blocked,
|
||||
|
||||
Reference in New Issue
Block a user