SecurityMetricsService
Component Detail
Description
Backend service that aggregates and serves security metrics for the dashboard, drawing from audit-log and session-management dependencies. It computes tenant-scoped summaries of active sessions, authentication events, failed login counts, and module access patterns, and enforces cross-organization visibility rules tied to support access grants. Results are cached with short TTLs to support near-real-time dashboard polling.
security-metrics-service
Sources & reasoning
admin-security is explicitly listed as always-on for the Admin Web Portal (line 241), establishing MVP scope. The Security Dashboard is the primary visibility surface for that area. The strict multi-tenant isolation requirement (line 259) and the sensitive data categories processed by all four organizations justify a dedicated security metrics page from launch, not a later phase.
-
docs/source/likeperson.md · line 239-241Always-on core. A small set of modules is non-toggleable because the operational products are meaningless without them... Admin Web Portal: `admin-dashboard`, `admin-user-management`, `admin-organization`, `admin-security`.
-
docs/source/likeperson.md · line 259No default access to an organization's operational data (users, activities, contacts). Tenant separation is strict: each org's data is isolated.
Responsibilities
- Aggregate active session counts and recent authentication events per tenant from session-management
- Compute failed login attempt rates and flag threshold breaches from audit-log data
- Summarize module access patterns for anomaly detection
- Enforce tenant scoping and validate support access grant status before exposing cross-org data to global admins
- Cache metric snapshots with short TTLs and invalidate on relevant audit or session events
Interfaces
getSecurityMetrics(tenantId: string, requestingAdminId: string): SecurityMetricsSnapshot
getFailedLoginSummary(tenantId: string, windowMinutes: number): FailedLoginSummary
getActiveSessionCount(tenantId: string): number
getModuleAccessPatterns(tenantId: string, since: Date): ModuleAccessPattern[]
getCrossOrgSummary(adminId: string): CrossOrgSecuritySummary
Related Data Entities (9)
Data entities managed by this component