Skip to content

Polymorphic Audit Logging & Forensic Traceability Engine #731

@SatyamPandey-07

Description

@SatyamPandey-07

Objective: Implement a global "Forensic Journal." Instead of simple logs, every mutation (Create/Update/Delete) across the entire system must be captured as a polymorphic audit record with oldValue vs newValue diffing, enabling a "Time Travel" feature for any entity.

Files involved (12):

models/AuditLog.js
(New: High-volume polymorphic storage)
services/auditProcessor.js (New: Background worker to process diffs)
utils/diffEngine.js (New: Logic to compare JSON objects)
middleware/auditInterceptor.js (New: Global request/response context capture)
plugins/mongooseAuditV2.js (New: Mongoose plugin for auto-auditing)

routes/audit.js
(New: Forensic explorer API)

models/Transaction.js
(Update: Registering audit plugin)

models/Taxonomy.js
(Update: Registering audit plugin)

models/Workspace.js
(Update: Registering audit plugin)

services/securityService.js
(Update: Logic for "Suspicious Pattern" detection in logs)
tests/auditTraceability.test.js (New: "Time Travel" verification tests)
AUDIT_FORENSICS_SPEC.md (Technical spec)

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions