boundary
diapason.security.boundary
¶
BoundaryGuard — scans content at device exit points.
Wraps SecretScanner and PIIScanner to redact, warn, or block secrets and PII before data leaves the device via cloud engines or external tool calls.
BoundaryGuard
¶
Scans outbound content for secrets and PII at device boundaries.
Parameters¶
mode:
Action on findings: "redact" replaces matches,
"warn" logs but passes through, "block" raises.
enabled:
Master switch. When False, all content passes through.
bus:
Optional event bus for publishing SECURITY_ALERT events.
scanners:
Custom scanners. Defaults to SecretScanner + PIIScanner.
check_outbound(tool_call)
¶
Scan tool call arguments before execution.
Returns a new ToolCall with redacted arguments if needed.
redact_for_storage(content)
¶
Always redact secrets and PII before telemetry or trace storage.
scan_outbound(content, destination)
¶
Scan text before it leaves the device.
Returns redacted text in "redact" mode, original text in
"warn" mode, or raises SecurityBlockError in "block"
mode when findings are detected.
SecurityBlockError
¶
Bases: Exception
Raised when mode='block' and secrets/PII are detected.