Skip to main content

import DocInfo from '@site/src/components/DocInfo';

Functional Specification: Live Admin Support (LogRocket Integration)

Status: Ready to Enable (Scaffolded) Date: November 17, 2025 Feature Owner: Support / Admin Priority: Medium Implementation Status: Complete (Scaffold Mode - Awaiting Activation)


1. ๐ŸŽฏ Executive Summaryโ€‹

This document specifies the integration of LogRocket, a third-party session replay and co-browsing platform, to enable ChainAlign support staff to provide live, "over-the-shoulder" customer support in a secure and compliant manner.

Key Decision: This is a "Buy, Not Build" solution. Building an internal session replay or impersonation system would:

  • Require 6+ months of development effort
  • Introduce significant compliance risk (SOC2/GDPR violations)
  • Create audit trail gaps that would fail security reviews

LogRocket provides:

  • โœ… SOC2/GDPR compliant out-of-the-box
  • โœ… Built-in PII redaction and data security
  • โœ… Full audit trails of admin access
  • โœ… Session replay and live co-browsing
  • โœ… No impersonation (admins always authenticated as themselves)

Implementation Approach: The system has been implemented using a "scaffold now, enable later" pattern. All code is in place but commented out (TODO blocks) until:

  1. LogRocket subscription is activated
  2. Data Processing Agreement (DPA) is signed
  3. PII redaction is configured in LogRocket dashboard
  4. Consent management is implemented

This allows us to enable the feature with zero code changes - just uncomment TODO blocks and set environment variables.


2. ๐Ÿ“ˆ Goals & Objectivesโ€‹

Primary Goalโ€‹

Reduce customer support resolution time by 50% by allowing support staff to view user sessions (replay or live) without building risky impersonation features.

Objectivesโ€‹

Objective 1: Secure SDK Integration Integrate the LogRocket SDK into the ChainAlign frontend with proper initialization, user identification, and PII redaction.

Objective 2: Admin Support Tooling Provide admins with a UI and API to request live co-browse sessions and view session recordings.

Objective 3: Compliance-First Design Ensure 100% of PII and sensitive customer data is redacted before transmission to LogRocket, maintaining SOC2/GDPR compliance.

Objective 4: Audit Trail Log all admin support actions (session access, co-browsing requests) with admin identity, timestamp, and reason.

Non-Goalsโ€‹

  • โŒ Building an internal session replay system
  • โŒ User impersonation features (high compliance risk)
  • โŒ Recording sessions without user awareness
  • โŒ Storing session data in ChainAlign infrastructure (LogRocket handles this)

3. ๐Ÿ›๏ธ Architectural Overviewโ€‹

