Metadata-Version: 2.4
Name: sdsa
Version: 1.1.1
Summary: Self-hostable data sanitization app with PII detection, pseudonymization, k-anonymity, and bounded DP noise
Author: DEFAI Private Limited
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://github.com/defai-digital/sdsa
Project-URL: Repository, https://github.com/defai-digital/sdsa
Project-URL: Documentation, https://github.com/defai-digital/sdsa/blob/main/README.md
Project-URL: Deployment Guide, https://github.com/defai-digital/sdsa/blob/main/docs/deployment.md
Project-URL: Privacy Model, https://github.com/defai-digital/sdsa/blob/main/docs/privacy-model.md
Project-URL: Bug Tracker, https://github.com/defai-digital/sdsa/issues
Keywords: privacy,pii,data-sanitization,anonymization,pseudonymization,k-anonymity,differential-privacy,fastapi
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.115
Requires-Dist: uvicorn[standard]>=0.30
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: polars>=1.0
Requires-Dist: pyarrow>=16
Requires-Dist: opendp>=0.11
Requires-Dist: phonenumbers>=8.13
Requires-Dist: chardet>=5.2
Requires-Dist: pydantic>=2.8
Requires-Dist: python-dateutil>=2.9
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: httpx>=0.27; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"

# SDSA

Secure Data Sanitization App (SDSA) is a self-hostable tool for sanitizing
tabular data before it leaves a trusted environment.

It ingests CSV, delimited TXT, and single-table SQL `INSERT` dumps; detects
likely sensitive fields; applies explicit per-column privacy policies; enforces
k-anonymity; and exports a sanitized CSV with JSON and Markdown privacy reports.

## Install

```bash
pip install sdsa
sdsa-server start
```

Open <http://127.0.0.1:8000/>.

## What It Does

- Serves a browser UI and REST API from one FastAPI application.
- Detects likely PII such as email, phone, card number, government ID, date of
  birth, name, and address fields.
- Supports `retain`, `mask`, `hash`, `tokenize`, `redact`, `drop`,
  `numeric_bin`, `date_truncate`, `string_truncate`, and `dp_laplace` actions.
- Applies bounded Laplace noise to numeric columns when differential privacy is
  configured with explicit `epsilon`, `lower`, and `upper` values.
- Enforces k-anonymity over selected quasi-identifiers.
- Provides preflight suppression estimates before processing.
- Stores uploaded data in memory with a default 30-minute session TTL.

## CLI

```bash
sdsa-server start
sdsa-server start --host 0.0.0.0 --port 8000
sdsa-server start --random-port
sdsa-server start --reload
```

The package includes the static frontend, so no separate web build is required.

## Privacy Model

SDSA produces pseudonymized microdata with optional per-column local-DP style
noise. It does not claim dataset-level `(epsilon, delta)` differential privacy.
Linkage attacks using auxiliary data may still succeed.

k-anonymity bounds prosecutor re-identification risk to at most `1/k` for the
declared quasi-identifier set, subject to the limits described in each generated
privacy report.

## Deployment

For production, run `sdsa-server start` behind TLS termination and keep one SDSA
process per deployment unless you replace the in-memory session store with
shared infrastructure. The GitHub repository includes Docker, Compose, nginx,
and CI/CD examples.

## Links

- Source: <https://github.com/defai-digital/sdsa>
- Documentation: <https://github.com/defai-digital/sdsa/blob/main/README.md>
- Deployment guide: <https://github.com/defai-digital/sdsa/blob/main/docs/deployment.md>
- Privacy model: <https://github.com/defai-digital/sdsa/blob/main/docs/privacy-model.md>
