Schedule icon
If icon
Fail icon
Compose icon
Docker icon
Queries icon
CreateBucket icon
Query icon
Sequential icon
Script icon
Upload icon
Download icon

PrivacyBudget, Differential Privacy Export Gate

Gate analytics exports by epsilon budget, run real diffprivlib algorithms, verify S3 publication, and retain a PostgreSQL audit trail.

Categories
Data

PrivacyBudget enforces a subject's differential-privacy allowance before analytics export. It releases only noisy aggregates and verifies S3 publication.

How it works

  1. A disabled daily schedule provides the production trigger.
  2. Demo mode starts pinned PostgreSQL and LocalStack containers, creates a bucket, and seeds bounded fixtures and an epsilon budget.
  3. PostgreSQL locks the budget and records an idempotent decision, so retries cannot spend twice.
  4. The approval If fails closed. Approved requests split epsilon across bounded mean and count mechanisms; rejected requests cannot query data or call S3.
  5. Kestra uploads the noisy JSON, downloads and hashes it, then marks the audit PUBLISHED. Errors mark reserved work FAILED and clean up containers.

What you get

  • Atomic accounting with remaining epsilon and a durable rejection reason.
  • A verified S3 aggregate containing no raw records.
  • Deterministic demo fixtures and seeds; secure randomness in production.
  • Retries, bounds checks, failure bookkeeping, and cleanup.

Who it's for

  • Privacy engineers enforcing differential-privacy release policies.
  • Analytics teams publishing governed aggregate datasets.
  • Reviewers needing reproducible gate evidence.

Why orchestrate this with Kestra

Kestra keeps reservation, privacy mechanisms, S3 verification, audit state, and failures in one versioned execution with clear lineage.

Prerequisites

  • Docker for demo mode, or PostgreSQL and an S3-compatible bucket for production.
  • A production privacybudget.budgets row and bounded data in privacybudget.daily_metrics.
  • PostgreSQL, AWS, Docker, and Python plugins on the worker.

Secrets

  • POSTGRES_USERNAME: Principal allowed to read metrics and update privacy ledgers.
  • POSTGRES_PASSWORD: Password for that principal.
  • AWS_ACCESS_KEY_ID: S3 key with read/write access to the export prefix.
  • AWS_SECRET_ACCESS_KEY: Secret paired with the S3 key.

Quick start

  1. Run with defaults for an approved deterministic export (0.4 of a 1.0 budget).
  2. Run with requested_epsilon: 1.2 to prove BUDGET_EXCEEDED and no S3 write.
  3. For production, create the budget and bounded data, configure secrets and S3 inputs, disable demo mode, test, then enable the schedule.

How to extend

  • Add contribution bounding or more mechanisms and update the explicit sequential-composition split.
  • Reset budgets in a separately reviewed flow, partition audit history, or send rejection events to a governance queue.
  • Replace static credentials with the AWS default provider chain or an assumed role.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.