safeslice

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

KeyMeaning
schemasSchemas to introspect. Defaults to [public]

slice

KeyMeaning
rootThe table the walk starts from
whereSQL predicate, applied to the root table only
limitMaximum root rows
child_depthHow 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

KeyMeaning
seedMakes a run reproducible. Share it across the team and everyone’s snapshots agree on what a given customer was renamed to
strictHalts when a text column has no rule. Defaults to true
pii_tablesLimits strict mode to the tables that hold personal data. Empty means every table
rulesKeyed 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.

KeyMeaning
tableThe child table
columnsThe columns that hold the reference
referencesThe parent table and its columns
whenOptional 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.