version: 1
tests:
- name: detectors mask email and card
pipeline:
masking:
rules:
- match: { value_detector: email }
action: { type: redact }
- match: { value_detector: credit_card }
action: { type: partial, keep_last: 4 }
input:
- { contact: "alice@example.com", card: "4111 1111 1111 1111", city: "NYC" }
expect:
records:
- { contact: "***", card: "***************1111", city: "NYC" }
- name: keyed hash is deterministic
pipeline:
masking:
key: test-key
rules:
- match: { fields: [uid] }
action: { type: hash }
input:
- { uid: "u1", n: 1 }
- { uid: "u1", n: 2 }
expect:
match: subset
records:
- { n: 1 }
- { n: 2 }
- name: name patterns and nested paths
pipeline:
masking:
key: k
rules:
- match: { field_pattern: '(?i)^ssn$' }
action: { type: hash }
- match: { fields: [user_id] }
action: { type: tokenize, prefix: "usr_" }
- match: { fields: ["address"] }
action: { type: redact }
input:
- { ssn: "123-45-6789", user_id: "abc", address: { street: "1 Main", zip: "94103" }, keep: 1 }
expect:
match: subset
records:
- { address: "***", keep: 1 }