Configuration
Every key in safeslice.yaml — the file your team commits so every run and every CI job agree on the same rules.
safeslice.yaml is written for you by the wizard or by safeslice init, and is meant to be committed. That is the adoption mechanism: one engineer commits it, and every teammate and every CI job inherits the same masking rules and the same slice shape.
version: 1
source:
schemas: [public]
slice:
root: users
where: "created_at > '2026-01-01'"
limit: 1000
child_depth: 1
mask:
seed: safeslice
strict: true
pii_tables: []
rules:
users.email: email
users.password: secret
tickets.body: redact
virtual_keys:
- table: comments
columns: [commentable_id]
references: { table: posts, columns: [id] }
when: "commentable_type = 'Post'"
source
| Key | Meaning |
|---|---|
schemas | Schemas to introspect. Defaults to [public] |
slice
| Key | Meaning |
|---|---|
root | The table the walk starts from |
where | SQL predicate, applied to the root table only |
limit | Maximum root rows |
child_depth | How many levels of child rows to follow |
Parents are followed unconditionally and transitively — a row cannot be inserted without the rows it references. Children are optional context and stop at child_depth, because following them without a bound reaches the whole database through any popular table.
mask
| Key | Meaning |
|---|---|
seed | Makes a run reproducible. Share it across the team and everyone’s snapshots agree on what a given customer was renamed to |
strict | Halts when a text column has no rule. Defaults to true |
pii_tables | Limits strict mode to the tables that hold personal data. Empty means every table |
rules | Keyed schema.table.column, table.column, or a bare column name |
An unknown key is an error rather than a setting that silently does nothing — for a masking rule, silently doing nothing is a leak.
virtual_keys
Relationships PostgreSQL does not enforce. Rails polymorphic associations and Django generic relations have no pg_constraint row, so the graph cannot see them without being told.
| Key | Meaning |
|---|---|
table | The child table |
columns | The columns that hold the reference |
references | The parent table and its columns |
when | Optional predicate scoping the relationship |
Safeslice reports the columns that look like unenforced relationships after every run, so you can declare the ones that matter rather than discovering them missing.