Skip to content

Secrets

Secrets Detector dedacts and redacts secrets from prompt inputs.

Configuration

Initialize the Secrets Detector with the desired options:

from safeguards.shield.input_detectors import Secrets

safeguards = Shield()
input_detectors = [Secrets(redact_mode="REDACT_PARTIAL")]

sanitized_prompt, valid_results, risk_score = safeguards.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