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:
Patryk Kopyciński
2026-08-30 10:27:47 +02:00
committed by GitHub
parent ff0743071e
commit 8bed101303
2 changed files with 2 additions and 2 deletions

View File

@@ -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(

View File

@@ -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,