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
# (note the nested `strategy` key)
defaults:
strategy:
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*"

For a schema-qualified table, put the complete table identity before the final column separator. For example, tenant_a.users.email targets the email column in tenant_a.users.

Each rule takes a single glob pattern. To match multiple patterns, use one rule per pattern:

rules:
- column: "*.phone"
strategy: fake
generator: phone
- column: "*.mobile"
strategy: fake
generator: phone

Replace with NULL:

- column: "*.ssn"
strategy: "null"

The quotes are required—unquoted null is a YAML null value and fails to parse.

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.

Optionally keep the email domain (user@domain.comhash@domain.com):

- column: "*.email"
strategy: hash
preserve_domain: true

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)

shuffle configuration is rejected. Correct shuffling requires a two-pass rewrite so the output never retains the original value at its source row.

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:
strategy: skip
rules:
# PII
- column: "*.email"
strategy: hash
- column: "*.name"
strategy: fake
generator: name
- column: "*.first_name"
strategy: fake
generator: first_name
- column: "*.last_name"
strategy: fake
generator: last_name
- column: "*.phone"
strategy: fake
generator: phone
- column: "*.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"
# Addresses
- column: "*.address"
strategy: fake
generator: address
- column: "*.city"
strategy: fake
generator: city
- column: "*.zip"
strategy: fake
generator: zip
- column: "*.postal_code"
strategy: fake
generator: zip
# Exceptions
- column: "admins.email"
strategy: skip
skip_tables:
- schema_migrations
- ar_internal_metadata