Skip to content

Redact Config

The redact command supports YAML configuration for complex redaction rules.

# Global settings
seed: 12345
locale: en
# Default strategy for unmatched columns
defaults:
strategy: skip
# Column-specific rules
rules:
- column: "*.email"
strategy: hash
- column: "*.name"
strategy: fake
generator: name
# Tables to skip entirely
skip_tables:
- schema_migrations
- ar_internal_metadata

Random seed for reproducible fake data generation:

seed: 12345

Same seed = same fake data on every run.

Locale for fake data generation:

locale: en # English (default)
locale: de_de # German
locale: fr_fr # French
locale: ja_jp # Japanese
locale: zh_cn # Chinese

Each rule matches columns and applies a strategy.

rules:
# All columns named 'email' in any table
- column: "*.email"
# Specific table.column
- column: "users.password"
# Wildcard in column name
- column: "*.ssn*"
# Multiple patterns (comma-separated)
- column: "*.phone,*.mobile,*.fax"

Replace with NULL:

- column: "*.ssn"
strategy: null

Replace with a fixed value:

- column: "*.status"
strategy: constant
value: "REDACTED"

SHA256 hash (deterministic):

- column: "*.email"
strategy: hash

Same input always produces same hash, preserving FK relationships.

Generate realistic fake data:

- column: "*.name"
strategy: fake
generator: name

Available generators:

GeneratorExample Output
emailjessica.smith@example.com
nameRobert Johnson
first_nameSarah
last_nameWilliams
phone+1 (555) 234-5678
address123 Oak Street, Springfield, IL
cityPortland
stateCalifornia
zip90210
countryUnited States
companyAcme Corporation
job_titleSoftware Engineer
usernamejsmith42
urlhttps://example.com/page
ip192.168.1.100
ipv62001:db8::1
uuid550e8400-e29b-41d4-...
date1985-07-23
datetime2023-01-15 14:30:00
credit_card4532015112830366
ibanDE89370400440532013000
ssn123-45-6789
loremLorem ipsum dolor sit...
paragraphFull paragraph of text...
sentenceA complete sentence.

Partial masking with pattern:

- column: "*.credit_card"
strategy: mask
pattern: "****-****-****-XXXX"

Pattern symbols:

  • * - Replace with asterisk
  • X - Keep original character
  • # - Random digit

Examples:

  • ****-****-****-XXXX****-****-****-1234
  • XXX-XX-####123-45-6789 (SSN with random last 4)
  • ***@XXXXX***@gmail.com (mask email prefix)

Redistribute values within column:

- column: "*.salary"
strategy: shuffle

Preserves distribution but breaks correlation with other columns.

No redaction (passthrough):

- column: "admins.email"
strategy: skip

Skip entire tables from redaction:

skip_tables:
- schema_migrations
- ar_internal_metadata
- _global
seed: 42
locale: en
defaults:
strategy: skip
rules:
# PII
- column: "*.email"
strategy: hash
- column: "*.name,*.first_name,*.last_name"
strategy: fake
generator: name
- column: "*.phone,*.mobile"
strategy: fake
generator: phone
- column: "*.ssn"
strategy: null
- column: "*.password"
strategy: constant
value: "$2a$10$REDACTED"
# Financial
- column: "*.credit_card"
strategy: mask
pattern: "****-****-****-XXXX"
- column: "*.salary"
strategy: shuffle
# Addresses
- column: "*.address,*.street"
strategy: fake
generator: address
- column: "*.city"
strategy: fake
generator: city
- column: "*.zip,*.postal_code"
strategy: fake
generator: zip
# Exceptions
- column: "admins.email"
strategy: skip
skip_tables:
- schema_migrations
- ar_internal_metadata