Redacting Sensitive Data in 4 Lines of Code
Masking
Examples
Cases
Additional Config
Before
After
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
nightfall = Nightfall() # reads API key from NIGHTFALL_API_KEY environment variable by default
payload = ["4916-6734-7572-5015 is my credit card number"]
findings, redacted_payload = nightfall.scan_text(
payload,
[DetectionRule(
[Detector(
min_confidence=Confidence.LIKELY,
nightfall_detector="CREDIT_CARD_NUMBER",
display_name="Credit Card Number",
redaction_config=RedactionConfig(
remove_finding=False,
mask_config=MaskConfig(
masking_char="X",
num_chars_to_leave_unmasked=4,
mask_right_to_left=True,
chars_to_ignore=["-"]))
)]
)]
)
print(findings)
print(redacted_payload)When to use Masking?
Substitution
Examples
When to use Substitution
Encryption
Example
When to use Encryption
Last updated
Was this helpful?