Enterprise-grade AI platform for detecting phishing and Business Email Compromise using federated learning and differential privacy.
- Model: TinyLlama-1.1B + PEFT LoRA (r=16, α=32), 5 multi-task classification heads
- Privacy: Opacus DP-SGD, ε < 5, Rényi accounting
- Federation: Flower FedProx + SecAgg+ (no raw email transmission)
- Defense: Homoglyph normalization, Unicode stripping, prompt injection guard, URL chain resolution
- Intelligence: MITRE ATT&CK, MISP, OpenPhish, PhishTank, AbuseIPDB via FAISS HNSW
| Metric | Target |
|---|---|
| Macro F1 | > 0.92 |
| p99 Latency | < 100 ms |
| False Positive Rate | < 2% |
| Privacy leakage | < 0.1% |
| Privacy budget ε | < 5 |
| Memory footprint | < 2 GB |
git clone https://github.com/YOUR_ORG/privashield.git
cd privashield
pip install -r requirements.txt
uvicorn src.api.main:app --reloadOpen http://localhost:8000/docs for the interactive API.
- Fork this repo
- Create a new Railway project → "Deploy from GitHub repo"
- Add env vars (see
.env.example) - Deploy — Railway auto-detects
Dockerfileor usesrailway.json
kubectl apply -k k8s/overlays/production| Variable | Default | Description |
|---|---|---|
PORT |
8000 |
HTTP port (Railway injects automatically) |
DEMO_MODE |
true |
Skip heavy ML deps; use mock classifier |
LOG_LEVEL |
info |
structlog level |
OPENPHISH_API_KEY |
— | OpenPhish premium feed key |
ABUSEIPDB_API_KEY |
— | AbuseIPDB v2 key |
MISP_URL |
— | MISP instance URL |
MISP_KEY |
— | MISP auth key |
SECRET_KEY |
change-me | API auth secret |
MAX_CONCURRENT_REQUESTS |
100 |
Semaphore limit |
src/
api/ FastAPI app, routes, middleware
core/ EmailThreatClassifier, embeddings, task heads
defense/ AdversarialDefenseLayer
federation/ FederatedLearningServer (Flower)
intelligence/ RASIEngine (FAISS + threat feeds)
training/ DP-SGD training loop
evaluation/ Metrics, privacy audit, adversarial eval
k8s/ Kubernetes manifests (Kustomize)
tests/ Unit + integration test suite
scripts/ Data prep, index build, smoke test
Apache 2.0 — see LICENSE.