tractatus/src/utils
TheFlow d854ac85e2 feat(research): add cross-environment audit log sync infrastructure
Implements privacy-preserving synchronization of production audit logs
to development for comprehensive governance research analysis.

Backend Components:
- SyncMetadata.model.js: Track sync state and statistics
- audit-sanitizer.util.js: Privacy sanitization utility
  - Redacts credentials, API keys, user identities
  - Sanitizes file paths and violation content
  - Preserves statistical patterns for research
- sync-prod-audit-logs.js: CLI sync script
  - Incremental sync with deduplication
  - Dry-run mode for testing
  - Configurable date range
- AuditLog.model.js: Enhanced schema with environment tracking
  - environment field (development/production/staging)
  - sync_metadata tracking (original_id, synced_from, etc.)
  - New indexes for cross-environment queries
- audit.controller.js: New /api/admin/audit-export endpoint
  - Privacy-sanitized export for cross-environment sync
  - Environment filter support in getAuditLogs
- MemoryProxy.service.js: Environment tagging in auditDecision()
  - Tags new logs with NODE_ENV or override
  - Sets is_local flag for tracking

Frontend Components:
- audit-analytics.html: Environment filter dropdown
- audit-analytics.js: Environment filter query parameter handling

Research Benefits:
- Combine dev and prod governance statistics
- Longitudinal analysis across environments
- Validate framework consistency
- Privacy-preserving data sharing

Security:
- API-based export (not direct DB access)
- Admin-only endpoints with JWT authentication
- Comprehensive credential redaction
- One-way sync (production → development)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 12:11:16 +13:00
..
activity-classifier.util.js feat(bi): add business intelligence backend infrastructure 2025-10-27 10:07:33 +13:00
audit-sanitizer.util.js feat(research): add cross-environment audit log sync infrastructure 2025-10-27 12:11:16 +13:00
db.util.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
document-section-parser.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
jwt.util.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
logger.util.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
markdown.util.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
mongoose.util.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
sections.util.js fix(i18n): workaround for mangled markdown in translations 2025-10-26 01:48:28 +13:00
security-logger.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00