Keep a masking manifest#
With manifest set in jobs.yaml, each run writes a sealed record of what was masked, how, and under which key fingerprint: a file, replaced by each run, or a table, which keeps every run's. It's what an auditor asks for.
With run --job, as an orchestrator's task per job runs, a file isn't replaced: each run merges its jobs in under a lock, replacing only their own entries, and re-seals it. What the file held must verify first; one that doesn't is never overwritten, and the run logs what it did:
- Altered, or unreadable: it is moved aside as
manifest.json.rejected-<time>, and started afresh. - Signed with a key the run can't check (another key, or none set): a task set up wrong, so the file is kept and the run's manifest written beside it as
manifest.json.unmerged-<time>.
A file is always replaced in one step, never read half-written.
manifest: ../transaction/manifest.json # a file, relative to jobs.yaml
manifest:
connection: warehouse # or a table
bauta verify-manifest # the latest; exit 0 intact, 1 altered
bauta verify-manifest --run RUN_ID # an earlier one, from a table
--manifest FILE or --manifest-connection ALIAS overrides the setting, on run and on verify-manifest. Set BAUTA_MANIFEST_KEY to sign manifests; only a signature shows who wrote one. The manifest describes its content and how verification works.
What it records#
{
"generatedAt": "2026-09-16T13:25:57+00:00",
"runId": "0b6c1f0e-4d1e-4f7a-9a43-2f0c9f6a1d52",
"jobs": [
{
"job": "maskCustomers",
"status": "completed",
"sourceConnection": "prod",
"targetConnection": "staging",
"targetTable": "customers",
"keyFingerprint": "d5930cf83dea",
"rowCount": 48210,
"columns": [
{"column": "id", "strategy": "key", "domain": "customer", "source": "column"},
{"column": "notes", "strategy": "null", "domain": null, "source": "column"}
]
}
],
"maskedBy": "bauta-rs/0.1.3",
"tool": {"name": "bauta", "version": "0.1.3"},
"configuration": {"jobsFile": "configuration/jobs.yaml", "sha256": "9f2c…"},
"integrity": {
"algorithm": "sha256",
"digest": "4be1…",
"signatureAlgorithm": "hmac-sha256",
"signature": "0c7a…",
"signingKeyFingerprint": "71d04ab2e913"
}
}
columnslists the columns the query actually returned, and the policy applied to each.sourcesays whether a column was listed incolumnsor fell todefaultStrategy.- A masked job that failed or was skipped is still listed, with its status and no columns. "This copy was not refreshed" belongs in the record too.
- The manifest is written even when the run fails. It never contains a value or the key.
configurationnames the jobs file and its SHA-256, so a reviewer can tell which policy produced the run, andincludeseach included file with its own.maskedByispython, or the native masker and its version.runIdmatches the run's history. Afterrun --job, each job's entry carries its ownrunId,generatedAtandmaskedBy.
From Python, RunResult.maskingManifest(jobsFile.jobs) returns the manifest before sealing, without tool, configuration or integrity; sealManifest adds the last.
In a table#
To keep every run's manifest, or keep them with the data they describe, store them in a table:
manifest:
connection: warehouse # an alias in connections.yaml
table: audit.bauta_manifest # optional; bauta_manifest by default
or --manifest-connection ALIAS for one run. Each is stored as the file would be, in 2000-character pieces so one table definition fits every database, under its run id. The table must exist first (tables).
bauta verify-manifest with no file reads the latest manifest from there, and --run RUN_ID picks an earlier one.
The table is not what makes a manifest trustworthy. Whoever can write to it can replace a manifest, and recompute its digest to match. Only a signature shows who wrote one, wherever it's stored.
Sealing and verifying#
Every manifest carries a SHA-256 digest of its content, showing it hasn't been edited; but anyone can recompute a digest. To show who wrote it, set a signing key, and it is also signed with HMAC-SHA256:
export BAUTA_MANIFEST_KEY=... # at least 16 characters; not the masking key
bauta run
bauta verify-manifest # the manifest jobs.yaml names; or a FILE, or --manifest-connection ALIAS
verify-manifest exits 0 for an intact manifest (saying whether it was signed), and 1 if it was altered or its signature doesn't match. With BAUTA_MANIFEST_KEY set, an unsigned manifest exits 1 too, or an edit could pass by dropping the signature. Verifying a signed manifest without its key exits 2. --manifest-key-variable reads the key from another variable.