System Architectureโ€‹

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ChainAlign Frontend โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ AuthContext (User Authentication) โ”‚ โ”‚
โ”‚ โ”‚ โ””โ”€> initLogRocket() - SDK initialization โ”‚ โ”‚
โ”‚ โ”‚ โ””โ”€> identifyUser() - Link session to user โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ (Sends session data) โ”‚
โ”‚ โ–ผ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ LogRocket SDK (logrocket npm package) โ”‚ โ”‚
โ”‚ โ”‚ - Captures user interactions โ”‚ โ”‚
โ”‚ โ”‚ - Redacts PII (inputs, network, DOM) โ”‚ โ”‚
โ”‚ โ”‚ - Streams to LogRocket cloud โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”‚ (HTTPS, encrypted)
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ LogRocket Cloud โ”‚
โ”‚ - Stores session recordings (encrypted at rest) โ”‚
โ”‚ - Applies PII redaction rules โ”‚
โ”‚ - Provides admin dashboard for viewing sessions โ”‚
โ”‚ - Maintains audit trail of admin access โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”‚ (Admin accesses via web dashboard)
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ChainAlign Admin Support Panel โ”‚
โ”‚ (Optional - admins can use LogRocket dashboard directly) โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ AdminSupportPanel.jsx โ”‚ โ”‚
โ”‚ โ”‚ - Request live co-browse URL โ”‚ โ”‚
โ”‚ โ”‚ - View recent session recordings โ”‚ โ”‚
โ”‚ โ”‚ - Log audit trail of access โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ–ผ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ Backend API: /api/support/* โ”‚ โ”‚
โ”‚ โ”‚ POST /request-live-session โ”‚ โ”‚
โ”‚ โ”‚ GET /sessions/:userId โ”‚ โ”‚
โ”‚ โ”‚ POST /track-access โ”‚ โ”‚
โ”‚ โ”‚ GET /status โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ–ผ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ SupportSessionService.js โ”‚ โ”‚
โ”‚ โ”‚ - Wraps LogRocket API calls โ”‚ โ”‚
โ”‚ โ”‚ - Logs audit trail โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Componentsโ€‹

Frontendโ€‹

  • logRocketInit.js - SDK initialization and configuration
  • piiRedaction.js - PII redaction utilities and helpers
  • AuthContext.jsx - Integrates LogRocket user identification
  • AdminSupportPanel.jsx - Admin UI for support operations

Backendโ€‹

  • SupportSessionService.js - LogRocket API wrapper service
  • support.js - Express routes for admin support actions
  • server.js - Route registration at /api/support

Data Flowโ€‹

  1. Session Recording

    User Action โ†’ LogRocket SDK โ†’ PII Redaction โ†’ LogRocket Cloud
  2. Admin Access (Dashboard)

    Admin โ†’ LogRocket Dashboard โ†’ Search User โ†’ View Session โ†’ Audit Log
  3. Admin Access (ChainAlign Panel)

    Admin โ†’ AdminSupportPanel โ†’ POST /api/support/request-live-session
    โ†’ SupportSessionService โ†’ LogRocket API โ†’ Session URL
    โ†’ Admin Opens URL โ†’ Joins Live Session โ†’ Audit Log

4. ๐Ÿ“‹ Functional Requirementsโ€‹

FR1: SDK Installation & Initializationโ€‹

FR1.1: The logrocket npm package must be installed in the frontend workspace.

FR1.2: LogRocket.init() must be called once when the app loads, before any user authentication.

FR1.3: Initialization must be conditional:

  • Only run if VITE_LOGROCKET_APP_ID is set in environment variables
  • Gracefully degrade if not configured (console log, no errors)

FR1.4: Initialization must configure:

  • Network request/response sanitization (redact Authorization headers, API keys)
  • Console log sanitization (hide debug logs in production)
  • DOM input sanitization (mask all input fields by default)

Acceptance Criteria:

  • LogRocket SDK loads without blocking page render
  • Console shows "[LogRocket] Initialized successfully" when enabled
  • Console shows "[LogRocket] Not enabled" when VITE_LOGROCKET_APP_ID is missing
  • No JavaScript errors if LogRocket is disabled

Implementation Status: โœ… Complete (in scaffold mode)


FR2: User Identificationโ€‹

FR2.1: When a user authenticates (via Firebase), LogRocket.identify() must be called with:

  • user.uid (Firebase UID) as the primary identifier
  • user.email
  • user.displayName
  • user.tenantId (for tenant-level filtering)
  • user.roles (for filtering admin vs. user sessions)

FR2.2: Identification must occur in the AuthContext after the user profile is fetched from the backend.

FR2.3: If user authentication fails, LogRocket should not be identified (anonymous session).

Acceptance Criteria:

  • LogRocket dashboard shows user email in session list
  • Admins can search for sessions by user email
  • Tenant ID is visible in session metadata
  • User role (admin/user) is visible in session metadata

Implementation Status: โœ… Complete (in scaffold mode)


FR3: PII & Data Redaction (CRITICAL COMPLIANCE REQUIREMENT)โ€‹

FR3.1 (Dashboard Configuration): In the LogRocket dashboard, the following must be enabled:

  • Input Redaction - Hide all form input values
  • Network Redaction - Hide request/response bodies containing PII

FR3.2 (Code-Level Redaction): All sensitive UI components must be tagged with data-lr-hide="true":

  • Socratic Inquiry Engine panels
  • Reasoning chains (Chain-of-Thought)
  • Financial forecasts and projections
  • User profile pages
  • Settings pages with API keys
  • Any component displaying proprietary algorithms

FR3.3 (Network Sanitization): The LogRocket SDK must be configured to redact:

  • Authorization headers
  • X-API-Key headers
  • URL query parameters: api-key, token, secret
  • Response fields: ssn, creditCard, password, apiKey

FR3.4 (ChainAlign-Specific Sanitization): Custom redaction for ChainAlign domain fields:

  • socratic_reasoning
  • reasoning_chain
  • revenue_forecast
  • cost_projection
  • supplier_pricing
  • demand_forecast

Acceptance Criteria:

  • Form inputs show as *** in LogRocket session replay
  • API responses do not show sensitive fields in network tab
  • Socratic Inquiry panels are completely hidden (black box)
  • Financial numbers are redacted in session replay
  • Console logs do not show PII

Implementation Status: โœ… Complete (utilities and configuration provided)


FR4: Admin Support APIโ€‹

FR4.1: Request Live Co-Browse Session

Endpoint: POST /api/support/request-live-session

Request Body:

{
"userId": "user-uuid",
"reason": "User reported issue with constraint validation"
}

Response:

{
"url": "https://app.logrocket.com/...",
"userId": "user-uuid",
"adminId": "admin-uuid",
"requestedAt": "2025-11-17T10:00:00Z"
}

Authorization: Requires admin role (verified by requireAdmin middleware)

Audit: Logs admin ID, user ID, reason, and timestamp to audit trail

Acceptance Criteria:

  • Endpoint returns valid LogRocket session URL
  • Returns 403 if non-admin attempts to access
  • Returns 503 if LogRocket is not enabled
  • Audit log entry is created in database

FR4.2: Retrieve User Sessions

Endpoint: GET /api/support/sessions/:userId?limit=10

Response:

{
"sessions": [
{
"id": "session-id",
"userId": "user-uuid",
"createdAt": "2025-11-17T09:00:00Z",
"duration": 1800,
"url": "https://app.logrocket.com/..."
}
],
"total": 25
}

Acceptance Criteria:

  • Returns up to 50 most recent sessions
  • Sessions are sorted by creation date (newest first)
  • Returns empty array if user has no sessions
  • Returns 503 if LogRocket is not enabled

FR4.3: Track Admin Access (Audit Trail)

Endpoint: POST /api/support/track-access

Request Body:

{
"sessionId": "logrocket-session-id",
"userId": "user-uuid",
"action": "viewed",
"reason": "Investigating issue #123"
}

Purpose: Creates a compliance audit trail when an admin accesses a user session.

Acceptance Criteria:

  • Audit log entry is created in database
  • Log includes admin ID, user ID, session ID, action, reason, and timestamp
  • Returns audit log ID in response

FR4.4: Check Support Status

Endpoint: GET /api/support/status

Response:

{
"enabled": true,
"appId": "abc123/chainalign",
"features": {
"sessionReplay": true,
"liveCoBrowse": true
}
}

Purpose: Allows UI to conditionally show/hide support features based on configuration.

Acceptance Criteria:

  • Returns enabled: false if LogRocket is not configured
  • Does not require admin authorization (any authenticated user can check)

Implementation Status: โœ… Complete (all endpoints implemented)


FR5: Admin Support UI Panelโ€‹

FR5.1: A React component (AdminSupportPanel.jsx) must be created for admins to:

  • Request live co-browse URLs for specific users
  • View recent session recordings for a user
  • See compliance notices and warnings

FR5.2: The panel must be feature-flagged:

  • Only visible when VITE_ENABLE_LIVE_SUPPORT=true
  • Shows a "Feature Not Enabled" message when disabled

FR5.3: The panel must display:

  • User ID input field (UUID)
  • Reason input field (for audit log)
  • "Request Live Session" button
  • "View Recent Sessions" button
  • Generated session URL (with copy button)
  • Compliance warning about user consent

Acceptance Criteria:

  • Panel is only accessible by admins
  • Shows disabled state when LogRocket is not enabled
  • Displays generated session URL in copyable format
  • Shows error messages for failed requests
  • Displays list of recent sessions with links

Implementation Status: โœ… Complete


5. ๐Ÿ”’ Non-Functional Requirements (NFRs)โ€‹

NFR-1: Performanceโ€‹

Requirement: The LogRocket SDK must not negatively impact page load time or Time To Interactive (TTI).

Acceptance Criteria:

  • LogRocket SDK loads asynchronously (non-blocking)
  • TTI degradation < 100ms
  • Lighthouse performance score remains โ‰ฅ 90

Implementation: LogRocket SDK is initialized in a separate useEffect hook with no dependencies, ensuring it doesn't block render.


NFR-2: GDPR Complianceโ€‹

Requirement: The LogRocket integration must comply with GDPR Article 28 (Processor Requirements) and Article 25 (Data Protection by Design).

Acceptance Criteria:

  • LogRocket added to public sub-processors list in Privacy Policy
  • Data Processing Agreement (DPA) signed with LogRocket
  • User consent obtained before initializing LogRocket SDK
  • PII redaction enabled at multiple layers (SDK, dashboard, code)
  • Users can request deletion of their session data (via LogRocket GDPR tools)

Implementation:

  • DPA signing is a prerequisite for enabling LogRocket (documented in setup guide)
  • PII redaction utilities provided (piiRedaction.js)
  • Future: Integrate with Consent Management System (Phase 2)

NFR-3: SOC2 Complianceโ€‹

Requirement: The support system must satisfy SOC2 Trust Service Criteria for security, availability, and confidentiality.

Acceptance Criteria:

  • CC6.1 (Audit Trail): All admin support actions are logged with identity, timestamp, and reason
  • CC6.6 (Data Confidentiality): PII is redacted before transmission to LogRocket
  • CC6.7 (Access Controls): Only admins with proper roles can access support features
  • CC7.2 (System Monitoring): Failed support requests are logged and alerted

Implementation:

  • requireAdmin middleware enforces role-based access control
  • SupportSessionService logs all actions to backend logger
  • PII redaction enforced at SDK configuration level

NFR-4: Availability & Resilienceโ€‹

Requirement: If LogRocket is unavailable, the ChainAlign application must continue to function normally.

Acceptance Criteria:

  • LogRocket SDK failures do not crash the app
  • Admin panel shows "Service Unavailable" error instead of crashing
  • Users can still use ChainAlign even if LogRocket is down

Implementation:

  • All LogRocket calls are wrapped in try/catch blocks
  • isEnabled() checks prevent API calls when LogRocket is not configured
  • Frontend gracefully degrades to disabled state

6. ๐Ÿ—„๏ธ Schema & APIโ€‹

Database Schemaโ€‹

No new database tables required. All session data is stored in LogRocket's cloud infrastructure.

Audit Trail: Admin support actions will be logged to the existing audit_logs table (if implemented) with the following structure:

-- Existing audit_logs table (no changes needed)
CREATE TABLE audit_logs (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
action VARCHAR(255) NOT NULL,
actor_id UUID NOT NULL,
actor_type VARCHAR(50) NOT NULL,
target_id UUID,
target_type VARCHAR(50),
metadata JSONB,
created_at TIMESTAMP DEFAULT NOW()
);

Example audit log entry:

{
"action": "ADMIN_SUPPORT_SESSION_REQUESTED",
"actor_id": "admin-uuid",
"actor_type": "admin",
"target_id": "user-uuid",
"target_type": "user",
"metadata": {
"reason": "User reported issue with constraint validation",
"sessionUrl": "https://app.logrocket.com/..."
}
}

Environment Variablesโ€‹

Backend (backend/.env)โ€‹

# LogRocket Support System
LOGROCKET_APP_ID=abc123/chainalign
LOGROCKET_API_KEY=lr_api_xxxxxxxxx

Frontend (frontend/.env)โ€‹

# LogRocket Support System
VITE_LOGROCKET_APP_ID=abc123/chainalign
VITE_ENABLE_LIVE_SUPPORT=true

7. ๐Ÿš€ Implementation Planโ€‹

Phase 1: Scaffolding (โœ… Complete)โ€‹

Goal: Implement all code with TODO blocks, ready to enable with zero code changes.

Tasks:

  • Install LogRocket npm package (commented in package.json)
  • Create logRocketInit.js with SDK initialization
  • Create piiRedaction.js with redaction utilities
  • Integrate initLogRocket() and identifyUser() in AuthContext
  • Create SupportSessionService.js backend service
  • Create /api/support routes
  • Create AdminSupportPanel.jsx UI component
  • Add environment variable placeholders to .env.example
  • Write setup documentation

Deliverables:

  • All code in place, commented with TODO blocks
  • Setup guide in docs/support-system-setup.md
  • FSD in docs/website/docs/architecture/functional-specifications/

Phase 2: Activation (Future - When LogRocket Subscription is Active)โ€‹

Goal: Enable LogRocket with minimal effort.

Prerequisites:

  • LogRocket account created
  • LogRocket DPA signed
  • PII redaction configured in LogRocket dashboard
  • Environment variables set

Tasks:

  1. Install LogRocket: npm install logrocket --workspace=frontend
  2. Uncomment all TODO blocks in:
    • frontend/src/lib/logRocketInit.js
    • backend/src/services/SupportSessionService.js (optional)
  3. Set environment variables in production .env
  4. Restart frontend and backend
  5. Test session recording with a test user
  6. Verify PII redaction in LogRocket dashboard
  7. Train support team on using LogRocket dashboard

Estimated Effort: 2 hours


Phase 3: Compliance Integration (Future)โ€‹

Goal: Integrate with Consent Management System for GDPR compliance.

Tasks:

  • Implement ConsentService.checkConsent('analytics') check before initLogRocket()
  • Update Privacy Policy to list LogRocket as a sub-processor
  • Add cookie banner notice for session recording
  • Implement user opt-out mechanism

Estimated Effort: 1 week


Phase 4: Advanced Features (Future)โ€‹

Goal: Enhance support workflow with automation.

Tasks:

  • Auto-attach session URL to support tickets when user reports bug
  • Deep-link from support ticket to LogRocket session
  • Slack integration: notify support team when user reports issue
  • Dashboard widget: show "Active Support Sessions" count

Estimated Effort: 2 weeks


8. ๐Ÿงช Testing & Validationโ€‹

Test Planโ€‹

Unit Testsโ€‹

  • logRocketInit.js: Test SDK initialization with/without app ID
  • piiRedaction.js: Test redaction functions (emails, phones, credit cards)
  • SupportSessionService.js: Test API wrapper methods
  • AdminSupportPanel.jsx: Test form submission and error handling

Integration Testsโ€‹

  • Test LogRocket SDK initialization on app load
  • Test user identification after authentication
  • Test admin panel API calls
  • Test PII redaction in session replay

Manual QA Checklistโ€‹

  • Create test user account
  • Log in and interact with app (create constraints, run simulations)
  • Log in to LogRocket dashboard
  • Search for test user by email
  • Verify session appears in LogRocket
  • Open session replay and verify:
    • User interactions are recorded
    • Form inputs are masked (***)
    • Network requests do not show PII
    • Socratic Inquiry panels are hidden
  • Test admin panel:
    • Request live session URL
    • View recent sessions
    • Copy session URL to clipboard
  • Verify audit logs in database

9. ๐Ÿ” Security & Compliance Checklistโ€‹

Securityโ€‹

  • LogRocket SDK loaded over HTTPS
  • API keys stored in environment variables (not in code)
  • Admin endpoints protected by requireAdmin middleware
  • Session URLs expire after 24 hours (LogRocket default)
  • No PII in console logs (use safeLog() utility)

GDPRโ€‹

  • DPA signed with LogRocket
  • LogRocket listed in Privacy Policy sub-processors section
  • User consent obtained before initializing SDK
  • Users can request deletion of session data
  • PII redaction enabled in LogRocket dashboard

SOC2โ€‹

  • All admin actions logged to audit trail
  • Access controls enforced (admin-only)
  • PII redacted before transmission
  • Failed requests logged for monitoring
  • Incident response plan includes LogRocket access revocation

10. ๐Ÿ“Š Success Metricsโ€‹

Support Efficiencyโ€‹

  • Metric: Average time to resolve support ticket
  • Target: Reduce from 24 hours to 12 hours (50% improvement)
  • Measurement: Track in support ticket system

Session Coverageโ€‹

  • Metric: Percentage of support tickets with attached session replay
  • Target: 80% of tickets have session URL attached
  • Measurement: Support ticket metadata

Complianceโ€‹

  • Metric: Number of PII exposure incidents
  • Target: Zero incidents
  • Measurement: Security audit logs

User Satisfactionโ€‹

  • Metric: CSAT score for support interactions
  • Target: Increase from 4.2 to 4.5 (out of 5)
  • Measurement: Post-support survey

11. ๐Ÿšจ Risks & Mitigationsโ€‹

Risk 1: PII Exposureโ€‹

Risk: Session recordings accidentally capture unredacted PII, violating GDPR.

Likelihood: Medium Impact: High (legal liability, user trust loss)

Mitigation:

  • Enable PII redaction in LogRocket dashboard before activation (blocker)
  • Use data-lr-hide on all sensitive components
  • Conduct manual audit of first 10 session recordings
  • Set up automated alerts for PII detection (LogRocket enterprise feature)

Risk 2: LogRocket Service Outageโ€‹

Risk: LogRocket cloud is unavailable, preventing support operations.

Likelihood: Low Impact: Medium (support efficiency degraded)

Mitigation:

  • Graceful degradation: App continues to work if LogRocket is down
  • Fallback: Admins can ask users to screen-share via Zoom
  • SLA: LogRocket enterprise plan guarantees 99.9% uptime

Risk 3: Unauthorized Admin Accessโ€‹

Risk: Admin abuses access to view user sessions without justification.

Likelihood: Low Impact: High (privacy violation, compliance breach)

Mitigation:

  • Require reason field for all support requests (logged to audit trail)
  • Periodic audit of admin access logs
  • Role-based access control: Only "Support Admin" role can access
  • Automated alerts for excessive session access (>10 per day)

Risk 4: Vendor Lock-Inโ€‹

Risk: Switching from LogRocket to another tool is difficult.

Likelihood: Low Impact: Medium (migration effort, cost)

Mitigation:

  • All LogRocket calls abstracted behind SupportSessionService.js
  • Environment variable configuration allows easy toggling
  • Alternative tools (FullStory, Hotjar) have similar APIs

12. ๐Ÿ“š Referencesโ€‹

External Documentationโ€‹

Internal Documentationโ€‹

  • Setup Guide: docs/support-system-setup.md
  • PII Redaction Utilities: frontend/src/lib/piiRedaction.js
  • Admin Support API: backend/src/routes/support.js
  • FSD: Compliance by Design
  • FSD: AI Compliance and Trust Layer
  • FSD: Secrets Management (Infisical)

13. ๐ŸŽ“ Appendix: Why Not Build This Ourselves?โ€‹

Effort Estimate for Internal Session Replayโ€‹

If we were to build this feature internally, we would need:

  1. Session Recording Infrastructure

    • WebSocket server for real-time streaming
    • S3 storage for session recordings
    • Video encoding/compression
    • DOM snapshot diffing algorithm
    • Effort: 6 weeks
  2. PII Redaction Engine

    • Input field masking
    • Network request sanitization
    • DOM text redaction
    • Regex-based PII detection
    • Effort: 4 weeks
  3. Admin Dashboard

    • Session search and filtering
    • Video player UI
    • Live co-browsing (WebRTC)
    • Session sharing and permissions
    • Effort: 8 weeks
  4. Compliance & Audit

    • SOC2 audit preparation
    • GDPR data retention policies
    • Incident response procedures
    • Effort: 4 weeks

Total Estimated Effort: 22 weeks (5.5 months)

Total Estimated Cost:

  • Developer time: 5.5 months ร— $15,000/month = $82,500
  • Infrastructure: $500/month ร— 6 months = $3,000
  • Total: $85,500

LogRocket Cost:

  • Team Plan: $249/month = $2,988/year
  • Savings: $82,512 in year 1

Conclusion: Buy LogRocket. It's a no-brainer.


14. โœ… Approval & Sign-Offโ€‹

RoleNameStatusDate
Engineering LeadTBDโœ… Approved2025-11-17
Security OfficerTBDโณ Pending-
Legal / ComplianceTBDโณ Pending-
Product OwnerTBDโณ Pending-

Next Steps:

  1. Security review of PII redaction implementation
  2. Legal review of LogRocket DPA
  3. Budget approval for LogRocket subscription
  4. Activation plan finalization

End of Functional Specification