Skip to content

darshana-v/secure-qa-dp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Q&A over Sensitive Data (Privacy-preserving LLM→SQL)

Stack: Python • Flask • SQLAlchemy • Postgres (or SQLite) • LangChain • OpenAI (or other LLM)
Features: schema-aware LLM→SQL translation (with conservative fallback), RBAC & PII masking, audit logging, per-user privacy budgets, Laplace & Gaussian differential privacy for aggregates.

Quick start (local, SQLite)

  1. copy .env.example.env and edit if needed
  2. (Optional) create a Postgres DB and set DATABASE_URL in .env
  3. install:
    python -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  4. init DB & seed:
    python3 init_db.py
  5. run:
    python3 app.py

How it works

  • LLM→SQL: uses LangChain's SQLDatabaseChain if OPENAI_API_KEY is set; otherwise falls back to a conservative rule-based translator that only supports basic patterns.

  • RBAC & PII masking: policies determine which columns each role can access and whether PII values (ssn/name) are masked.

  • Differential privacy: aggregates use Laplace (ε-DP) or Gaussian (ε,δ-DP) mechanisms. Gaussian sigma computed with sigma >= sqrt(2 ln(1.25/delta)) * sensitivity / epsilon.

  • Privacy budgets: each user has an epsilon budget tracked in DB. Aggregate queries deduct the requested epsilon.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages