Skip to content

Secrets

Secrets Detector uses the detect-secrets library to dedact and redact secrets from prompt inputs.

Vulnerability

Usage

Configuration

Initialize the Secrets Detector with the desired options:

from guardrail.firewall.input_detectors import Secrets

firewall = Firewall()
input_detectors = [Secrets(redact_mode="REDACT_PARTIAL")]

sanitized_prompt, valid_results, risk_score = firewall.scan_input(prompt, input_detectors)

Here's what the option is for:

  • redact_mode (str): Mode for redaction. Defaults to REDACT_ALL. Choices are REDACT_PARTIAL, REDACT_ALL, and REDACT_HASH