India-first B2B incident-response platform for digital impersonation and synthetic-media (deepfake) incidents.
Evidence Custody β Threat Triage β Multi-Role Human Review β Statutory Notice Preparation β SLA Tracking β GAC Escalation
The Digital Impersonation Response Desk is an enterprise-grade SaaS system engineered to detect, preserve evidence of, classify, and formulate formal statutory takedown notices for online impersonation campaigns, executive deepfakes, fraudulent brand accounts, and synthetic media scams.
It is built specifically around the legal and regulatory architecture of the Republic of Indiaβintegrating the Information Technology Act, 2000 (IT Act), the Information Technology (Intermediary Guidelines and Digital Media Ethics Code) Rules, 2021 (IT Rules 2021), the Digital Personal Data Protection Act, 2023 (DPDP), and Section 65B of the Indian Evidence Act / Section 63 of Bharatiya Sakshya Adhiniyam, 2023.
The rapid weaponization of generative AI has fundamentally altered brand protection and cybersecurity:
- Hyper-Realistic Impersonation: Scammers deploy voice clones and video deepfakes of corporate executives, physicians, and founders within hours to direct fraudulent payments, market counterfeit pharmaceuticals, or harvest credentials.
- The Evidence Crisis: Traditional screenshots are easily dismissed in legal proceedings due to missing metadata, lack of hash verification, and broken chains of custody.
- The 72-Hour Statutory Window: Under Rule 3(2)(b) of the IT Rules 2021, major social media intermediaries must act on impersonation and deepfake grievances within 72 hours. Most corporate legal teams fail to mobilize evidence and formulate compliant notices before this window lapses.
- The Autonomous Trap: Blindly automating takedowns creates catastrophic legal risks: automated false-positive takedowns trigger defamation lawsuits and tortious interference liability.
The Response Desk solves this by serving as an intelligence and forensic acceleration platform for human incident responders, enforcing cryptographic custody and strict human-in-the-loop governance.
Engineering an enterprise platform for digital impersonation response requires solving several conflicting challenges:
- Forensic Immutability vs. Data Privacy: How to reconcile mandatory 180-day forensic evidence preservation under IT Rules Rule 3(1)(h) with a Data Principal's Right to Erasure under DPDP Section 12(3).
-
Streaming Ingestion vs. Memory Sandboxing: Ingesting large evidence files (up to 50 MB) while computing streaming cryptographic hashes in
$O(1)$ memory without buffering full payloads into RAM. - Multi-Tenancy vs. BOLA / IDOR: Preventing cross-tenant data leaks across confidential corporate investigations at the database query layer rather than relying on error-prone route middleware alone.
- Third-Party Integration Safety: Integrating with external platform APIs (YouTube, Meta, X) while maintaining an absolute guarantee of zero unauthorized account mutations.
- Assurance Discipline: Verifying release candidates through explicit dependency graphs and deterministic gates, rather than relying on superficial local tests or fabricated readiness claims.
The application is built as a modular monolith in TypeScript on Node.js 22 LTS, backed by SQLite 3 (better-sqlite3) in Write-Ahead Logging (wal) mode with foreign key enforcement and an AWS S3 WORM evidence vault (ap-south-1).
graph TD
subgraph Client Tier
UI["Web Single Page Application (Tailwind CSS / Semantic HTML)"]
end
subgraph Security & API Gateway
SecHeaders["Security Headers (Helmet / CSP / CORS)"]
RateLimiter["Sliding Window Rate Limiter"]
AuthMiddleware["HMAC Bearer Token Auth & RBAC"]
TenantGuard["Multi-Tenant Isolation Guard (WHERE org_id = ?)"]
end
subgraph Core Domain Monolith
Router["Express Router (21 Modular Route Controllers)"]
Services["Domain Services (Triage, Playbooks, Evidence, Approvals)"]
StateMachines["Finite State Machines (Case, Evidence, Submission)"]
Workers["Background Worker Pool (8 Persistent Workers with Leases)"]
end
subgraph Persistence & Forensic Storage
SQLite[("Primary Relational DB (WAL Mode / 36 Tables)")]
AuditLedger[("Immutable Append-Only Audit Ledger")]
LocalWORM[("Local Staging Storage (HMAC Token Gated)")]
AWSS3[("AWS S3 Evidence Vault (COMPLIANCE Mode WORM in ap-south-1)")]
end
subgraph External Platforms (Strictly Controlled)
KillSwitch{"Emergency Kill Switch (Active Guard)"}
OutboundGuard{"ENABLE_LIVE_PLATFORM_ACTIONS = false"}
YouTubeAPI["YouTube Data API (Strict youtube.readonly Scope)"]
WebSub["Inbound WebSub Webhooks (HMAC-SHA256 Verified)"]
end
UI --> SecHeaders --> RateLimiter --> AuthMiddleware --> TenantGuard --> Router
Router --> Services
Services --> StateMachines
Services --> SQLite
Services --> AuditLedger
Services --> LocalWORM
Services -.-> AWSS3
Workers --> SQLite
Services --> KillSwitch --> OutboundGuard --> YouTubeAPI
WebSub --> KillSwitch
Every incident progresses through a formal, audited lifecycle:
graph TD
Signal["Signal / Intake Ingestion"]
Triage["Incident Classification & Triage"]
Evidence["Evidence Capture & Streaming SHA-256"]
Custody["Forensic WORM Custody & Hash Binding"]
Clock["Rule 3(2) Statutory Countdown Clock (24h/72h)"]
Playbook["Platform Playbook Notice Formulation (9 Platforms)"]
Approvals{"Multi-Facet Human Approval Gate (Legal + Evidence)"}
Submission["Submission Packet Dossier & Sec 65B Certificate"]
Tracking["Platform Response Tracking & Acknowledgement Check"]
Escalation["GAC Appeal Escalation (Rule 3A IT Rules)"]
Signal --> Triage
Triage --> Evidence --> Custody
Triage --> Clock
Triage --> Playbook
Custody --> Approvals
Playbook --> Approvals
Clock --> Approvals
Approvals -->|All Approved| Submission
Submission --> Tracking
Tracking -->|Unresolved > 72h| Escalation
Rather than forcing complex release verification and statutory workflows into sequential shell scripts or unconstrained loops, this project was engineered using Directed Acyclic Graph (DAG) Engineering:
graph TD
subgraph Plan
PlanNode["PLAN: Baseline Reconciliation & Dependency Scoping"]
end
subgraph Fan-Out (Parallel Independent Specialists)
PlanNode --> Sec["Security Audit & Adversarial QA (11 Attack Vectors)"]
PlanNode --> Cloud["Cloud Infrastructure IaC Audit (ap-south-1 WORM)"]
PlanNode --> SRE["Reliability & Canary Protocol (72h Soak Design)"]
PlanNode --> Legal["Indian Legal Counsel Package (5 Statutory Inquiries)"]
PlanNode --> Operator["Browser CDP & Operator UAT (24 Golden Steps)"]
end
subgraph Fan-In & Reduce
Sec --> Reducer["REDUCE: Central Evidence Indexer & Findings Reducer"]
Cloud --> Reducer
SRE --> Reducer
Legal --> Reducer
Operator --> Reducer
end
subgraph Verify & Gate
Reducer --> Verifier["INDEPENDENT VERIFIER: Fresh-Context Adversarial Disproval"]
Verifier --> Gate{"DETERMINISTIC GA GATE: 17 Mandatory Criteria"}
Gate --> Outcome["STATUS DETERMINATION: GA Strictly Withheld"]
end
- Parallel Fan-Out: Independent specialist tracks (cloud provisioning, legal review, pen-test preparation) run concurrently without artificial blocking.
- Failure Containment: An open external dependency (such as pending AWS credentials) contains its blast radius to that specific branch without breaking internal test runs.
- Independent Disproval: A separate verification node actively attempts to disprove the success claims of prior nodes before any release gate evaluates.
- No Fabricated Evidence: If an external edge requires third-party physical action (an accredited pen-test report or physical elapsed canary time), the node halts at
OPEN / BLOCKED. It is never synthetically simulated.
The system implements comprehensive defenses verified against a 19-vector STRIDE threat model:
- Authentication Hardening (
src/middleware/auth.ts): Stateless HMAC-SHA256 Bearer session tokens with constant-time verification (crypto.timingSafeEqual). Header-based authentication (x-user-id) is strictly rejected in production. - Multi-Tenant Scoping (Anti-BOLA/IDOR): Every SQL query reading or writing tenant records includes explicit
WHERE organization_id = ?parameterization. Cross-tenant queries returnHTTP 404 Not Foundto deny existence enumeration. - Input Validation & SSRF Firewall: URLs submitted for monitoring pass through strict SSRF sanitization (
src/services/monitoring/url-normalization-service.ts) blocking loopback (127.0.0.1), link-local (169.254.169.254), and private RFC 1918 subnets. - Fail-Closed Secrets (
src/config/env.ts): InNODE_ENV=production, the application refuses to boot if secrets are weak (< 32 characters) or contain development prefixes (dev_,test_). - Adversarial Red-Team Verification: Rejection of 11 / 11 adversarial exploit vectors verified in
tests/security/independent-verification.test.ts.
Digital evidence is protected through an auditable, court-ready forensic pipeline:
-
Streaming SHA-256: Computed in memory chunks directly on the incoming byte stream (
$O(1)$ memory bound). -
Magic-Byte MIME Validation: Header inspection verifies legitimate media (
JPEG,PNG,MP4,PDF) and rejects disguised executables. -
Opaque Storage Keys: Renamed to random UUID v4 identifiers (
ev_<uuid>.bin) outside the web root, eliminating path traversal. - Time-Limited HMAC Download Tokens: Direct public downloads are blocked. Authenticated operators receive 300-second HMAC-SHA256 signed download tokens.
-
180-Day WORM Compliance: S3 Object Lock configured in
COMPLIANCEmode enforcing minimum 180-day retention lock per Rule 3(1)(h) of the IT Rules 2021. -
Legal Holds & Two-Person Deletion: Active legal holds override all deletion requests (
HTTP 409 Conflict). Unheld expired evidence requires dual independent operator sign-off before purging.
Core Invariant: The system shall NEVER autonomously accuse, declare content illegal, or execute external platform takedowns.
- No Autonomous Accusations: Defamation and impersonation classifications are advisory scores for human experts; they are never committed autonomously.
- Separation of Duty: High-severity takedown notices require independent sign-offs from
LegalCounselandEvidenceSpecialistbefore notice formulation. - Simulated Submissions (Controlled Pilot): In pilot mode (
ENABLE_LIVE_PLATFORM_ACTIONS = false), complaints transition tosimulated_submitted, generating a complete legal packet for manual operator review with 0 outbound network calls. - Emergency Kill Switch: Administrative endpoint (
/api/integrations/kill-switch) immediately suspends all inbound and outbound webhook processing, returningHTTP 503 KILL_SWITCH_ACTIVE.
External integrations adhere to least-privilege principles:
- YouTube Data API v3: Strictly restricted to read-only access (
youtube.readonlyscope) for tracking complaint status. Write/mutation scopes are forbidden. - WebSub Inbound Webhooks: Verifies HMAC-SHA256 payload signatures using stored secret hashes; raw secrets are never persisted in plaintext.
- Encrypted Token Vault: Stored provider OAuth tokens are encrypted at rest using AES-256-GCM (
src/services/integrations/token-encryption.ts) with dual-key rotation support. - No Unauthorized Scraping: Unauthenticated headless DOM scraping is completely prohibited in favor of official platform APIs and push feeds.
The codebase is backed by a comprehensive, fully passing automated test suite:
================================================================================
Test Category Location Files Tests Status
================================================================================
Unit Tests tests/unit/ 23 115 PASS (100%)
Integration Tests tests/integration/ 14 87 PASS (100%)
Security & Hardening tests/security/ 18 112 PASS (100%)
Database Migrations tests/database/ 7 35 PASS (100%)
Storage & WORM tests/storage/ 3 22 PASS (100%)
Resilience & Faults tests/resilience/ 1 6 PASS (100%)
Config Validation tests/config/ 1 7 PASS (100%)
Services & Hashers tests/services/ 1 9 PASS (100%)
Performance Benchmark tests/benchmark/ 1 1 PASS (100%)
End-to-End tests/e2e/ 1 8 PASS (100%)
--------------------------------------------------------------------------------
TOTAL AUTOMATED SUITE tests/ 80 447 PASS (0 FAIL)
TypeScript Compilation tsc --noEmit - - CLEAN (0 ERR)
SQLite PRAGMAs better-sqlite3 - - integrity_check=ok
Adversarial Red Team independent-verif - 11 11/11 DEFEATED
Operator Golden Path scripts/execute-uat - 24 24/24 VERIFIED
================================================================================
The system is evaluated against 17 mandatory release gates. General Availability is STRICTLY WITHHELD until four physical external assurance activities conclude:
| Gate | Requirement | Status | Evidence Reference |
|---|---|---|---|
| GATE 01β13 | Software, Types, DB, Security, RBAC, WORM, Runbooks | PASS | 80 test files, 447 tests, clean TypeScript compiler |
| GATE 14 (EXT-001) | Independent External Penetration Testing | OPEN | docs/external-assurance/EXT-001_SCOPE.md |
| GATE 15 (CLOUD-001) | Live AWS ap-south-1 KMS CMK & S3 Object Lock | OPEN | docs/external-assurance/CLOUD-001_ASSURANCE.md |
| GATE 16 (SOAK-001) | 72-Hour Continuous Staged Canary Soak | BLOCKED | docs/external-assurance/SOAK-001_CANARY_PLAN.md |
| GATE 17 (LEG-001) | Qualified Indian Legal Counsel Written Opinion | OPEN | docs/external-assurance/LEG-001_COUNSEL_PACKAGE.md |
Authoritative Release Determination:
GENERAL AVAILABILITY IS WITHHELD.
Permitted Posture: Controlled Pilot / Production-Canary Operation Only under the mandatory disclosure:
"Controlled pilot / production-canary readiness, subject to independent security, privacy, legal, infrastructure, provider-terms, and operational verification."
- Multi-Tenant Core: Express 4 + TypeScript modular monolith with database-level tenant isolation (
WHERE organization_id = ?). - Forensic Custody Pipeline: Streaming SHA-256 calculation, magic-byte validation, and 300s HMAC download tokens.
- Hardware WORM Storage IaC: Terraform for AWS
ap-south-1featuring Customer-Managed KMS Key (CMK) annual rotation, S3 Object Lock in COMPLIANCE mode (180 days), and IAM policies explicitly denyings3:DeleteObject. - Statutory SLA Engine: Countdown timer tracking Rule 3(2) IT Rules 2021 (24h ack, 72h takedown resolution).
- Platform Playbooks: Structured statutory grievance formulation across 9 global platforms.
- Multi-Role Governance: Separation of duty requiring independent Legal Counsel and Evidence Specialist sign-offs.
- Controlled Integrations: Read-only YouTube adapter (
youtube.readonly), WebSub webhook validation, and emergency kill switch. - Background Worker Pool: 8 persistent workers operating with SQLite lease locking, bounded retries, and dead-letter handling.
- Adversarial Security Hardening: 11/11 exploit attacks defeated in automated red-team test harness.
- Browser Automation (CDP): Headless Chrome verification validating CSS styling, dynamic roles, and 0 uncaught exceptions.
digital-impersonation-response-desk/
βββ README.md # Flagship engineering documentation
βββ LICENSE # ISC License specification
βββ SECURITY.md # Security policy and responsible disclosure
βββ CONTRIBUTING.md # Contribution standards & invariant checklist
βββ CODE_OF_CONDUCT.md # Contributor Covenant Code of Conduct
βββ CHANGELOG.md # Version history and release notes
βββ REPOSITORY_INVENTORY.md # Complete ground-truth code & doc inventory
βββ SECURITY_PUBLICATION_AUDIT.md # Secret scanning and PII audit report
β
βββ .github/
β βββ workflows/ci.yml # GitHub Actions CI workflow (Typecheck, Test, Build)
β βββ ISSUE_TEMPLATE/ # Structured bug and feature templates
β βββ pull_request_template.md # Invariant verification checklist
β
βββ docs/
β βββ README.md # Master documentation navigation portal
β βββ demo.md # 15-Minute technical evaluation guide
β βββ project-history.md # Complete evolutionary history (Phase 1β12)
β βββ architecture/ # System topology, data flow, security boundaries
β βββ engineering/ # Graph engineering & evidence custody specs
β βββ security/ # Threat model, auth, tenant isolation, HITL invariants
β βββ testing/ # Test strategy, adversarial QA, verification matrix
β βββ assurance/ # Current assurance status & external blockers
β βββ product/ # Product overview & Indian cyber law framework
β βββ operations/ # SRE operational runbooks & emergency kill switch
β βββ decisions/ # Architecture Decision Records (ADR-001 to ADR-007)
β βββ external-assurance/ # Briefings for Pentest, Cloud, Soak, and Legal
β
βββ results/ # Verifiable machine-readable results
β βββ FINAL_GA_GATE.json # Evaluation of all 17 release gates
β βββ ASSURANCE_REGISTER.json # Control plane tracking EXT-001, CLOUD, SOAK, LEG
β βββ ASSURANCE_EVIDENCE_INDEX.json # Catalog of all 10 verified evidence items
β βββ EXT-001_FINDINGS.json # Third-party penetration testing status
β βββ CLOUD-001_EVIDENCE.json # AWS ap-south-1 infrastructure status
β βββ SOAK-001_EVIDENCE.json # 72-hour continuous canary soak status
β βββ LEG-001_EVIDENCE.json # Qualified Indian legal counsel review status
β
βββ src/ # TypeScript application source code
β βββ client/ # Vanilla JS SPA & Tailwind styling
β βββ config/ # Fail-closed Zod environment validation
β βββ db/ # SQLite connection, seed, and 9 migrations
β βββ domain/ # Case, evidence, and submission state machines
β βββ middleware/ # HMAC auth, RBAC, and tenant isolation (BOLA guard)
β βββ observability/ # Structured logging with redaction & Prometheus metrics
β βββ routes/ # 21 modular API and health route controllers
β βββ security/ # Rate limiting, account lockout, security headers
β βββ services/ # 26 domain services (Triage, Playbooks, Evidence)
β βββ storage/ # Local staging & S3 Object Lock abstractions
β βββ workers/ # 8 background workers with database lease locks
β
βββ tests/ # Comprehensive automated test suite (80 files / 447 tests)
β βββ benchmark/ # Synthetic throughput & latency benchmarks
β βββ config/ # Environment fail-closed tests
β βββ database/ # Incremental migration tests (0001β0009)
β βββ integration/ # Multi-service & route lifecycle tests
β βββ resilience/ # Failure injection & SQLite lock tests
β βββ security/ # Adversarial QA, BOLA, SSRF, and token tampering
β βββ storage/ # Forensic custody and WORM simulation tests
β βββ unit/ # Domain logic and state machine unit tests
β
βββ terraform/ # AWS production infrastructure as code
β βββ main.tf # AWS provider pinned to ap-south-1
β βββ kms.tf # Customer-Managed KMS Key with annual rotation
β βββ s3_object_lock.tf # S3 bucket in COMPLIANCE mode (180 days)
β βββ iam.tf # Least-privilege role denying s3:DeleteObject
β βββ variables.tf # Strict geographic residency validation
β
βββ scripts/ # Operational verification and regression runners
- Node.js: v22.0.0+ (Tested on Node v22.14.0)
- npm: v10.0.0+
- Git: v2.30+
# 1. Clone repository
git clone https://github.com/LifeOfDevD/DeepFake.git
cd DeepFake
# 2. Install dependencies
npm ci
# 3. Configure environment from template
cp .env.example .env
# 4. Seed database with synthetic demo fixtures
npm run seed
# 5. Start development server
npm run devOpen your browser to: http://127.0.0.1:4000
# Run strict TypeScript compiler verification (0 errors)
npx tsc --noEmit
# Run full automated test suite (all 80 files / 447 tests)
npm test
# Run isolated security regression tests
npm run test:securityFor an in-depth 15-minute evaluation, see the Technical Demo Guide.
- Authentication: Log in as Case Manager
priya.nair@apexhealth.example(PriyaPassword123!). Context locks toApex Health Systems. - Case Inspection: Inspect incident
case_apex_2026_001(Synthetic Deepfake Endorsement). Observe the IT Rules 72-hour countdown timer. - Forensic Custody: Inspect evidence item
ev_apex_001. Observe streaming SHA-256 hash, magic-byte MIME validation, and 180-day WORM retention lock. - Legal Hold Probe: Apply a Legal Hold. Attempting deletion returns
HTTP 409 Conflict: OBJECT_UNDER_LEGAL_HOLD. - Multi-Role Approvals: Switch personas using the header role switcher to
LegalCounselandEvidenceSpecialistto execute multi-facet sign-offs. - Simulated Dispatch: Trigger takedown generation. Status transitions to
simulated_submitted, generating a formal complaint packet and Section 65B forensic certificate with 0 outbound network calls. - Audit Ledger: Inspect the append-only audit trail recording every event with timestamp and actor ID.
Architectural decisions are formally recorded in docs/decisions/:
- ADR-001: Human Review Boundary β Absolute prohibition against autonomous external mutations.
- ADR-002: Evidence Chain of Custody β Streaming SHA-256 and WORM retention architecture.
- ADR-003: Read-Only Provider Integrations β Scoping platform APIs strictly to read-only access.
- ADR-004: Emergency Integration Kill Switch β Sub-second isolation of external integration traffic.
- ADR-005: Multi-Tenant Scoping & BOLA Defense β Database-level parameterized query isolation.
- ADR-006: Graph-Based Workflow Orchestration β Directed Acyclic Graphs for release assurance.
- ADR-007: Controlled Pilot Release Model β Strict withholding of GA pending real-world external evidence.
graph TD
A["Current State: v1.0.0-controlled-pilot-rc2 (Controlled Pilot Active)"] --> B1["EXT-001: Transmit Scope to Accredited Pen-Testing Firm"]
A --> B2["CLOUD-001: Authorize AWS Credentials & Apply Terraform in ap-south-1"]
A --> B3["LEG-001: Submit Briefing Package to Indian Cyber Law Counsel"]
B2 --> C1["Deploy ECS Canary in ap-south-1"]
C1 --> B4["SOAK-001: Execute 72h Continuous Staged Canary (5% -> 25%)"]
B1 --> D{"All 4 External Evidences Delivered?"}
B3 --> D
B4 --> D
D -->|Yes| E["Reconvene GA Gatekeeper Committee"]
E --> F["GENERAL AVAILABILITY PROMOTION"]
- Synthetic Data Only: The local and staging environments use synthetic fixtures under RFC 2606 reserved
.exampledomains. No live customer or real-world victim data is processed. - Read-Only API Limitation: External platform integrations do not submit takedown complaints directly via private APIs. Notices are compiled into structured dossiers for human delivery.
- Hardware WORM Storage Pending: Production WORM guarantees require live AWS S3 Object Lock provisioning (
CLOUD-001). Local staging storage simulates WORM behavior in software. - General Availability Withheld: The application must not be deployed for unconstrained public usage until
EXT-001,CLOUD-001,SOAK-001, andLEG-001deliver signed external reports.
This project is licensed under the ISC License β see the LICENSE file for details.
Developed with a commitment to defensive software engineering, cryptographic chain of custody, and ethical AI safety.