Skip to content
Preparing for DPDP in 2027? Explore our developer guide

Documentation · v0.4.1

Subveil CLI documentation.

Use the Subveil CLI to subset and mask data from PostgreSQL, MySQL, and MariaDB. The CLI follows foreign keys from your selected rows and masks configured values before loading a development or CI target.

Quick test run4 commands
bash
subveil init --schemas public --out subveil.yaml --force
subveil plan --config subveil.yaml
subveil pull --config subveil.yaml
subveil verify --config subveil.yaml
On this page · 9 sections

What is Subveil

Overview

Subveil connects to your read-only source database, resolves foreign-key graphs to find connected rows, and streams masked records to your target database. All data processing runs inside your own VPC, CI runner, or workstation. Database connections and the masking seed are used locally.

Supported enginesAll live

Integration-tested on MySQL 8.0 and 8.4 and MariaDB 10.6; CI targets these versions.

Introspect

01

Discovers tables, columns, constraints, and PII candidates automatically.

Plan

02

Calculates topological load order, parallelism, and cycle-breaking before writing data.

Subset

03

Slices a 1%–10% or tenant-scoped graph with required rows included through foreign keys.

Mask & Attest

04

Masks configured columns in flight and saves a receipt after a successful copy.

Installation

v0.4.1

Install with Homebrew on Apple silicon or Intel Macs.

HomebrewmacOS
bash
brew install subveilhq/tap/subveil

If Homebrew is unavailable, download the archive below, verify its SHA-256, and extract subveil into a directory on your PATH. If macOS blocks the manual download, confirm the checksum before allowing the binary in Privacy & Security.

Confirm the CLI reports v0.4.1.

Verify installation
bash
subveil version

Need an earlier version? Browse release history.

Quick start

Step 1: Set environment variables

Set connection URLs and the masking key in your environment for this quick start. Keep secrets out of version control:

Environment variables
bash
export SUBVEIL_SOURCE_URL="postgresql://readonly@localhost:5432/app"
export SUBVEIL_TARGET_URL="postgresql://developer@localhost:5432/app_staging"
export SUBVEIL_MASK_KEY="replace-with-a-long-hmac-secret"
​
# Optional: Enable automatic Cloud schema and audit reporting
# export SUBVEIL_API_KEY="sv_live_..."
​
# For MySQL / MariaDB, use engine: mysql and MySQL URLs:
# export SUBVEIL_SOURCE_URL="mysql://readonly:password@localhost:3306/app"
# export SUBVEIL_TARGET_URL="mysql://developer:password@localhost:3306/app_staging"

Create a starter subveil.yaml if you want to set connection variable names explicitly. Use an empty target and install a PostgreSQL client at least as new as the source:

subveil.yamlexample
version: 1engine: postgressource: {dsn_env: SUBVEIL_SOURCE_URL}target: {dsn_env: SUBVEIL_TARGET_URL}masking: {seed_env: SUBVEIL_MASK_KEY}

Step 2: Initialize, plan, pull, and verify

Generate a configuration, plan and pull the subset, then verify the target. If a starter configuration already exists, init refreshes its discovered rules:

Initialize, plan, pull & verify
bash
# 1. Generate masking rules from the source schema
subveil init --schemas public --out subveil.yaml --force
​
# 2. Review the execution plan and sensitive-column findings
subveil plan --config subveil.yaml
​
# 3. Pull masked data; an empty target gets its schema automatically
subveil pull --config subveil.yaml -j 4
​
# 4. Verify the target
subveil verify --config subveil.yaml

Core concepts

Configuration (subveil.yaml)

The configuration file defines database engines, subset roots, table scales, and column transformers:

subveil.yamlexample
version: 1engine: postgres​source:  dsn_env: SUBVEIL_SOURCE_URL​target:  dsn_env: SUBVEIL_TARGET_URL​masking:  seed_env: SUBVEIL_MASK_KEY​subset:  roots:    - table: public.tenants      where: "id = 'acme'"  default_sample_rate: 0.1  full_tables:    - public.ref_*  exclude_tables:    - public.*_logs​tables:  public.users:    columns:      email:        transformer: email        domain: example.test      full_name:        transformer: name      phone:        transformer: phone      profile:        transformer: jsonb        paths:          - path: "$.contact.email"            transformer: email            domain: example.test          - path: "$..ssn"            transformer: redact
NameTypeDefaultDescription
versionrequiredinteger—Configuration format version. Always 1.
enginerequiredstring—Database engine: postgres or mysql.
source.dsn_envrequiredstring—Env var name holding the read-only source connection string.
target.dsn_envrequiredstring—Env var name holding the target database connection string.
masking.seed_envrequiredstring—Env var name holding the secret HMAC masking seed.
subset.rootslist—Entry-point tables filtered by SQL WHERE clauses or scale percentages.
subset.default_sample_ratefraction—Fallback sample fraction in YAML/API (0.0003 = 0.03%, 0.01 = 1%); the dashboard shows a percentage.
subset.full_tableslist—Reference/lookup tables copied in full (supports glob patterns like public.ref_*).
subset.exclude_tableslist—High-volume telemetry or log tables to skip during data copy.

Graph subsetting & cycle resolution

