@pan-sec/notebooklm-mcp 2026.3.2 → 2026.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth-manager.d.ts +0 -1
- package/dist/auth/auth-manager.js +0 -1
- package/dist/auth/mcp-auth.d.ts +0 -1
- package/dist/auth/mcp-auth.js +0 -1
- package/dist/compliance/alert-manager.d.ts +6 -2
- package/dist/compliance/alert-manager.js +40 -10
- package/dist/compliance/breach-detection.d.ts +0 -1
- package/dist/compliance/breach-detection.js +0 -1
- package/dist/compliance/change-log.d.ts +13 -1
- package/dist/compliance/change-log.js +82 -16
- package/dist/compliance/compliance-logger.d.ts +29 -3
- package/dist/compliance/compliance-logger.js +90 -27
- package/dist/compliance/compliance-tools.d.ts +0 -1
- package/dist/compliance/compliance-tools.js +0 -1
- package/dist/compliance/consent-manager.d.ts +0 -1
- package/dist/compliance/consent-manager.js +0 -1
- package/dist/compliance/dashboard.d.ts +4 -3
- package/dist/compliance/dashboard.js +11 -8
- package/dist/compliance/data-classification.d.ts +0 -1
- package/dist/compliance/data-classification.js +0 -1
- package/dist/compliance/data-erasure.d.ts +0 -1
- package/dist/compliance/data-erasure.js +0 -1
- package/dist/compliance/data-export.d.ts +0 -1
- package/dist/compliance/data-export.js +0 -1
- package/dist/compliance/data-inventory.d.ts +0 -1
- package/dist/compliance/data-inventory.js +0 -1
- package/dist/compliance/dsar-handler.d.ts +0 -1
- package/dist/compliance/dsar-handler.js +0 -1
- package/dist/compliance/evidence-collector.d.ts +0 -1
- package/dist/compliance/evidence-collector.js +4 -2
- package/dist/compliance/health-monitor.d.ts +0 -1
- package/dist/compliance/health-monitor.js +0 -1
- package/dist/compliance/incident-manager.d.ts +0 -1
- package/dist/compliance/incident-manager.js +0 -1
- package/dist/compliance/index.d.ts +0 -1
- package/dist/compliance/index.js +0 -1
- package/dist/compliance/policy-docs.d.ts +0 -1
- package/dist/compliance/policy-docs.js +0 -1
- package/dist/compliance/privacy-notice-text.d.ts +0 -1
- package/dist/compliance/privacy-notice-text.js +0 -1
- package/dist/compliance/privacy-notice.d.ts +0 -1
- package/dist/compliance/privacy-notice.js +0 -1
- package/dist/compliance/report-generator.d.ts +7 -1
- package/dist/compliance/report-generator.js +116 -34
- package/dist/compliance/retention-engine.d.ts +0 -1
- package/dist/compliance/retention-engine.js +0 -1
- package/dist/compliance/siem-exporter.d.ts +26 -2
- package/dist/compliance/siem-exporter.js +89 -24
- package/dist/compliance/types.d.ts +0 -1
- package/dist/compliance/types.js +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +2 -3
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/events/event-emitter.d.ts +9 -1
- package/dist/events/event-emitter.js +47 -8
- package/dist/events/event-types.d.ts +0 -1
- package/dist/events/event-types.js +8 -2
- package/dist/gemini/gemini-client.d.ts +0 -1
- package/dist/gemini/gemini-client.js +237 -45
- package/dist/gemini/index.d.ts +0 -1
- package/dist/gemini/index.js +0 -1
- package/dist/gemini/pdf-chunker.d.ts +0 -1
- package/dist/gemini/pdf-chunker.js +60 -35
- package/dist/gemini/types.d.ts +0 -1
- package/dist/gemini/types.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +74 -10
- package/dist/library/notebook-library.d.ts +30 -2
- package/dist/library/notebook-library.js +345 -85
- package/dist/library/types.d.ts +0 -1
- package/dist/library/types.js +0 -1
- package/dist/logging/index.d.ts +0 -1
- package/dist/logging/index.js +0 -1
- package/dist/logging/query-logger.d.ts +20 -1
- package/dist/logging/query-logger.js +104 -21
- package/dist/notebook-creation/audio-manager.d.ts +0 -1
- package/dist/notebook-creation/audio-manager.js +111 -20
- package/dist/notebook-creation/browser-options.d.ts +0 -1
- package/dist/notebook-creation/browser-options.js +0 -1
- package/dist/notebook-creation/data-table-manager.d.ts +7 -1
- package/dist/notebook-creation/data-table-manager.js +59 -3
- package/dist/notebook-creation/dom-scripts.d.ts +0 -1
- package/dist/notebook-creation/dom-scripts.js +0 -1
- package/dist/notebook-creation/errors.d.ts +0 -1
- package/dist/notebook-creation/errors.js +0 -1
- package/dist/notebook-creation/index.d.ts +0 -1
- package/dist/notebook-creation/index.js +0 -1
- package/dist/notebook-creation/notebook-creator.d.ts +9 -1
- package/dist/notebook-creation/notebook-creator.js +50 -1
- package/dist/notebook-creation/notebook-nav.d.ts +0 -1
- package/dist/notebook-creation/notebook-nav.js +21 -6
- package/dist/notebook-creation/notebook-sync.d.ts +14 -2
- package/dist/notebook-creation/notebook-sync.js +124 -35
- package/dist/notebook-creation/selectors.d.ts +0 -1
- package/dist/notebook-creation/selectors.js +6 -4
- package/dist/notebook-creation/source-manager.d.ts +29 -2
- package/dist/notebook-creation/source-manager.js +0 -0
- package/dist/notebook-creation/types.d.ts +0 -1
- package/dist/notebook-creation/types.js +0 -1
- package/dist/notebook-creation/video-manager.d.ts +0 -1
- package/dist/notebook-creation/video-manager.js +91 -15
- package/dist/observability/metrics.d.ts +0 -1
- package/dist/observability/metrics.js +0 -1
- package/dist/quota/index.d.ts +0 -1
- package/dist/quota/index.js +0 -1
- package/dist/quota/quota-manager.d.ts +59 -4
- package/dist/quota/quota-manager.js +195 -46
- package/dist/resources/resource-handlers.d.ts +0 -1
- package/dist/resources/resource-handlers.js +33 -3
- package/dist/session/browser-session.d.ts +0 -1
- package/dist/session/browser-session.js +0 -1
- package/dist/session/session-manager.d.ts +0 -1
- package/dist/session/session-manager.js +0 -1
- package/dist/session/session-timeout.d.ts +0 -1
- package/dist/session/session-timeout.js +0 -1
- package/dist/session/shared-context-manager.d.ts +0 -1
- package/dist/session/shared-context-manager.js +0 -1
- package/dist/tools/annotations.d.ts +0 -1
- package/dist/tools/annotations.js +0 -1
- package/dist/tools/definitions/ask-question.d.ts +6 -3
- package/dist/tools/definitions/ask-question.js +12 -8
- package/dist/tools/definitions/chat-history.d.ts +0 -1
- package/dist/tools/definitions/chat-history.js +1 -1
- package/dist/tools/definitions/data-tables.d.ts +0 -1
- package/dist/tools/definitions/data-tables.js +4 -1
- package/dist/tools/definitions/gemini.d.ts +0 -1
- package/dist/tools/definitions/gemini.js +14 -7
- package/dist/tools/definitions/notebook-management.d.ts +0 -1
- package/dist/tools/definitions/notebook-management.js +7 -2
- package/dist/tools/definitions/query-history.d.ts +0 -1
- package/dist/tools/definitions/query-history.js +0 -1
- package/dist/tools/definitions/session-management.d.ts +0 -1
- package/dist/tools/definitions/session-management.js +0 -1
- package/dist/tools/definitions/system.d.ts +0 -1
- package/dist/tools/definitions/system.js +32 -12
- package/dist/tools/definitions/video.d.ts +0 -1
- package/dist/tools/definitions/video.js +6 -3
- package/dist/tools/definitions.d.ts +0 -1
- package/dist/tools/definitions.js +0 -1
- package/dist/tools/handlers/ask-question.d.ts +0 -1
- package/dist/tools/handlers/ask-question.js +47 -18
- package/dist/tools/handlers/audio-video.d.ts +0 -1
- package/dist/tools/handlers/audio-video.js +0 -1
- package/dist/tools/handlers/auth.d.ts +0 -1
- package/dist/tools/handlers/auth.js +0 -1
- package/dist/tools/handlers/error-utils.d.ts +0 -1
- package/dist/tools/handlers/error-utils.js +0 -1
- package/dist/tools/handlers/gemini.d.ts +0 -1
- package/dist/tools/handlers/gemini.js +0 -1
- package/dist/tools/handlers/index.d.ts +0 -1
- package/dist/tools/handlers/index.js +0 -1
- package/dist/tools/handlers/notebook-creation.d.ts +0 -1
- package/dist/tools/handlers/notebook-creation.js +16 -1
- package/dist/tools/handlers/notebook-management.d.ts +0 -1
- package/dist/tools/handlers/notebook-management.js +7 -2
- package/dist/tools/handlers/session-management.d.ts +0 -1
- package/dist/tools/handlers/session-management.js +0 -1
- package/dist/tools/handlers/system.d.ts +0 -1
- package/dist/tools/handlers/system.js +0 -1
- package/dist/tools/handlers/types.d.ts +0 -1
- package/dist/tools/handlers/types.js +0 -1
- package/dist/tools/handlers/webhooks.d.ts +0 -1
- package/dist/tools/handlers/webhooks.js +0 -1
- package/dist/tools/icons.d.ts +0 -1
- package/dist/tools/icons.js +0 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/audit-logger.d.ts +11 -1
- package/dist/utils/audit-logger.js +189 -21
- package/dist/utils/cleanup-manager.d.ts +0 -1
- package/dist/utils/cleanup-manager.js +0 -1
- package/dist/utils/cli-handler.d.ts +0 -1
- package/dist/utils/cli-handler.js +0 -1
- package/dist/utils/crypto.d.ts +18 -9
- package/dist/utils/crypto.js +93 -28
- package/dist/utils/file-lock.d.ts +15 -1
- package/dist/utils/file-lock.js +67 -59
- package/dist/utils/file-permissions.d.ts +0 -1
- package/dist/utils/file-permissions.js +35 -7
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -1
- package/dist/utils/page-utils.d.ts +0 -1
- package/dist/utils/page-utils.js +32 -28
- package/dist/utils/response-validator.d.ts +0 -1
- package/dist/utils/response-validator.js +18 -15
- package/dist/utils/secrets-scanner.d.ts +0 -1
- package/dist/utils/secrets-scanner.js +32 -7
- package/dist/utils/secure-memory.d.ts +34 -16
- package/dist/utils/secure-memory.js +40 -25
- package/dist/utils/security.d.ts +0 -1
- package/dist/utils/security.js +66 -39
- package/dist/utils/settings-manager.d.ts +9 -1
- package/dist/utils/settings-manager.js +45 -2
- package/dist/utils/stealth-utils.d.ts +0 -1
- package/dist/utils/stealth-utils.js +11 -9
- package/dist/webhooks/index.d.ts +0 -1
- package/dist/webhooks/index.js +0 -1
- package/dist/webhooks/types.d.ts +0 -1
- package/dist/webhooks/types.js +0 -1
- package/dist/webhooks/webhook-dispatcher.d.ts +0 -1
- package/dist/webhooks/webhook-dispatcher.js +0 -1
- package/package.json +5 -4
- package/dist/auth/auth-manager.d.ts.map +0 -1
- package/dist/auth/auth-manager.js.map +0 -1
- package/dist/auth/mcp-auth.d.ts.map +0 -1
- package/dist/auth/mcp-auth.js.map +0 -1
- package/dist/compliance/alert-manager.d.ts.map +0 -1
- package/dist/compliance/alert-manager.js.map +0 -1
- package/dist/compliance/breach-detection.d.ts.map +0 -1
- package/dist/compliance/breach-detection.js.map +0 -1
- package/dist/compliance/change-log.d.ts.map +0 -1
- package/dist/compliance/change-log.js.map +0 -1
- package/dist/compliance/compliance-logger.d.ts.map +0 -1
- package/dist/compliance/compliance-logger.js.map +0 -1
- package/dist/compliance/compliance-tools.d.ts.map +0 -1
- package/dist/compliance/compliance-tools.js.map +0 -1
- package/dist/compliance/consent-manager.d.ts.map +0 -1
- package/dist/compliance/consent-manager.js.map +0 -1
- package/dist/compliance/dashboard.d.ts.map +0 -1
- package/dist/compliance/dashboard.js.map +0 -1
- package/dist/compliance/data-classification.d.ts.map +0 -1
- package/dist/compliance/data-classification.js.map +0 -1
- package/dist/compliance/data-erasure.d.ts.map +0 -1
- package/dist/compliance/data-erasure.js.map +0 -1
- package/dist/compliance/data-export.d.ts.map +0 -1
- package/dist/compliance/data-export.js.map +0 -1
- package/dist/compliance/data-inventory.d.ts.map +0 -1
- package/dist/compliance/data-inventory.js.map +0 -1
- package/dist/compliance/dsar-handler.d.ts.map +0 -1
- package/dist/compliance/dsar-handler.js.map +0 -1
- package/dist/compliance/evidence-collector.d.ts.map +0 -1
- package/dist/compliance/evidence-collector.js.map +0 -1
- package/dist/compliance/health-monitor.d.ts.map +0 -1
- package/dist/compliance/health-monitor.js.map +0 -1
- package/dist/compliance/incident-manager.d.ts.map +0 -1
- package/dist/compliance/incident-manager.js.map +0 -1
- package/dist/compliance/index.d.ts.map +0 -1
- package/dist/compliance/index.js.map +0 -1
- package/dist/compliance/policy-docs.d.ts.map +0 -1
- package/dist/compliance/policy-docs.js.map +0 -1
- package/dist/compliance/privacy-notice-text.d.ts.map +0 -1
- package/dist/compliance/privacy-notice-text.js.map +0 -1
- package/dist/compliance/privacy-notice.d.ts.map +0 -1
- package/dist/compliance/privacy-notice.js.map +0 -1
- package/dist/compliance/report-generator.d.ts.map +0 -1
- package/dist/compliance/report-generator.js.map +0 -1
- package/dist/compliance/retention-engine.d.ts.map +0 -1
- package/dist/compliance/retention-engine.js.map +0 -1
- package/dist/compliance/siem-exporter.d.ts.map +0 -1
- package/dist/compliance/siem-exporter.js.map +0 -1
- package/dist/compliance/types.d.ts.map +0 -1
- package/dist/compliance/types.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/events/event-emitter.d.ts.map +0 -1
- package/dist/events/event-emitter.js.map +0 -1
- package/dist/events/event-types.d.ts.map +0 -1
- package/dist/events/event-types.js.map +0 -1
- package/dist/gemini/gemini-client.d.ts.map +0 -1
- package/dist/gemini/gemini-client.js.map +0 -1
- package/dist/gemini/index.d.ts.map +0 -1
- package/dist/gemini/index.js.map +0 -1
- package/dist/gemini/pdf-chunker.d.ts.map +0 -1
- package/dist/gemini/pdf-chunker.js.map +0 -1
- package/dist/gemini/types.d.ts.map +0 -1
- package/dist/gemini/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/notebook-library.d.ts.map +0 -1
- package/dist/library/notebook-library.js.map +0 -1
- package/dist/library/types.d.ts.map +0 -1
- package/dist/library/types.js.map +0 -1
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/index.js.map +0 -1
- package/dist/logging/query-logger.d.ts.map +0 -1
- package/dist/logging/query-logger.js.map +0 -1
- package/dist/notebook-creation/audio-manager.d.ts.map +0 -1
- package/dist/notebook-creation/audio-manager.js.map +0 -1
- package/dist/notebook-creation/browser-options.d.ts.map +0 -1
- package/dist/notebook-creation/browser-options.js.map +0 -1
- package/dist/notebook-creation/data-table-manager.d.ts.map +0 -1
- package/dist/notebook-creation/data-table-manager.js.map +0 -1
- package/dist/notebook-creation/discover-creation-flow.d.ts +0 -2
- package/dist/notebook-creation/discover-creation-flow.d.ts.map +0 -1
- package/dist/notebook-creation/discover-creation-flow.js +0 -177
- package/dist/notebook-creation/discover-creation-flow.js.map +0 -1
- package/dist/notebook-creation/discover-quota.d.ts +0 -2
- package/dist/notebook-creation/discover-quota.d.ts.map +0 -1
- package/dist/notebook-creation/discover-quota.js +0 -194
- package/dist/notebook-creation/discover-quota.js.map +0 -1
- package/dist/notebook-creation/discover-source-dialog.d.ts +0 -8
- package/dist/notebook-creation/discover-source-dialog.d.ts.map +0 -1
- package/dist/notebook-creation/discover-source-dialog.js +0 -134
- package/dist/notebook-creation/discover-source-dialog.js.map +0 -1
- package/dist/notebook-creation/discover-sources.d.ts +0 -8
- package/dist/notebook-creation/discover-sources.d.ts.map +0 -1
- package/dist/notebook-creation/discover-sources.js +0 -272
- package/dist/notebook-creation/discover-sources.js.map +0 -1
- package/dist/notebook-creation/discover-text-input.d.ts +0 -7
- package/dist/notebook-creation/discover-text-input.d.ts.map +0 -1
- package/dist/notebook-creation/discover-text-input.js +0 -135
- package/dist/notebook-creation/discover-text-input.js.map +0 -1
- package/dist/notebook-creation/dom-scripts.d.ts.map +0 -1
- package/dist/notebook-creation/dom-scripts.js.map +0 -1
- package/dist/notebook-creation/errors.d.ts.map +0 -1
- package/dist/notebook-creation/errors.js.map +0 -1
- package/dist/notebook-creation/index.d.ts.map +0 -1
- package/dist/notebook-creation/index.js.map +0 -1
- package/dist/notebook-creation/notebook-creator.d.ts.map +0 -1
- package/dist/notebook-creation/notebook-creator.js.map +0 -1
- package/dist/notebook-creation/notebook-nav.d.ts.map +0 -1
- package/dist/notebook-creation/notebook-nav.js.map +0 -1
- package/dist/notebook-creation/notebook-sync.d.ts.map +0 -1
- package/dist/notebook-creation/notebook-sync.js.map +0 -1
- package/dist/notebook-creation/run-discovery.d.ts +0 -11
- package/dist/notebook-creation/run-discovery.d.ts.map +0 -1
- package/dist/notebook-creation/run-discovery.js +0 -151
- package/dist/notebook-creation/run-discovery.js.map +0 -1
- package/dist/notebook-creation/selector-discovery.d.ts +0 -65
- package/dist/notebook-creation/selector-discovery.d.ts.map +0 -1
- package/dist/notebook-creation/selector-discovery.js +0 -414
- package/dist/notebook-creation/selector-discovery.js.map +0 -1
- package/dist/notebook-creation/selectors.d.ts.map +0 -1
- package/dist/notebook-creation/selectors.js.map +0 -1
- package/dist/notebook-creation/selectors.ts +0 -112
- package/dist/notebook-creation/source-manager.d.ts.map +0 -1
- package/dist/notebook-creation/source-manager.js.map +0 -1
- package/dist/notebook-creation/test-create.d.ts +0 -8
- package/dist/notebook-creation/test-create.d.ts.map +0 -1
- package/dist/notebook-creation/test-create.js +0 -72
- package/dist/notebook-creation/test-create.js.map +0 -1
- package/dist/notebook-creation/types.d.ts.map +0 -1
- package/dist/notebook-creation/types.js.map +0 -1
- package/dist/notebook-creation/video-manager.d.ts.map +0 -1
- package/dist/notebook-creation/video-manager.js.map +0 -1
- package/dist/observability/metrics.d.ts.map +0 -1
- package/dist/observability/metrics.js.map +0 -1
- package/dist/quota/index.d.ts.map +0 -1
- package/dist/quota/index.js.map +0 -1
- package/dist/quota/quota-manager.d.ts.map +0 -1
- package/dist/quota/quota-manager.js.map +0 -1
- package/dist/resources/resource-handlers.d.ts.map +0 -1
- package/dist/resources/resource-handlers.js.map +0 -1
- package/dist/session/browser-session.d.ts.map +0 -1
- package/dist/session/browser-session.js.map +0 -1
- package/dist/session/session-manager.d.ts.map +0 -1
- package/dist/session/session-manager.js.map +0 -1
- package/dist/session/session-timeout.d.ts.map +0 -1
- package/dist/session/session-timeout.js.map +0 -1
- package/dist/session/shared-context-manager.d.ts.map +0 -1
- package/dist/session/shared-context-manager.js.map +0 -1
- package/dist/tools/annotations.d.ts.map +0 -1
- package/dist/tools/annotations.js.map +0 -1
- package/dist/tools/definitions/ask-question.d.ts.map +0 -1
- package/dist/tools/definitions/ask-question.js.map +0 -1
- package/dist/tools/definitions/chat-history.d.ts.map +0 -1
- package/dist/tools/definitions/chat-history.js.map +0 -1
- package/dist/tools/definitions/data-tables.d.ts.map +0 -1
- package/dist/tools/definitions/data-tables.js.map +0 -1
- package/dist/tools/definitions/gemini.d.ts.map +0 -1
- package/dist/tools/definitions/gemini.js.map +0 -1
- package/dist/tools/definitions/notebook-management.d.ts.map +0 -1
- package/dist/tools/definitions/notebook-management.js.map +0 -1
- package/dist/tools/definitions/query-history.d.ts.map +0 -1
- package/dist/tools/definitions/query-history.js.map +0 -1
- package/dist/tools/definitions/session-management.d.ts.map +0 -1
- package/dist/tools/definitions/session-management.js.map +0 -1
- package/dist/tools/definitions/system.d.ts.map +0 -1
- package/dist/tools/definitions/system.js.map +0 -1
- package/dist/tools/definitions/video.d.ts.map +0 -1
- package/dist/tools/definitions/video.js.map +0 -1
- package/dist/tools/definitions.d.ts.map +0 -1
- package/dist/tools/definitions.js.map +0 -1
- package/dist/tools/handlers/ask-question.d.ts.map +0 -1
- package/dist/tools/handlers/ask-question.js.map +0 -1
- package/dist/tools/handlers/audio-video.d.ts.map +0 -1
- package/dist/tools/handlers/audio-video.js.map +0 -1
- package/dist/tools/handlers/auth.d.ts.map +0 -1
- package/dist/tools/handlers/auth.js.map +0 -1
- package/dist/tools/handlers/error-utils.d.ts.map +0 -1
- package/dist/tools/handlers/error-utils.js.map +0 -1
- package/dist/tools/handlers/gemini.d.ts.map +0 -1
- package/dist/tools/handlers/gemini.js.map +0 -1
- package/dist/tools/handlers/index.d.ts.map +0 -1
- package/dist/tools/handlers/index.js.map +0 -1
- package/dist/tools/handlers/notebook-creation.d.ts.map +0 -1
- package/dist/tools/handlers/notebook-creation.js.map +0 -1
- package/dist/tools/handlers/notebook-management.d.ts.map +0 -1
- package/dist/tools/handlers/notebook-management.js.map +0 -1
- package/dist/tools/handlers/session-management.d.ts.map +0 -1
- package/dist/tools/handlers/session-management.js.map +0 -1
- package/dist/tools/handlers/system.d.ts.map +0 -1
- package/dist/tools/handlers/system.js.map +0 -1
- package/dist/tools/handlers/types.d.ts.map +0 -1
- package/dist/tools/handlers/types.js.map +0 -1
- package/dist/tools/handlers/webhooks.d.ts.map +0 -1
- package/dist/tools/handlers/webhooks.js.map +0 -1
- package/dist/tools/handlers.d.ts +0 -666
- package/dist/tools/handlers.d.ts.map +0 -1
- package/dist/tools/handlers.js +0 -2929
- package/dist/tools/handlers.js.map +0 -1
- package/dist/tools/icons.d.ts.map +0 -1
- package/dist/tools/icons.js.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/audit-logger.d.ts.map +0 -1
- package/dist/utils/audit-logger.js.map +0 -1
- package/dist/utils/cert-pinning.d.ts +0 -97
- package/dist/utils/cert-pinning.d.ts.map +0 -1
- package/dist/utils/cert-pinning.js +0 -328
- package/dist/utils/cert-pinning.js.map +0 -1
- package/dist/utils/cleanup-manager.d.ts.map +0 -1
- package/dist/utils/cleanup-manager.js.map +0 -1
- package/dist/utils/cli-handler.d.ts.map +0 -1
- package/dist/utils/cli-handler.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/file-lock.d.ts.map +0 -1
- package/dist/utils/file-lock.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/page-utils.d.ts.map +0 -1
- package/dist/utils/page-utils.js.map +0 -1
- package/dist/utils/response-validator.d.ts.map +0 -1
- package/dist/utils/response-validator.js.map +0 -1
- package/dist/utils/secrets-scanner.d.ts.map +0 -1
- package/dist/utils/secrets-scanner.js.map +0 -1
- package/dist/utils/secure-memory.d.ts.map +0 -1
- package/dist/utils/secure-memory.js.map +0 -1
- package/dist/utils/security.d.ts.map +0 -1
- package/dist/utils/security.js.map +0 -1
- package/dist/utils/settings-manager.d.ts.map +0 -1
- package/dist/utils/settings-manager.js.map +0 -1
- package/dist/utils/stealth-utils.d.ts.map +0 -1
- package/dist/utils/stealth-utils.js.map +0 -1
- package/dist/utils/tool-validation.d.ts +0 -93
- package/dist/utils/tool-validation.d.ts.map +0 -1
- package/dist/utils/tool-validation.js +0 -277
- package/dist/utils/tool-validation.js.map +0 -1
- package/dist/webhooks/index.d.ts.map +0 -1
- package/dist/webhooks/index.js.map +0 -1
- package/dist/webhooks/types.d.ts.map +0 -1
- package/dist/webhooks/types.js.map +0 -1
- package/dist/webhooks/webhook-dispatcher.d.ts.map +0 -1
- package/dist/webhooks/webhook-dispatcher.js.map +0 -1
- package/docs/COMPLIANCE-SPEC.md +0 -1452
- package/docs/MCP-DIRECTORY-LISTINGS.md +0 -91
- package/docs/SECURITY-FORK-OPPORTUNITIES.md +0 -79
- package/docs/SECURITY_IMPLEMENTATION_PLAN.md +0 -437
- package/docs/archive/ISSUES-legacy-2026-04-24.md +0 -644
- package/docs/configuration.md +0 -94
- package/docs/dependency-risk.md +0 -25
- package/docs/improvement-sprint-2026.2.10.md +0 -210
- package/docs/testing-runbook.md +0 -166
- package/docs/tools.md +0 -34
- package/docs/troubleshooting.md +0 -59
- package/docs/usage-guide.md +0 -246
package/dist/auth/mcp-auth.d.ts
CHANGED
package/dist/auth/mcp-auth.js
CHANGED
|
@@ -15,6 +15,7 @@ export declare class AlertManager {
|
|
|
15
15
|
private config;
|
|
16
16
|
private alertHistory;
|
|
17
17
|
private hourlyAlerts;
|
|
18
|
+
private recentAlerts;
|
|
18
19
|
private alertsDir;
|
|
19
20
|
private constructor();
|
|
20
21
|
/**
|
|
@@ -34,7 +35,9 @@ export declare class AlertManager {
|
|
|
34
35
|
*/
|
|
35
36
|
private isHourlyLimitExceeded;
|
|
36
37
|
/**
|
|
37
|
-
* Record that an alert was sent
|
|
38
|
+
* Record that an alert was sent. When a severity is provided the alert is
|
|
39
|
+
* also added to the 24h rolling window used for dashboard metrics; internal
|
|
40
|
+
* bookkeeping keys (e.g. the rate-limit warning) omit it.
|
|
38
41
|
*/
|
|
39
42
|
private recordAlert;
|
|
40
43
|
/**
|
|
@@ -94,6 +97,8 @@ export declare class AlertManager {
|
|
|
94
97
|
cooldown_seconds: number;
|
|
95
98
|
max_alerts_per_hour: number;
|
|
96
99
|
alerts_this_hour: number;
|
|
100
|
+
alerts_24h: number;
|
|
101
|
+
critical_24h: number;
|
|
97
102
|
channels: string[];
|
|
98
103
|
};
|
|
99
104
|
/**
|
|
@@ -117,4 +122,3 @@ export declare function alertCritical(title: string, message: string, source: st
|
|
|
117
122
|
* Send a warning alert
|
|
118
123
|
*/
|
|
119
124
|
export declare function alertWarning(title: string, message: string, source: string, details?: Record<string, unknown>): Promise<Alert | null>;
|
|
120
|
-
//# sourceMappingURL=alert-manager.d.ts.map
|
|
@@ -18,6 +18,23 @@ import { log } from "../utils/logger.js";
|
|
|
18
18
|
function generateUUID() {
|
|
19
19
|
return crypto.randomUUID();
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse webhook headers from environment. Malformed JSON must not throw during
|
|
23
|
+
* singleton construction (which would cascade through every getInstance caller);
|
|
24
|
+
* fall back to no custom headers with a logged warning instead.
|
|
25
|
+
*/
|
|
26
|
+
function parseWebhookHeaders() {
|
|
27
|
+
const raw = process.env.NLMCP_ALERTS_WEBHOOK_HEADERS;
|
|
28
|
+
if (!raw)
|
|
29
|
+
return undefined;
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(raw);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
log.warning(`alert-manager: ignoring malformed NLMCP_ALERTS_WEBHOOK_HEADERS: ${err instanceof Error ? err.message : String(err)}`);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
21
38
|
/**
|
|
22
39
|
* Get alert configuration from environment
|
|
23
40
|
*/
|
|
@@ -32,9 +49,7 @@ function getAlertConfig() {
|
|
|
32
49
|
} : undefined,
|
|
33
50
|
webhook: process.env.NLMCP_ALERTS_WEBHOOK_URL ? {
|
|
34
51
|
url: process.env.NLMCP_ALERTS_WEBHOOK_URL,
|
|
35
|
-
headers:
|
|
36
|
-
? JSON.parse(process.env.NLMCP_ALERTS_WEBHOOK_HEADERS)
|
|
37
|
-
: undefined,
|
|
52
|
+
headers: parseWebhookHeaders(),
|
|
38
53
|
} : undefined,
|
|
39
54
|
},
|
|
40
55
|
min_severity: process.env.NLMCP_ALERTS_MIN_SEVERITY || "warning",
|
|
@@ -59,6 +74,8 @@ export class AlertManager {
|
|
|
59
74
|
config;
|
|
60
75
|
alertHistory = new Map(); // key -> last alert timestamp
|
|
61
76
|
hourlyAlerts = [];
|
|
77
|
+
// 24h rolling window of sent alerts with severity, for dashboard reporting.
|
|
78
|
+
recentAlerts = [];
|
|
62
79
|
alertsDir;
|
|
63
80
|
constructor() {
|
|
64
81
|
this.config = getAlertConfig();
|
|
@@ -102,11 +119,19 @@ export class AlertManager {
|
|
|
102
119
|
return this.hourlyAlerts.length >= this.config.max_alerts_per_hour;
|
|
103
120
|
}
|
|
104
121
|
/**
|
|
105
|
-
* Record that an alert was sent
|
|
122
|
+
* Record that an alert was sent. When a severity is provided the alert is
|
|
123
|
+
* also added to the 24h rolling window used for dashboard metrics; internal
|
|
124
|
+
* bookkeeping keys (e.g. the rate-limit warning) omit it.
|
|
106
125
|
*/
|
|
107
|
-
recordAlert(key) {
|
|
108
|
-
|
|
109
|
-
this.
|
|
126
|
+
recordAlert(key, severity) {
|
|
127
|
+
const now = Date.now();
|
|
128
|
+
this.alertHistory.set(key, now);
|
|
129
|
+
this.hourlyAlerts.push({ timestamp: now });
|
|
130
|
+
if (severity) {
|
|
131
|
+
const dayAgo = now - 24 * 60 * 60 * 1000;
|
|
132
|
+
this.recentAlerts = this.recentAlerts.filter(a => a.timestamp > dayAgo);
|
|
133
|
+
this.recentAlerts.push({ timestamp: now, severity });
|
|
134
|
+
}
|
|
110
135
|
}
|
|
111
136
|
/**
|
|
112
137
|
* Generate a unique key for deduplication
|
|
@@ -167,7 +192,7 @@ export class AlertManager {
|
|
|
167
192
|
alert.sent_to.push("webhook");
|
|
168
193
|
}
|
|
169
194
|
// Record this alert
|
|
170
|
-
this.recordAlert(key);
|
|
195
|
+
this.recordAlert(key, severity);
|
|
171
196
|
return alert;
|
|
172
197
|
}
|
|
173
198
|
/**
|
|
@@ -372,14 +397,20 @@ export class AlertManager {
|
|
|
372
397
|
channels.push("file");
|
|
373
398
|
if (this.config.channels.webhook)
|
|
374
399
|
channels.push("webhook");
|
|
375
|
-
const
|
|
400
|
+
const now = Date.now();
|
|
401
|
+
const oneHourAgo = now - 60 * 60 * 1000;
|
|
402
|
+
const dayAgo = now - 24 * 60 * 60 * 1000;
|
|
376
403
|
const alertsThisHour = this.hourlyAlerts.filter(a => a.timestamp > oneHourAgo).length;
|
|
404
|
+
const recent24h = this.recentAlerts.filter(a => a.timestamp > dayAgo);
|
|
405
|
+
const critical24h = recent24h.filter(a => a.severity === "critical").length;
|
|
377
406
|
return {
|
|
378
407
|
enabled: this.config.enabled,
|
|
379
408
|
min_severity: this.config.min_severity,
|
|
380
409
|
cooldown_seconds: this.config.cooldown_seconds,
|
|
381
410
|
max_alerts_per_hour: this.config.max_alerts_per_hour,
|
|
382
411
|
alerts_this_hour: alertsThisHour,
|
|
412
|
+
alerts_24h: recent24h.length,
|
|
413
|
+
critical_24h: critical24h,
|
|
383
414
|
channels,
|
|
384
415
|
};
|
|
385
416
|
}
|
|
@@ -420,4 +451,3 @@ export async function alertCritical(title, message, source, details) {
|
|
|
420
451
|
export async function alertWarning(title, message, source, details) {
|
|
421
452
|
return getAlertManager().warning(title, message, source, details);
|
|
422
453
|
}
|
|
423
|
-
//# sourceMappingURL=alert-manager.js.map
|
|
@@ -54,6 +54,19 @@ export declare class ChangeLog {
|
|
|
54
54
|
* Get all changes (most recent first)
|
|
55
55
|
*/
|
|
56
56
|
getAllChanges(limit?: number): Promise<ChangeRecord[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Select monthly log files whose YYYY-MM month overlaps the [from, to] range.
|
|
59
|
+
* Filenames are `changes-YYYY-MM.jsonl`; pushing the date filter into file
|
|
60
|
+
* selection avoids reading (and event-loop-blocking on) years of history when
|
|
61
|
+
* only a narrow report window is requested (L48). Returns newest-first.
|
|
62
|
+
*/
|
|
63
|
+
private getLogFilesInRange;
|
|
64
|
+
/**
|
|
65
|
+
* Read change records from a specific set of files, applying an optional
|
|
66
|
+
* date-range predicate. Used by range-bounded queries so only relevant
|
|
67
|
+
* monthly files are read rather than the entire history.
|
|
68
|
+
*/
|
|
69
|
+
private readChangesFromFiles;
|
|
57
70
|
/**
|
|
58
71
|
* Get high-impact changes
|
|
59
72
|
*/
|
|
@@ -110,4 +123,3 @@ export declare function getRecentChanges(limit?: number): Promise<ChangeRecord[]
|
|
|
110
123
|
* Get change statistics
|
|
111
124
|
*/
|
|
112
125
|
export declare function getChangeStatistics(from?: Date, to?: Date): Promise<ReturnType<ChangeLog["getStatistics"]>>;
|
|
113
|
-
//# sourceMappingURL=change-log.d.ts.map
|
|
@@ -121,13 +121,12 @@ export class ChangeLog {
|
|
|
121
121
|
* Get changes within date range
|
|
122
122
|
*/
|
|
123
123
|
async getChangesInRange(from, to, limit = 1000) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
.slice(0, limit);
|
|
124
|
+
// Read only the monthly files overlapping the range (L48) rather than the
|
|
125
|
+
// whole history, then sort most-recent-first to preserve the prior contract.
|
|
126
|
+
const files = this.getLogFilesInRange(from, to);
|
|
127
|
+
const changes = this.readChangesFromFiles(files, from, to);
|
|
128
|
+
changes.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
129
|
+
return changes.slice(0, limit);
|
|
131
130
|
}
|
|
132
131
|
/**
|
|
133
132
|
* Get all changes (most recent first)
|
|
@@ -168,6 +167,77 @@ export class ChangeLog {
|
|
|
168
167
|
}
|
|
169
168
|
return changes;
|
|
170
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Select monthly log files whose YYYY-MM month overlaps the [from, to] range.
|
|
172
|
+
* Filenames are `changes-YYYY-MM.jsonl`; pushing the date filter into file
|
|
173
|
+
* selection avoids reading (and event-loop-blocking on) years of history when
|
|
174
|
+
* only a narrow report window is requested (L48). Returns newest-first.
|
|
175
|
+
*/
|
|
176
|
+
getLogFilesInRange(from, to) {
|
|
177
|
+
if (!fs.existsSync(this.logDir))
|
|
178
|
+
return [];
|
|
179
|
+
// Use the same (local-time) month derivation as the filename convention
|
|
180
|
+
// (initializeLogFile/getLogFilePath). Widen the window by one month on each
|
|
181
|
+
// side so a record whose UTC timestamp lands in a file named for an adjacent
|
|
182
|
+
// local month is still considered; readChangesFromFiles applies the exact
|
|
183
|
+
// per-record date predicate, so widening never admits out-of-range records.
|
|
184
|
+
const monthKey = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
|
|
185
|
+
const shiftMonth = (d, delta) => new Date(d.getFullYear(), d.getMonth() + delta, 1);
|
|
186
|
+
const fromKey = from ? monthKey(shiftMonth(from, -1)) : undefined;
|
|
187
|
+
const toKey = to ? monthKey(shiftMonth(to, 1)) : undefined;
|
|
188
|
+
return fs.readdirSync(this.logDir)
|
|
189
|
+
.filter(f => f.startsWith("changes-") && f.endsWith(".jsonl"))
|
|
190
|
+
.filter(f => {
|
|
191
|
+
const month = f.slice("changes-".length, f.length - ".jsonl".length);
|
|
192
|
+
if (!/^\d{4}-\d{2}$/.test(month))
|
|
193
|
+
return false;
|
|
194
|
+
// Inclusive month-boundary comparison (lexicographic works for YYYY-MM).
|
|
195
|
+
if (fromKey && month < fromKey)
|
|
196
|
+
return false;
|
|
197
|
+
if (toKey && month > toKey)
|
|
198
|
+
return false;
|
|
199
|
+
return true;
|
|
200
|
+
})
|
|
201
|
+
.map(f => path.join(this.logDir, f))
|
|
202
|
+
.sort()
|
|
203
|
+
.reverse();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Read change records from a specific set of files, applying an optional
|
|
207
|
+
* date-range predicate. Used by range-bounded queries so only relevant
|
|
208
|
+
* monthly files are read rather than the entire history.
|
|
209
|
+
*/
|
|
210
|
+
readChangesFromFiles(files, from, to) {
|
|
211
|
+
const changes = [];
|
|
212
|
+
for (const filePath of files) {
|
|
213
|
+
try {
|
|
214
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
215
|
+
const lines = content.trim().split("\n").filter(l => l);
|
|
216
|
+
for (const line of lines) {
|
|
217
|
+
try {
|
|
218
|
+
const record = JSON.parse(line);
|
|
219
|
+
if (from || to) {
|
|
220
|
+
const date = new Date(record.timestamp);
|
|
221
|
+
if (from && date < from)
|
|
222
|
+
continue;
|
|
223
|
+
if (to && date > to)
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
changes.push(record);
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
log.debug(`change-log: parse change record line: ${err instanceof Error ? err.message : String(err)}`);
|
|
230
|
+
// Skip malformed lines
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
log.debug(`change-log: read change log file in range: ${err instanceof Error ? err.message : String(err)}`);
|
|
236
|
+
// Skip unreadable files
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return changes;
|
|
240
|
+
}
|
|
171
241
|
/**
|
|
172
242
|
* Get high-impact changes
|
|
173
243
|
*/
|
|
@@ -197,14 +267,11 @@ export class ChangeLog {
|
|
|
197
267
|
* Get change statistics
|
|
198
268
|
*/
|
|
199
269
|
async getStatistics(from, to) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (to) {
|
|
206
|
-
changes = changes.filter(c => new Date(c.timestamp) <= to);
|
|
207
|
-
}
|
|
270
|
+
// Read only the monthly files overlapping [from, to] and apply the exact
|
|
271
|
+
// date predicate per record, instead of slurping the entire 7-year history
|
|
272
|
+
// and filtering in memory (L48).
|
|
273
|
+
const files = this.getLogFilesInRange(from, to);
|
|
274
|
+
const changes = this.readChangesFromFiles(files, from, to);
|
|
208
275
|
const byComponent = {};
|
|
209
276
|
const byImpact = {};
|
|
210
277
|
const byMethod = {};
|
|
@@ -275,4 +342,3 @@ export async function getRecentChanges(limit = 100) {
|
|
|
275
342
|
export async function getChangeStatistics(from, to) {
|
|
276
343
|
return getChangeLog().getStatistics(from, to);
|
|
277
344
|
}
|
|
278
|
-
//# sourceMappingURL=change-log.js.map
|
|
@@ -30,7 +30,20 @@ export declare class ComplianceLogger {
|
|
|
30
30
|
*/
|
|
31
31
|
private getLogFilePath;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Read the last event's hash from a specific log file, or null if the file is
|
|
34
|
+
* absent/empty/unreadable.
|
|
35
|
+
*/
|
|
36
|
+
private readLastHashFromFile;
|
|
37
|
+
/**
|
|
38
|
+
* Return the last hash from the most recent monthly file before the current
|
|
39
|
+
* one, so a fresh month seeds its chain from the prior month rather than
|
|
40
|
+
* forking a new chain at month rollover (L49).
|
|
41
|
+
*/
|
|
42
|
+
private findPreviousMonthLastHash;
|
|
43
|
+
/**
|
|
44
|
+
* Load the last hash to continue the chain. Prefer the current month's file;
|
|
45
|
+
* if it is empty/absent (month rollover), seed from the previous month's last
|
|
46
|
+
* hash so cross-month gaps don't fork the chain and trigger a false tamper signal.
|
|
34
47
|
*/
|
|
35
48
|
private loadLastHash;
|
|
36
49
|
/**
|
|
@@ -38,7 +51,15 @@ export declare class ComplianceLogger {
|
|
|
38
51
|
*/
|
|
39
52
|
private createEvent;
|
|
40
53
|
/**
|
|
41
|
-
* Write event to log file
|
|
54
|
+
* Write event to log file.
|
|
55
|
+
*
|
|
56
|
+
* The chain link (previous_hash), hash computation, append, and lastHash
|
|
57
|
+
* advance all happen inside a single withLock critical section so that
|
|
58
|
+
* concurrent processes / calls serialize their appends and never fork the
|
|
59
|
+
* hash chain (L49, mirrors audit-logger H20). The on-disk tail is treated as
|
|
60
|
+
* the source of truth for previous_hash, re-seeding from the file (including a
|
|
61
|
+
* prior-month seed on rollover) so a stale in-memory pointer cannot break the
|
|
62
|
+
* chain after another process appended.
|
|
42
63
|
*/
|
|
43
64
|
private writeEvent;
|
|
44
65
|
/**
|
|
@@ -106,6 +127,12 @@ export declare class ComplianceLogger {
|
|
|
106
127
|
totalEvents: number;
|
|
107
128
|
validEvents: number;
|
|
108
129
|
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Return the current in-memory chain head (hash of the last event this process
|
|
132
|
+
* wrote, or the seeded value at startup). Diagnostic only — writeEvent always
|
|
133
|
+
* re-reads the authoritative tail from disk under lock before linking (L49).
|
|
134
|
+
*/
|
|
135
|
+
getChainHead(): string;
|
|
109
136
|
/**
|
|
110
137
|
* Get compliance log statistics
|
|
111
138
|
*/
|
|
@@ -133,4 +160,3 @@ export declare function logComplianceEvent(category: ComplianceEventCategory, ev
|
|
|
133
160
|
retentionDays?: number;
|
|
134
161
|
failureReason?: string;
|
|
135
162
|
}): Promise<ComplianceEvent>;
|
|
136
|
-
//# sourceMappingURL=compliance-logger.d.ts.map
|
|
@@ -10,6 +10,7 @@ import crypto from "crypto";
|
|
|
10
10
|
import path from "path";
|
|
11
11
|
import fs from "fs";
|
|
12
12
|
import { mkdirSecure, appendFileSecure } from "../utils/file-permissions.js";
|
|
13
|
+
import { withLock } from "../utils/file-lock.js";
|
|
13
14
|
import { log } from "../utils/logger.js";
|
|
14
15
|
import { CONFIG } from "../config.js";
|
|
15
16
|
/**
|
|
@@ -96,26 +97,65 @@ export class ComplianceLogger {
|
|
|
96
97
|
return path.join(this.complianceDir, `events-${year}-${month}.jsonl`);
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
|
-
*
|
|
100
|
+
* Read the last event's hash from a specific log file, or null if the file is
|
|
101
|
+
* absent/empty/unreadable.
|
|
100
102
|
*/
|
|
101
|
-
|
|
103
|
+
readLastHashFromFile(logPath) {
|
|
102
104
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
if (!fs.existsSync(logPath))
|
|
106
|
+
return null;
|
|
107
|
+
const content = fs.readFileSync(logPath, "utf-8");
|
|
108
|
+
const lines = content.trim().split("\n").filter(line => line);
|
|
109
|
+
if (lines.length === 0)
|
|
110
|
+
return null;
|
|
111
|
+
const lastEvent = JSON.parse(lines[lines.length - 1]);
|
|
112
|
+
return typeof lastEvent.hash === "string" && lastEvent.hash.length > 0
|
|
113
|
+
? lastEvent.hash
|
|
114
|
+
: null;
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
log.debug(`compliance-logger: readLastHashFromFile read log file: ${err instanceof Error ? err.message : String(err)}`);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Return the last hash from the most recent monthly file before the current
|
|
123
|
+
* one, so a fresh month seeds its chain from the prior month rather than
|
|
124
|
+
* forking a new chain at month rollover (L49).
|
|
125
|
+
*/
|
|
126
|
+
findPreviousMonthLastHash() {
|
|
127
|
+
try {
|
|
128
|
+
if (!fs.existsSync(this.complianceDir))
|
|
129
|
+
return null;
|
|
130
|
+
const currentFile = path.basename(this.getLogFilePath());
|
|
131
|
+
const candidates = fs.readdirSync(this.complianceDir)
|
|
132
|
+
.filter(f => f.startsWith("events-") && f.endsWith(".jsonl") && f < currentFile)
|
|
133
|
+
.sort()
|
|
134
|
+
.reverse(); // most recent prior month first
|
|
135
|
+
for (const f of candidates) {
|
|
136
|
+
const hash = this.readLastHashFromFile(path.join(this.complianceDir, f));
|
|
137
|
+
if (hash)
|
|
138
|
+
return hash;
|
|
112
139
|
}
|
|
113
140
|
}
|
|
114
141
|
catch (err) {
|
|
115
|
-
log.debug(`compliance-logger:
|
|
116
|
-
// If we can't read the hash, start fresh
|
|
117
|
-
this.lastHash = "0".repeat(64);
|
|
142
|
+
log.debug(`compliance-logger: findPreviousMonthLastHash: ${err instanceof Error ? err.message : String(err)}`);
|
|
118
143
|
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Load the last hash to continue the chain. Prefer the current month's file;
|
|
148
|
+
* if it is empty/absent (month rollover), seed from the previous month's last
|
|
149
|
+
* hash so cross-month gaps don't fork the chain and trigger a false tamper signal.
|
|
150
|
+
*/
|
|
151
|
+
loadLastHash() {
|
|
152
|
+
const current = this.readLastHashFromFile(this.getLogFilePath());
|
|
153
|
+
if (current) {
|
|
154
|
+
this.lastHash = current;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const prevMonth = this.findPreviousMonthLastHash();
|
|
158
|
+
this.lastHash = prevMonth || "0".repeat(64);
|
|
119
159
|
}
|
|
120
160
|
/**
|
|
121
161
|
* Create a compliance event
|
|
@@ -139,27 +179,43 @@ export class ComplianceLogger {
|
|
|
139
179
|
retention_days: options.retentionDays || this.retentionYears * 365,
|
|
140
180
|
outcome,
|
|
141
181
|
failure_reason: options.failureReason,
|
|
142
|
-
hash
|
|
143
|
-
|
|
182
|
+
// previous_hash and hash are intentionally left blank here. They are stamped
|
|
183
|
+
// inside writeEvent's lock so concurrent log() calls and other processes
|
|
184
|
+
// cannot read the same this.lastHash and fork the chain (L49, mirrors H20).
|
|
185
|
+
hash: "",
|
|
186
|
+
previous_hash: "",
|
|
144
187
|
};
|
|
145
|
-
// Compute hash (exclude hash field itself)
|
|
146
|
-
const hashInput = JSON.stringify({
|
|
147
|
-
...event,
|
|
148
|
-
hash: undefined,
|
|
149
|
-
});
|
|
150
|
-
event.hash = computeHash(hashInput);
|
|
151
|
-
this.lastHash = event.hash;
|
|
152
188
|
return event;
|
|
153
189
|
}
|
|
154
190
|
/**
|
|
155
|
-
* Write event to log file
|
|
191
|
+
* Write event to log file.
|
|
192
|
+
*
|
|
193
|
+
* The chain link (previous_hash), hash computation, append, and lastHash
|
|
194
|
+
* advance all happen inside a single withLock critical section so that
|
|
195
|
+
* concurrent processes / calls serialize their appends and never fork the
|
|
196
|
+
* hash chain (L49, mirrors audit-logger H20). The on-disk tail is treated as
|
|
197
|
+
* the source of truth for previous_hash, re-seeding from the file (including a
|
|
198
|
+
* prior-month seed on rollover) so a stale in-memory pointer cannot break the
|
|
199
|
+
* chain after another process appended.
|
|
156
200
|
*/
|
|
157
201
|
async writeEvent(event) {
|
|
158
202
|
if (!this.enabled)
|
|
159
203
|
return;
|
|
160
204
|
const logPath = this.getLogFilePath();
|
|
161
|
-
|
|
162
|
-
|
|
205
|
+
await withLock(logPath, async () => {
|
|
206
|
+
// Re-read the authoritative tail under the lock so the chain links from
|
|
207
|
+
// whatever was actually last written (by this or any other process).
|
|
208
|
+
const diskHash = this.readLastHashFromFile(logPath)
|
|
209
|
+
?? this.findPreviousMonthLastHash()
|
|
210
|
+
?? "0".repeat(64);
|
|
211
|
+
event.previous_hash = diskHash;
|
|
212
|
+
const hashInput = JSON.stringify({ ...event, hash: undefined });
|
|
213
|
+
event.hash = computeHash(hashInput);
|
|
214
|
+
const line = JSON.stringify(event) + "\n";
|
|
215
|
+
appendFileSecure(logPath, line);
|
|
216
|
+
// Advance the in-memory pointer only after the write succeeds.
|
|
217
|
+
this.lastHash = event.hash;
|
|
218
|
+
});
|
|
163
219
|
}
|
|
164
220
|
/**
|
|
165
221
|
* Log a compliance event
|
|
@@ -362,6 +418,14 @@ export class ComplianceLogger {
|
|
|
362
418
|
validEvents,
|
|
363
419
|
};
|
|
364
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Return the current in-memory chain head (hash of the last event this process
|
|
423
|
+
* wrote, or the seeded value at startup). Diagnostic only — writeEvent always
|
|
424
|
+
* re-reads the authoritative tail from disk under lock before linking (L49).
|
|
425
|
+
*/
|
|
426
|
+
getChainHead() {
|
|
427
|
+
return this.lastHash;
|
|
428
|
+
}
|
|
365
429
|
/**
|
|
366
430
|
* Get compliance log statistics
|
|
367
431
|
*/
|
|
@@ -427,4 +491,3 @@ export function getComplianceLogger() {
|
|
|
427
491
|
export async function logComplianceEvent(category, eventType, actor, outcome, options) {
|
|
428
492
|
return getComplianceLogger().log(category, eventType, actor, outcome, options);
|
|
429
493
|
}
|
|
430
|
-
//# sourceMappingURL=compliance-logger.js.map
|
|
@@ -66,7 +66,8 @@ interface SOC2Dashboard {
|
|
|
66
66
|
status: "compliant" | "at_risk" | "non_compliant";
|
|
67
67
|
availability: {
|
|
68
68
|
current_status: string;
|
|
69
|
-
uptime_percentage: number;
|
|
69
|
+
uptime_percentage: number | null;
|
|
70
|
+
uptime_percentage_measured: boolean;
|
|
70
71
|
last_incident?: string;
|
|
71
72
|
};
|
|
72
73
|
security: {
|
|
@@ -123,7 +124,8 @@ interface SecurityDashboard {
|
|
|
123
124
|
alerts: {
|
|
124
125
|
total_24h: number;
|
|
125
126
|
critical_24h: number;
|
|
126
|
-
unacknowledged: number;
|
|
127
|
+
unacknowledged: number | null;
|
|
128
|
+
unacknowledged_tracked: boolean;
|
|
127
129
|
};
|
|
128
130
|
breach_detection: {
|
|
129
131
|
enabled: boolean;
|
|
@@ -240,4 +242,3 @@ export declare function getComplianceScore(): Promise<ReturnType<ComplianceDashb
|
|
|
240
242
|
*/
|
|
241
243
|
export declare function getDashboardCLI(): Promise<string>;
|
|
242
244
|
export {};
|
|
243
|
-
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -185,9 +185,9 @@ export class ComplianceDashboard {
|
|
|
185
185
|
// Get logging status
|
|
186
186
|
const loggerStats = await complianceLogger.getStats();
|
|
187
187
|
const integrity = await complianceLogger.verifyIntegrity();
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
// Availability percentage is intentionally NOT computed: there is no
|
|
189
|
+
// downtime/incident-duration tracking, so any number here would be a
|
|
190
|
+
// fabricated SOC2 metric. Report null + measured=false instead.
|
|
191
191
|
// Determine status
|
|
192
192
|
let status = "compliant";
|
|
193
193
|
if (!security.encryption_enabled || openIncidents.length > 0) {
|
|
@@ -200,7 +200,8 @@ export class ComplianceDashboard {
|
|
|
200
200
|
status,
|
|
201
201
|
availability: {
|
|
202
202
|
current_status: metrics?.status || "unknown",
|
|
203
|
-
uptime_percentage:
|
|
203
|
+
uptime_percentage: null,
|
|
204
|
+
uptime_percentage_measured: false,
|
|
204
205
|
last_incident: lastIncident,
|
|
205
206
|
},
|
|
206
207
|
security: {
|
|
@@ -301,9 +302,12 @@ export class ComplianceDashboard {
|
|
|
301
302
|
by_type: incidentStats.by_type,
|
|
302
303
|
},
|
|
303
304
|
alerts: {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
// Real 24h counts from AlertManager's rolling window (not an estimate).
|
|
306
|
+
total_24h: alertStats.alerts_24h,
|
|
307
|
+
critical_24h: alertStats.critical_24h,
|
|
308
|
+
// No acknowledgment model exists — report not-tracked rather than a fake 0.
|
|
309
|
+
unacknowledged: null,
|
|
310
|
+
unacknowledged_tracked: false,
|
|
307
311
|
},
|
|
308
312
|
breach_detection: {
|
|
309
313
|
enabled: true,
|
|
@@ -516,4 +520,3 @@ export async function getComplianceScore() {
|
|
|
516
520
|
export async function getDashboardCLI() {
|
|
517
521
|
return getComplianceDashboard().getSummaryForCLI();
|
|
518
522
|
}
|
|
519
|
-
//# sourceMappingURL=dashboard.js.map
|