Subveil constructs a directed graph of your foreign keys and traverses it bidirectionally:

  • Upstream (Parent dependencies): Required parent rows referenced by any selected row are included when in scope. A required parent outside the selection scope can stop the pull.
  • Downstream (Child records): Child rows belonging to your root slice (such as a tenant's users, invoices, and line items) are pulled proportionally.
  • Self-references & circular FKs: Nullable foreign-key cycles are automatically deferred or patched in a second pass inside the target transaction.

In-flight transformers

Built-in transformers run in the CLI before rows reach the target. The custom_sql transformer evaluates its expression on the source.

TransformerTypeDefaultDescription
emaildomain, token_len—Deterministic synthetic email with collision handling for unique columns.
namesuffix_len—Deterministic realistic full/first/last name seeded by input value.
phonesuffix_len—Valid E.164 or local phone number format.
addresssuffix_len—Realistic street address, city, and postal code.
uuid——Deterministic v4-formatted UUID derived from the source value and seed.
tokenprefix, token_len—Alphanumeric token for API keys, webhook secrets, or usernames.
ip——Deterministic IPv4/IPv6 masking within a safe documentation/private CIDR.
numbervariance—Deterministic numeric perturbation. Set variance as a percentage from 1 to 99 (default 20).
date_shiftdays—Shifts each date or timestamp by a deterministic offset of up to N days. Different input values can change order.
redactvalue—Replaces sensitive strings with a fixed placeholder (default [REDACTED]).
null——Writes SQL NULL (for nullable columns such as password reset tokens).
custom_sqlsql—Evaluates a configured SQL expression during extraction.
jsonbpaths—Applies nested transformers to specific JSONPath keys inside JSON/JSONB columns.

CLI commands reference

Commands available in v0.4.1:

CommandTypeDefaultDescription
subveil initSetup—Introspects source schema, detects PII columns locally, and generates subveil.yaml.
subveil planPlan—Displays foreign-key load stages and cycle strategies, or plans a row-based subset with --row, without copying data.
subveil pullExecute—Streams and masks classic or row-based subsets from source to target.
subveil loginCloud—Authenticates the CLI with Subveil Cloud via browser device approval. CI can supply SUBVEIL_API_KEY.
subveil logoutCloud—Removes stored CLI credentials.
subveil linkCloud—Links the local configuration to an accessible Cloud project.
subveil schema pushCloud—Uploads source database structure to the linked project.
subveil policy pushCloud—Reviews and publishes local policy sections.
subveil policy pullCloud—Downloads the latest published team masking policy for a project without database connection.
subveil branch reportCI/CD—Reports branch database lifecycle status to the dashboard.
subveil ci reportCI/CD—Reports the final GitHub Actions job status to the dashboard.
subveil versionUtility—Prints the installed CLI version.

Verification and shell completion

CommandTypeDefaultDescription
subveil verifyAvailable—Checks target integrity, foreign keys, unique constraints, row counts against pull summary, and sampled known PII/secret patterns.
subveil completionAvailable—Generates shell autocompletion script for bash, zsh, or fish.

Use subveil <command> --help for the complete flags for each command, including policy pull, branch report, and ci report. Use plan to discover candidate sensitive columns and add --fail-on-findings to gate on potentially unmasked findings.

Command flags

Use --help on a command for details. Source and target URLs may contain credentials; environment variables are recommended.

Command usage
text
subveil init [--source URL] [--target URL] [--schemas LIST] [--out PATH] [--force] [--sample-rows N]
subveil plan [--config PATH] [--source URL] [--schemas LIST] [--row SEED] [--max-depth N] [--max-rows N] [--sample-rows N] [--fail-on-findings] [--verbose] [--json]
subveil pull [--config PATH] [--source URL] [--target URL] [--schemas LIST] [--row SEED] [--reason TEXT] [--max-depth N] [--max-rows N] [--source-timeout DURATION] [--dry-run] [--jobs N | -j N] [--parallel-writes] [--recreate-schema] [--truncate] [--yes] [--no-cloud] [--require-audit] [--project ID] [--commit-sha SHA] [--no-ci-report]
subveil verify [--config PATH] [--target URL] [--tables LIST] [--checks LIST] [--strict] [--json]
subveil schema push [--config PATH]
subveil policy pull [--config PATH] [--project ID]
subveil policy push [--config PATH] [--project ID] [--yes]
subveil link [--config PATH] [--project ID]
subveil login [--api-url URL] [--no-browser] [--force]
subveil logout
subveil branch report --status provisioning|ready|finished|failed|closed [--branch BRANCH] [--config PATH] [--message TEXT] [--pr NUMBER] [--project ID] [--repo OWNER/NAME] [--run-id ID] [--run-url URL] [--sha SHA] [--warn-only]
subveil ci report --status success|failure|cancelled|finished|failed|closed [--config PATH] [--message TEXT] [--project ID]
subveil completion bash|zsh|fish
subveil version
subveil --version
subveil -v

In row mode, pull ignores --jobs (default 4). Pull’s --source-timeout defaults to 30m; 0 removes the limit. --dry-run is a pull flag; it writes nothing. --row may be repeated for multiple seeds. Init and plan default to sampling up to 50 values per candidate column. Verify samples up to 100.

Shell completion

Shell completion
bash
# Bash
source <(subveil completion bash)
# Zsh (after compinit)
autoload -Uz compinit && compinit && source <(subveil completion zsh)
# Fish
subveil completion fish | source

Branch report

Report a PR database lifecycle status: provisioning, ready, finished, failed, or closed. Outside GitHub Actions, provide --repo, --pr, --branch and --sha; --warn-only makes reporting failures non-fatal.

CI report

Report a GitHub Actions pull request job status: success, failure, cancelled, finished, failed, or closed. This command requires a pull_request event.

Row-based planning

Use plan --row to preview a subset. Row-based pulling is also available.

Pick a starting row (a seed) by primary key or column condition. Subveil previews the rows a subset would need: the seed, every parent row required by foreign keys, and child rows up to a depth and row limit. It runs inside a consistent, read-only snapshot and never writes to any database. PostgreSQL, MySQL, and MariaDB are supported.

Quick start

These examples use v0.4.1.

Row-based plan examples
bash
subveil plan --row orders:4821
subveil plan --row "orders:order_number=ORD-4821" --max-depth 1
subveil plan --row orders:4821 --json

The source DSN comes from $SUBVEIL_SOURCE_URL or --source, for init and plan.

Seed syntax

  • table:value seeds a single-column primary key.
  • schema.table:value qualifies the table; for MySQL/MariaDB, schema means database name.
  • table:column=value seeds by a column condition.
  • Composite primary keys use column pairs, such as order_item_discounts:order_item_id=1001,discount_code=SUMMER10.
  • Only the first colon separates the table and value. The --row flag is repeatable.
  • Zero matches are errors. Condition seeds count toward --max-rows.
  • Tables without a primary key can only be seeded by column condition.

How rows are chosen

  • Seed rows are depth 0; children are depth 1, grandchildren depth 2.
  • --max-depth limits child expansion only. Required parents are always included, however many hops up they are.
  • Required parent rows do not bring in their other children, and a NULL foreign key needs no parent.
  • If the seed and required parents exceed --max-rows, planning fails. Otherwise children are added level by level in stable order; rows that do not fit are reported as truncated.
  • Tables without a primary key keep duplicate rows and are selected by foreign key.

Flags and exit codes

FlagTypeDefaultDescription
--row <seed>repeatable—Enables row mode and selects one or more seed rows.
--max-depth <int>integer2Maximum child expansion depth; maximum 50.
--max-rows <int>integer10000Maximum total rows across seeds, parents, and children; maximum 100000.
--jsonbooleanfalseFor plan, write machine-readable output to stdout; status lines go to stderr.

Row mode uses its own seeds and limits. Set them with --row, --max-depth, and --max-rows. Scaled roots are rejected, and subset.default_sample_rate is ignored in row mode.

Exit codeTypeDefaultDescription
0success—The row plan completed; in v0.4.1, this also indicates a successful row pull.
1error—General error, such as invalid seed syntax.
2limit—Invalid flags or the row budget cannot fit the seeds and required parents.
3not found—The seed matched no rows.

Example output

This example uses v0.4.1.

Example output
text
Command: subveil plan --row orders:4821 --max-depth 2
Output:

Snapshot: consistent, read-only (2026-11-09T11:20:19Z)
Seed Rows:
public.orders: 1 row (seed: id=4821)
Mandatory Parent Closure:
max_depth limits child expansion only; required parents are always included.
public.customers: 1 row (upstream hop 1, required by orders_customer_id_fkey)
public.products: 2 rows (upstream hop 1 from public.order_items, required by order_items_product_id_fkey)
public.tenants: 1 row (upstream hop 2, required by customers_tenant_id_fkey)
Child Expansion:
public.order_items: 2 rows (depth 1, child of public.orders)
public.order_logs: 2 rows (depth 1, child of public.orders; no primary key; selected by FK predicate; duplicates preserved)
public.refunds: 1 row (depth 1, child of public.orders)
public.shipments: 1 row (depth 1, child of public.orders)
public.order_item_discounts: 1 row (depth 2, child of public.order_items)
Summary:
Seed: 1 row
Parents Required: 4 rows
Children Included: 7 rows
Total Selected: 12 rows (cap 10000)
Truncated by row cap: none
Truncated by depth cap: none found
note: public.products (3 rows) contributed lookup rows; consider adding to subset.full_tables
note: public.tenants (2 rows) contributed lookup rows; consider adding to subset.full_tables

For example, subveil plan --row orders:4821 --max-depth 0 reports child rows as truncated by the depth cap, including public.order_items, public.order_logs, public.refunds, and public.shipments.

Privacy and limits

  • Planning uses a read-only snapshot and writes to neither source nor target.
  • Condition seeds are shown as column=<value hidden>; primary keys are shown only when the key column is not sensitive.
  • Plans report counts, never data.
  • MySQL/MariaDB row planning requires InnoDB tables. String matching may be case-insensitive according to column collation, and the plan says so.

Pull a row-based subset

Row-based pulls are available in v0.4.1.

Row-based pull
bash
subveil pull --config subveil.yaml --row orders:4821 --reason "Investigate order 4821"
subveil pull --config subveil.yaml --row orders:4821 --dry-run

Pull accepts --row, --max-depth, and --max-rows for row-based copies, plus --reason. The default row limit is 10,000, with a maximum of 100,000; the maximum depth is 50.

Pull selects rows from its own consistent snapshot, so its selection can differ from an earlier plan. Rows are masked in flight, and the pull fails if copied counts per table do not match its own plan. The source and target must differ. An empty target gets its schema from source DDL automatically; existing target rows are preserved unless --truncate or --recreate-schema is requested. --parallel-writes is not allowed with row pulls; --dry-run writes nothing.

MySQL and MariaDB target tables must use InnoDB. A failed load rolls back rows, but created or recreated schema objects may remain. Row pull exit codes are 0 for success, 1 for a general error, 2 for invalid flags or a row budget too small for the seeds and required parents, and 3 when a seed is not found.

Reason and receipts

--reason is optional unless audit.require_reason is true in local configuration. The limit is 500 characters. Control and invisible characters are removed and the CLI prints a note. Reasons matching emails, card numbers, tokens, or SSNs are rejected; long digit strings can occasionally be mistaken for card numbers.

A successful row pull saves its receipt in the local project directory under ~/.subveil by default. The receipt can include your reason, selected table and key column names, row limits, and counts. Seed and row values are excluded. When Cloud reporting is enabled, the receipt and its reason can be sent to Cloud.

Verify

Verify target database
bash
subveil verify --config subveil.yaml
subveil verify --checks fk,counts,unique,pii --strict --json

subveil verify checks referential integrity, unique constraints, row counts against the latest local pull summary, and known email, card, SSN, API key and token patterns in sampled rows. It reports “no matches for known PII patterns in the sampled rows”; that is a diagnostic check on sampled rows, and does not establish that unexamined rows or columns contain no sensitive data. In v0.4.1, verification samples up to 100 rows per candidate column. It checks both ends of primary keys and near the numeric midpoint of single integer keys. Composite and UUID primary keys use the two ends, and keyless tables use a bounded scan. Sparse keys can cause windows to overlap. Text is capped at 2,048 characters, JSON documents over 64 KiB are skipped, and the shared one-minute budget cancels active sampling reads. Reports list examined counts and skipped columns. Terminal summaries distinguish incomplete checks and warnings from a full pass.

FlagTypeDefaultDescription
--configpathsubveil.yamlConfiguration file.
--checkslist—Checks to run: fk, counts, unique, pii, or all (default all).
--tableslist—Limit verification to comma-separated tables (e.g. public.users,public.orders).
--strictboolean—Fail if any check is skipped or warned.
--jsonboolean—Write exactly one structured JSON report to stdout; diagnostics go to stderr.
--targetDSN—Target database connection string.

Configure exceptions with verify.ignore_columns and verify.ignore_patterns. Row counts are skipped, not passed, when the summary is missing or belongs to another target. Without strict mode, warnings and skipped checks can still exit 0. Use --strict when automation requires every selected check to run and pass. Verify exits 0 when no failure is reported, 1 for failure or an incomplete pull, 2 for a usage error, and 3 for an operational or connection error. Unknown check names exit with code 2.

Cloud control plane & compliance

Team policy sync & schema drift detection

Pull always applies the masking rules in the local subveil.yaml. Cloud stays optional: link a project to report schema metadata and signed audit receipts automatically. Use subveil policy pull to replace local policy sections with the published team policy, or subveil policy push to review and publish local policy sections. Push sends only engine, subset, and tables; connection and masking-key settings stay local. It compares with the latest Cloud policy, asks for confirmation (or --yes in reviewed automation), and rejects concurrent Cloud updates:

Cloud sync & policy pull
bash
# Authenticate and link this local configuration
subveil login
subveil link --project prj_01hxyz
​
# Send table and column metadata to the dashboard before publishing a policy
subveil schema push
​
# Explicitly download the published policy into the local config
subveil policy pull --project prj_01hxyz --config subveil.yaml
​
# Copy using the rules currently in subveil.yaml; Cloud reporting is automatic when connected
subveil pull --config subveil.yaml

Tamper-evident audit receipts

Every successful non-dry-run pull saves an HMAC-authenticated receipt locally. Offline receipts stay local when you reconnect. Ordinary Cloud delivery failures are warnings. Use --no-cloud to disable Cloud traffic. Offline receipts use the configured SUBVEIL_MASK_KEY; when Cloud is connected, the CLI signs with the Cloud token and uploads that same receipt. --require-audit makes the command fail if project credentials are missing or Cloud does not accept the receipt; the database copy may already have completed. The receipt provides cryptographic integrity and authenticity:

  • SHA-256 Content Digest (receipt_sha256): A cryptographic digest computed over the canonical JSON representation of the receipt contents (sorted UTF-8 keys, exact number formats, normalized whitespace, excluding the hash and signature fields). A mismatch with a trusted digest indicates that the receipt contents changed. The digest alone does not authenticate the sender.
  • HMAC-SHA256 Authentication Tag (signature): An authentication tag computed with HMAC-SHA256 over receipt_sha256. Cloud checks the HMAC at ingestion using the bearer token (SUBVEIL_API_KEY or project CI token), which lets the control plane authenticate the uploader. Offline receipts use the local masking key and are not sent to Cloud.
  • Pipeline execution evidence: The receipt cryptographically records execution parameters: policy content hash, source and target host fingerprints, copied row counts per table, and masked column lists. Row pulls support optional business reasons. The dashboard compares stored hashes, and the ledger links stored receipts in order. Independent HMAC verification needs the original secret. These records describe the copy. Verification checks are a separate source of evidence. See the DPDP staging example for a worked policy and target checks.

Examples & CI/CD recipes

End-to-end workflow

Compare classic subsetting with the v0.4.1 row-subset workflow:

CLI v0.4.1 — Classic subsetting

Classic subsetting
bash
# 1. Introspect schema and generate subveil.yaml
subveil init --schemas public --out subveil.yaml
​
# 2. Preview topological execution stages and table order
subveil plan --config subveil.yaml
​
# 3. Pull masked data; an empty target gets its schema automatically
subveil pull --config subveil.yaml --truncate

CLI v0.4.1 — Verified row-subset workflow

Verified row-subset workflow
bash
# 1. Review source schema, sensitive-column findings, and execution plan
subveil plan --config subveil.yaml
​
# 2. Preview targeted row extraction with bounded parent/child traversal
subveil plan --config subveil.yaml --row orders:4821 --max-depth 2
​
# 3. Extract and mask the row slice with a business reason
subveil pull --config subveil.yaml --row orders:4821 --reason "Bug investigation #4821"
​
# 4. Verify referential integrity, constraints, and sampled data on target
subveil verify --config subveil.yaml --strict

Example 1: Single-tenant slice

Copy all relational records for organization "acme" while keeping lookup tables intact:

subveil.yamlexample
subset:  roots:    - table: public.organizations      where: "slug = 'acme'"  full_tables:    - public.plans    - public.currencies  exclude_tables:    - public.audit_events    - public.webhook_deliveries

Example 2: Ephemeral PR database in GitHub Actions

Create a masked database in the job, verify the copy, and then run your application tests. Replace YOUR_PROJECT_ID and add the repository secrets listed in the workflow. Use a checked-in configuration and review the rules before running it. The service database is temporary. The final status describes the job, and PR closure describes the pull request.

This workflow installs Subveil v0.4.1.

.github/workflows/subveil-pr.ymlexample
# Generated by Subveil for project YOUR_PROJECT_ID.# This workflow installs Subveil v0.4.1.# Repository secrets to add: SUBVEIL_API_KEY, SUBVEIL_SOURCE_URL, SUBVEIL_MASK_KEY.# Fork pull requests are skipped because GitHub does not provide their secrets.name: Subveil PR database​on:  pull_request:    types: [opened, synchronize, reopened, closed]​permissions: { contents: read }concurrency:  group: subveil-pr-${{ github.event.pull_request.number }}  cancel-in-progress: true​jobs:  database:    if: github.event.pull_request.head.repo.full_name == github.repository    runs-on: ubuntu-latest    timeout-minutes: 30    services:      postgres:        image: postgres:18        env: { POSTGRES_PASSWORD: subveil }        ports: ["5432:5432"]        options: --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 5s --health-retries 12    env:      SUBVEIL_API_URL: https://subveil.dev      SUBVEIL_PROJECT_ID: YOUR_PROJECT_ID      SUBVEIL_VERSION: "0.4.1"      SUBVEIL_API_KEY: ${{ secrets.SUBVEIL_API_KEY }}      SUBVEIL_SOURCE_URL: ${{ secrets.SUBVEIL_SOURCE_URL }}      SUBVEIL_MASK_KEY: ${{ secrets.SUBVEIL_MASK_KEY }}      PR_NUMBER: ${{ github.event.pull_request.number }}      SUBVEIL_TARGET_URL: "postgres://postgres:subveil@localhost:5432/postgres?sslmode=disable"    steps:      - uses: actions/checkout@v4      - name: Install Subveil        shell: bash        run: curl -fsSL "$SUBVEIL_API_URL/install.sh" | sh -s -- --version "$SUBVEIL_VERSION" --pg-client "18"      - name: Create the masked database        if: github.event.action != 'closed'        run: subveil pull --config "subveil.yaml" --project "$SUBVEIL_PROJECT_ID" -j 4      - name: Verify the masked database        if: github.event.action != 'closed'        run: subveil verify --config "subveil.yaml"      - name: Run tests against the masked database        if: github.event.action != 'closed'        env: { DATABASE_URL: "${{ env.SUBVEIL_TARGET_URL }}" }        run: |          npm ci          npm test      - name: Report final status        if: always() && github.event.action != 'closed'        continue-on-error: true        run: subveil ci report --status "${{ job.status }}"      - name: Report closed        if: always() && github.event.action == 'closed'        continue-on-error: true        run: subveil ci report --status closed​

Example 3: Nightly staging refresh

Truncate and refresh a shared staging database on a cron schedule with parallel workers:

Nightly staging refresh1 command
bash
# Truncate target tables and stream a fresh masked slice using 4 parallel workers
subveil pull --config subveil.yaml --truncate --require-audit -j 4

Troubleshooting & safety

Common errors and fixes

For further technical assistance, see Subveil support.

IssueTypeDefaultDescription
Missing target schemaSchema—An empty target gets its schema from source DDL automatically. For an existing target, run your schema migrations before pulling.
Target is not emptyTarget DB—Point SUBVEIL_TARGET_URL to an empty database, or pass --truncate to clear existing target rows.
Missing SUBVEIL_MASK_KEYEnvironment—Export SUBVEIL_MASK_KEY in your shell or CI secrets. Keep the key consistent across runs for deterministic masks.
Potentially unmasked sensitive columnsPII—Review sensitive-column findings from subveil plan and add appropriate masking rules to subveil.yaml.
Source query timeoutTimeout—Increase read timeout with --source-timeout 2h or point SUBVEIL_SOURCE_URL to a read replica.

Safety guarantees

The v0.4.1 source was tested on PostgreSQL 18.6 with composite keys, partitions, enums, domains and stored generated columns. Target sequences for SERIAL, IDENTITY and supported nextval defaults are restarted transactionally using the configured direction, increment, start, and bounds. The loader must be able to alter those sequences. Pull reports an error if the loaded identifiers leave no valid restart value. Virtual generated columns are outside this tested contract.

Schema creation needs all referenced dependencies. Views are restored as definitions and materialized views require a refresh. Foreign-table data is outside the copy scope. Source row-level security limits visible rows, and the target loader needs permission to use COPY FROM. Default PostgreSQL loads are transactional. Parallel writes and MySQL or MariaDB DDL have different rollback behavior.

  • Read-only on source: Subveil does not write to source tables. PostgreSQL row pulls and parallel source readers use READ ONLY transactions. Classic subset selection can use session-local temporary tables, and reads can still acquire database locks.
  • Target safeguard: Subveil refuses to run if SUBVEIL_SOURCE_URL and SUBVEIL_TARGET_URL identify the same database. Pull also compares live database identity before writing, so changing the connection URL alone does not bypass the safeguard.
  • Transactional loading: Default PostgreSQL loads use a transaction for schema changes, copied rows, and sequence restarts. Parallel writes use separate transactions and have different cleanup behavior.
  • Runner data flow: The CLI processes rows and uses database credentials on the runner. Linked projects can send policies, schema reports and receipt reasons to Cloud.

Local-first CLI

Start with a smaller database copy.

Install the free CLI, review your generated subveil.yaml, and verify your target database locally.