@pan-sec/notebooklm-mcp 2026.3.3 → 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 +60 -7
- 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
|
@@ -68,6 +68,22 @@ export async function handleCreateNotebook(ctx, args, sendProgress) {
|
|
|
68
68
|
sendProgress,
|
|
69
69
|
browserOptions: args.browser_options || (args.show_browser ? { show: true } : undefined),
|
|
70
70
|
});
|
|
71
|
+
// A notebook where sources were requested but NONE succeeded is discarded
|
|
72
|
+
// by the creator (which throws), so we never reach here for that case.
|
|
73
|
+
// Guard defensively anyway: never persist a library entry or count quota
|
|
74
|
+
// for a notebook that requested sources yet added none. (An empty `sources`
|
|
75
|
+
// request — e.g. an overflow shell notebook that gets populated later — is
|
|
76
|
+
// a legitimate zero-source case and is still added.)
|
|
77
|
+
const requestedSources = args.sources.length;
|
|
78
|
+
const addedNone = requestedSources > 0 && result.sourceCount === 0;
|
|
79
|
+
if (addedNone) {
|
|
80
|
+
log.warning(`⚠️ Notebook had no successful sources — not adding to library: ${args.name}`);
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
data: null,
|
|
84
|
+
error: "Notebook creation failed: no sources could be added",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
71
87
|
// Auto-add to library if requested (default: true)
|
|
72
88
|
if (args.auto_add_to_library !== false) {
|
|
73
89
|
try {
|
|
@@ -608,4 +624,3 @@ export async function handleRemoveSource(ctx, args) {
|
|
|
608
624
|
};
|
|
609
625
|
}
|
|
610
626
|
}
|
|
611
|
-
//# sourceMappingURL=notebook-creation.js.map
|
|
@@ -61,4 +61,3 @@ export declare function handleSearchNotebooks(ctx: HandlerContext, args: {
|
|
|
61
61
|
* Handle get_library_stats tool
|
|
62
62
|
*/
|
|
63
63
|
export declare function handleGetLibraryStats(ctx: HandlerContext): Promise<ToolResult<LibraryStats>>;
|
|
64
|
-
//# sourceMappingURL=notebook-management.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Standalone handler functions for notebook CRUD and library operations.
|
|
5
5
|
*/
|
|
6
6
|
import { log } from "../../utils/logger.js";
|
|
7
|
+
import { validateNotebookUrl } from "../../utils/security.js";
|
|
7
8
|
import { getSanitizedErrorMessage } from "./error-utils.js";
|
|
8
9
|
async function withNotebookHandler(toolName, fn) {
|
|
9
10
|
try {
|
|
@@ -93,7 +94,12 @@ export async function handleUpdateNotebook(ctx, args) {
|
|
|
93
94
|
log.info(`🔧 [TOOL] update_notebook called`);
|
|
94
95
|
log.info(` ID: ${args.id}`);
|
|
95
96
|
return withNotebookHandler("update_notebook", () => {
|
|
96
|
-
|
|
97
|
+
// Validate/normalize the URL through the canonical NotebookLM validator
|
|
98
|
+
// before storing (matches create_notebook / add_source handlers).
|
|
99
|
+
const safeArgs = args.url !== undefined
|
|
100
|
+
? { ...args, url: validateNotebookUrl(args.url) }
|
|
101
|
+
: args;
|
|
102
|
+
const notebook = ctx.library.updateNotebook(safeArgs);
|
|
97
103
|
log.success(`✅ [TOOL] update_notebook completed: ${notebook.name}`);
|
|
98
104
|
return {
|
|
99
105
|
success: true,
|
|
@@ -165,4 +171,3 @@ export async function handleGetLibraryStats(ctx) {
|
|
|
165
171
|
};
|
|
166
172
|
});
|
|
167
173
|
}
|
|
168
|
-
//# sourceMappingURL=notebook-management.js.map
|
package/dist/tools/icons.d.ts
CHANGED
package/dist/tools/icons.js
CHANGED
package/dist/tools/index.d.ts
CHANGED
package/dist/tools/index.js
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
|
@@ -54,6 +54,8 @@ export declare class AuditLogger {
|
|
|
54
54
|
private config;
|
|
55
55
|
private currentLogFile;
|
|
56
56
|
private previousHash;
|
|
57
|
+
private checkpointPath;
|
|
58
|
+
private checkpointKey;
|
|
57
59
|
private writeQueue;
|
|
58
60
|
private pendingEvents;
|
|
59
61
|
private hashChainWarningLogged;
|
|
@@ -152,6 +154,15 @@ export declare class AuditLogger {
|
|
|
152
154
|
*/
|
|
153
155
|
flush(): Promise<void>;
|
|
154
156
|
private getLogFilePathForTimestamp;
|
|
157
|
+
/** Compute the HMAC signature for a checkpoint hash, or null when no key is set. */
|
|
158
|
+
private signCheckpoint;
|
|
159
|
+
/**
|
|
160
|
+
* Persist the latest chain hash to the external checkpoint (outside the log dir).
|
|
161
|
+
* Best-effort: a failure here must never break audit writes.
|
|
162
|
+
*/
|
|
163
|
+
private writeCheckpoint;
|
|
164
|
+
/** Read the external checkpoint, returning null if absent or unreadable. */
|
|
165
|
+
private readCheckpoint;
|
|
155
166
|
private disableHashChainForSession;
|
|
156
167
|
private handleWriteFailure;
|
|
157
168
|
private registerProcessHandlers;
|
|
@@ -177,4 +188,3 @@ export declare const audit: {
|
|
|
177
188
|
configChange: (setting: string, oldValue: unknown, newValue: unknown, changedBy?: string) => Promise<void>;
|
|
178
189
|
retention: (action: "cleanup" | "archive" | "delete", dataType: string, count: number, details?: Record<string, unknown>) => Promise<void>;
|
|
179
190
|
};
|
|
180
|
-
//# sourceMappingURL=audit-logger.d.ts.map
|
|
@@ -16,7 +16,7 @@ import path from "path";
|
|
|
16
16
|
import crypto from "crypto";
|
|
17
17
|
import { CONFIG } from "../config.js";
|
|
18
18
|
import { sanitizeForLogging } from "./security.js";
|
|
19
|
-
import { withLock } from "./file-lock.js";
|
|
19
|
+
import { withLock, STALE_LOCK_THRESHOLD_MS } from "./file-lock.js";
|
|
20
20
|
import { logger } from "./logger.js";
|
|
21
21
|
import { mkdirSecure, appendFileSecure, PERMISSION_MODES, } from "./file-permissions.js";
|
|
22
22
|
/**
|
|
@@ -43,6 +43,21 @@ export class AuditLogger {
|
|
|
43
43
|
config;
|
|
44
44
|
currentLogFile = "";
|
|
45
45
|
previousHash = "GENESIS";
|
|
46
|
+
// M6: external tamper anchor (chosen over a co-located sequence counter — see note
|
|
47
|
+
// below). The checkpoint persists the latest chain hash to a sidecar file OUTSIDE
|
|
48
|
+
// the audit log dir. Threat model, honestly stated:
|
|
49
|
+
// - Location separation defends only against tampering scoped to the audit-*.jsonl
|
|
50
|
+
// files (a tool/path that rewrites the logs but doesn't know about the sidecar).
|
|
51
|
+
// - An attacker with broad filesystem write can also rewrite the sidecar. The HMAC
|
|
52
|
+
// SIGNATURE is the only real defense against that, and only if
|
|
53
|
+
// NLMCP_AUDIT_CHECKPOINT_KEY is stored where the attacker cannot read it.
|
|
54
|
+
// A co-located sequence counter was rejected: the same broad-write attacker would
|
|
55
|
+
// renumber it contiguously, so it would not close the stated threat, and it would
|
|
56
|
+
// touch the hashed payload (breaking the existing chain tests). The checkpoint leaves
|
|
57
|
+
// the hashed payload untouched. Set NLMCP_AUDIT_CHECKPOINT_PATH to place the sidecar
|
|
58
|
+
// on a different volume/trust domain for genuine location separation.
|
|
59
|
+
checkpointPath = "";
|
|
60
|
+
checkpointKey = process.env.NLMCP_AUDIT_CHECKPOINT_KEY;
|
|
46
61
|
writeQueue = Promise.resolve();
|
|
47
62
|
pendingEvents = [];
|
|
48
63
|
hashChainWarningLogged = false;
|
|
@@ -64,6 +79,14 @@ export class AuditLogger {
|
|
|
64
79
|
this.config = { ...getAuditConfig(), ...config };
|
|
65
80
|
AuditLogger.instances.add(this);
|
|
66
81
|
this.registerProcessHandlers();
|
|
82
|
+
// M6: place the tamper-anchor checkpoint OUTSIDE the audit log dir but in a
|
|
83
|
+
// directory that is guaranteed to exist at write time. The parent of logDir
|
|
84
|
+
// (dataDir in production) is created by ensureLogDirectory() in this constructor
|
|
85
|
+
// before any checkpoint write; configDir is intentionally never created by the app
|
|
86
|
+
// (see config.ts), so we do NOT use it — that would make this a silent no-op.
|
|
87
|
+
// NLMCP_AUDIT_CHECKPOINT_PATH lets ops relocate the sidecar to another trust domain.
|
|
88
|
+
this.checkpointPath = process.env.NLMCP_AUDIT_CHECKPOINT_PATH
|
|
89
|
+
|| path.join(path.dirname(this.config.logDir), ".audit-checkpoint.json");
|
|
67
90
|
if (this.config.enabled) {
|
|
68
91
|
this.ensureLogDirectory();
|
|
69
92
|
this.initializeLogFile();
|
|
@@ -100,14 +123,22 @@ export class AuditLogger {
|
|
|
100
123
|
}
|
|
101
124
|
}
|
|
102
125
|
catch (err) {
|
|
103
|
-
//
|
|
104
|
-
|
|
126
|
+
// A corrupt tail on the current day must NOT silently reset to a fresh GENESIS
|
|
127
|
+
// chain — that would let an attacker append one garbage byte to force a chain
|
|
128
|
+
// restart and launder the break behind a new valid-looking chain (M7, was I217).
|
|
129
|
+
// Instead, quarantine the chain for this session (disable hash chaining) and
|
|
130
|
+
// surface a security-level warning. The "corruption detected" wording is also
|
|
131
|
+
// relied upon by tests/audit-logger.test.ts.
|
|
132
|
+
logger.warning(`audit log chain corruption detected in ${this.currentLogFile}: ${err instanceof Error ? err.message : String(err)}. Hash chain quarantined for this session.`);
|
|
133
|
+
this.disableHashChainForSession();
|
|
105
134
|
this.previousHash = "GENESIS";
|
|
106
135
|
}
|
|
107
136
|
}
|
|
108
137
|
// If today's file has no content yet, link the chain from the previous day's
|
|
109
138
|
// last hash so cross-day gaps cannot be exploited by replacing a whole day's file.
|
|
110
|
-
|
|
139
|
+
// Skip this if the chain has been quarantined (M7) so a corrupted session does not
|
|
140
|
+
// re-link to a previous hash and produce a fresh valid-looking chain.
|
|
141
|
+
if (this.config.hashChainEnabled && this.previousHash === "GENESIS") {
|
|
111
142
|
const prevHash = this.findPreviousDayLastHash(today);
|
|
112
143
|
if (prevHash) {
|
|
113
144
|
this.previousHash = prevHash;
|
|
@@ -156,8 +187,12 @@ export class AuditLogger {
|
|
|
156
187
|
cleanOldLogs() {
|
|
157
188
|
try {
|
|
158
189
|
const files = fs.readdirSync(this.config.logDir);
|
|
190
|
+
// Filenames are UTC dates (toISOString) and new Date("YYYY-MM-DD") parses as
|
|
191
|
+
// UTC midnight, so compute the cutoff at UTC midnight too — using local
|
|
192
|
+
// setDate/getDate would skew the comparison by up to a day near TZ boundaries (L13).
|
|
159
193
|
const cutoffDate = new Date();
|
|
160
|
-
cutoffDate.
|
|
194
|
+
cutoffDate.setUTCHours(0, 0, 0, 0);
|
|
195
|
+
cutoffDate.setUTCDate(cutoffDate.getUTCDate() - this.config.retentionDays);
|
|
161
196
|
for (const file of files) {
|
|
162
197
|
if (!file.startsWith("audit-") || !file.endsWith(".jsonl"))
|
|
163
198
|
continue;
|
|
@@ -197,13 +232,26 @@ export class AuditLogger {
|
|
|
197
232
|
const sanitized = {};
|
|
198
233
|
for (const [key, value] of Object.entries(details)) {
|
|
199
234
|
const lowerKey = key.toLowerCase();
|
|
200
|
-
// Skip sensitive keys entirely
|
|
201
|
-
|
|
235
|
+
// Skip sensitive keys entirely. Anchored to exact key names (L14) so benign keys
|
|
236
|
+
// like author / keywords / tokenCount / monkey are no longer stomped to [REDACTED]
|
|
237
|
+
// by a loose substring match. The bare `auth` key is kept as an exact alternative so
|
|
238
|
+
// we retain full parity with the old loose regex (which matched `auth`) — `author`
|
|
239
|
+
// etc. are not exactly "auth" so they still pass through. accessToken / refreshToken
|
|
240
|
+
// / secretKey etc. are NOT matched here on purpose — their string values are still
|
|
241
|
+
// caught by the broad substring net in the string-value branch below, which we
|
|
242
|
+
// deliberately keep loose so real compound-named secrets do not leak.
|
|
243
|
+
if (/^(password|secret|token|api_?key|credential|auth|authorization)$/i.test(key)) {
|
|
202
244
|
sanitized[key] = "[REDACTED]";
|
|
203
245
|
continue;
|
|
204
246
|
}
|
|
205
247
|
// Sanitize string values
|
|
206
248
|
if (typeof value === "string") {
|
|
249
|
+
// Intentionally broad (substring) safety net: this is what keeps camelCase
|
|
250
|
+
// compound secret keys (accessToken, refreshToken, secretKey, authToken) redacted
|
|
251
|
+
// now that the key-path above is exact-match (L14). Accepted tradeoff: a benign
|
|
252
|
+
// key holding a long (>8 char) string and containing one of these substrings
|
|
253
|
+
// (e.g. "keywords", "monkey") is still redacted here — preferred over leaking a
|
|
254
|
+
// real secret.
|
|
207
255
|
if (value.length > 8 &&
|
|
208
256
|
/password|token|secret|key|credential/.test(lowerKey)) {
|
|
209
257
|
sanitized[key] = "[REDACTED]";
|
|
@@ -237,23 +285,35 @@ export class AuditLogger {
|
|
|
237
285
|
return;
|
|
238
286
|
}
|
|
239
287
|
const logFile = this.getLogFilePathForTimestamp(event.timestamp);
|
|
240
|
-
const line = `${JSON.stringify(event)}\n`;
|
|
241
288
|
try {
|
|
242
289
|
await withLock(logFile, async () => {
|
|
243
290
|
if (!this.pendingEvents.includes(event)) {
|
|
244
291
|
return;
|
|
245
292
|
}
|
|
293
|
+
// Stamp the chain link and compute the hash inside the serialized critical section
|
|
294
|
+
// so the pointer advances atomically per event in write order (H20). Computing this
|
|
295
|
+
// at log() time would let concurrent calls share a previousHash and fork the chain.
|
|
296
|
+
if (this.config.hashChainEnabled) {
|
|
297
|
+
event.previousHash = this.previousHash;
|
|
298
|
+
const { hash: _ignored, ...eventWithoutHash } = event;
|
|
299
|
+
event.hash = this.computeHash(eventWithoutHash);
|
|
300
|
+
}
|
|
301
|
+
const line = `${JSON.stringify(event)}\n`;
|
|
246
302
|
this.currentLogFile = logFile;
|
|
247
303
|
appendFileSecure(logFile, line, PERMISSION_MODES.OWNER_READ_WRITE);
|
|
248
304
|
this.pendingEvents = this.pendingEvents.filter((pendingEvent) => pendingEvent !== event);
|
|
249
305
|
// Advance the chain pointer only after the write physically succeeds (I228)
|
|
250
306
|
if (this.config.hashChainEnabled && event.hash) {
|
|
251
307
|
this.previousHash = event.hash;
|
|
308
|
+
// Anchor the latest hash externally after it advances (M6).
|
|
309
|
+
this.writeCheckpoint(event.hash);
|
|
252
310
|
}
|
|
253
311
|
});
|
|
254
312
|
// Fan-out to subscribers after successful write (I244)
|
|
255
313
|
for (const sub of this.eventSubscribers) {
|
|
256
|
-
|
|
314
|
+
// Fire-and-forget so a slow/failing SIEM/compliance subscriber never blocks
|
|
315
|
+
// audit writes, but surface the failure at debug level so it is observable (L12).
|
|
316
|
+
sub(event).catch(err => logger.debug(`audit-logger: subscriber fan-out error: ${err instanceof Error ? err.message : String(err)}`));
|
|
257
317
|
}
|
|
258
318
|
}
|
|
259
319
|
catch (error) {
|
|
@@ -278,23 +338,20 @@ export class AuditLogger {
|
|
|
278
338
|
const sanitizedDetails = this.config.includeDetails
|
|
279
339
|
? this.sanitizeDetails(details)
|
|
280
340
|
: {};
|
|
281
|
-
|
|
341
|
+
// The previousHash and hash are NOT computed here. Concurrent log() calls would
|
|
342
|
+
// otherwise read the same this.previousHash before any write completes and fork the
|
|
343
|
+
// chain. Instead they are assigned inside flushEvent's serialized critical section, in
|
|
344
|
+
// write order, so the chain pointer advances atomically per event (H20).
|
|
345
|
+
const event = {
|
|
282
346
|
timestamp: new Date().toISOString(),
|
|
283
347
|
eventType,
|
|
284
348
|
eventName,
|
|
285
349
|
success,
|
|
286
350
|
duration_ms,
|
|
287
351
|
details: sanitizedDetails,
|
|
288
|
-
previousHash:
|
|
352
|
+
previousHash: "",
|
|
353
|
+
hash: "",
|
|
289
354
|
};
|
|
290
|
-
const hash = this.config.hashChainEnabled
|
|
291
|
-
? this.computeHash(eventWithoutHash)
|
|
292
|
-
: "";
|
|
293
|
-
const event = {
|
|
294
|
-
...eventWithoutHash,
|
|
295
|
-
hash,
|
|
296
|
-
};
|
|
297
|
-
// previousHash is updated inside flushEvent after the write succeeds (I228)
|
|
298
355
|
await this.writeEvent(event);
|
|
299
356
|
}
|
|
300
357
|
// ============================================================================
|
|
@@ -389,8 +446,21 @@ export class AuditLogger {
|
|
|
389
446
|
*/
|
|
390
447
|
summarizeArgs(args) {
|
|
391
448
|
const summary = {};
|
|
449
|
+
// M8: free-text fields from compliance tools (report_security_incident
|
|
450
|
+
// title/description, request_data_erasure reason, submit_dsar details) carry
|
|
451
|
+
// user-supplied PII. sanitizeDetails only redacts by KEY name and short values pass
|
|
452
|
+
// through verbatim, so these would persist in the audit log for the 2555-day
|
|
453
|
+
// retention. Hash + length-stamp them here (the single choke point for all tool
|
|
454
|
+
// calls) so the audit record stays useful (correlatable, length known) without
|
|
455
|
+
// storing raw PII.
|
|
456
|
+
const FREE_TEXT_PII = /^(description|reason|details|title)$/i;
|
|
392
457
|
for (const [key, value] of Object.entries(args)) {
|
|
393
458
|
if (typeof value === "string") {
|
|
459
|
+
if (FREE_TEXT_PII.test(key)) {
|
|
460
|
+
const digest = crypto.createHash("sha256").update(value).digest("hex").slice(0, 16);
|
|
461
|
+
summary[key] = `[redacted PII, ${value.length} chars, sha256:${digest}]`;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
394
464
|
// Log length for long strings, actual value for short ones
|
|
395
465
|
if (value.length > 100) {
|
|
396
466
|
summary[key] = `[string, ${value.length} chars]`;
|
|
@@ -467,6 +537,31 @@ export class AuditLogger {
|
|
|
467
537
|
errors.push(`Line ${i + 1}: Invalid JSON`);
|
|
468
538
|
}
|
|
469
539
|
}
|
|
540
|
+
// M6: verify against the external tamper anchor. Log-file-scoped tampering that
|
|
541
|
+
// recomputes a self-consistent chain but does not also update the out-of-dir
|
|
542
|
+
// sidecar is caught here; broad filesystem tampering is caught only when an HMAC
|
|
543
|
+
// key (NLMCP_AUDIT_CHECKPOINT_KEY) is configured and held out of reach.
|
|
544
|
+
// Tolerate a missing checkpoint (first run / arbitrary historical file) — only
|
|
545
|
+
// flag when a checkpoint exists, so this never spuriously fails a clean log.
|
|
546
|
+
if (this.config.hashChainEnabled && lines.length > 0) {
|
|
547
|
+
const checkpoint = this.readCheckpoint();
|
|
548
|
+
if (checkpoint) {
|
|
549
|
+
// Only anchor-check the live current-day file: the checkpoint tracks the
|
|
550
|
+
// latest hash written, which belongs to the most recent file.
|
|
551
|
+
const isCurrentFile = path.resolve(file) === path.resolve(this.currentLogFile);
|
|
552
|
+
if (isCurrentFile) {
|
|
553
|
+
if (this.checkpointKey) {
|
|
554
|
+
const expectedSig = this.signCheckpoint(checkpoint.hash);
|
|
555
|
+
if (!checkpoint.signature || checkpoint.signature !== expectedSig) {
|
|
556
|
+
errors.push("Tamper anchor: checkpoint signature invalid (checkpoint may have been forged or key changed).");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (checkpoint.hash !== expectedPreviousHash) {
|
|
560
|
+
errors.push(`Tamper anchor: external checkpoint hash does not match log tail. Expected ${checkpoint.hash}, log ends at ${expectedPreviousHash}. The log may have been rewritten.`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
470
565
|
return { valid: errors.length === 0, errors };
|
|
471
566
|
}
|
|
472
567
|
catch (e) {
|
|
@@ -483,6 +578,51 @@ export class AuditLogger {
|
|
|
483
578
|
const date = timestamp.split("T")[0];
|
|
484
579
|
return path.join(this.config.logDir, `audit-${date}.jsonl`);
|
|
485
580
|
}
|
|
581
|
+
// ============================================================================
|
|
582
|
+
// M6: external tamper-anchor checkpoint
|
|
583
|
+
// ============================================================================
|
|
584
|
+
/** Compute the HMAC signature for a checkpoint hash, or null when no key is set. */
|
|
585
|
+
signCheckpoint(hash) {
|
|
586
|
+
if (!this.checkpointKey)
|
|
587
|
+
return null;
|
|
588
|
+
return crypto.createHmac("sha256", this.checkpointKey).update(hash).digest("hex");
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Persist the latest chain hash to the external checkpoint (outside the log dir).
|
|
592
|
+
* Best-effort: a failure here must never break audit writes.
|
|
593
|
+
*/
|
|
594
|
+
writeCheckpoint(hash) {
|
|
595
|
+
if (!this.config.hashChainEnabled || !hash || hash === "GENESIS")
|
|
596
|
+
return;
|
|
597
|
+
try {
|
|
598
|
+
const payload = {
|
|
599
|
+
hash,
|
|
600
|
+
updatedAt: new Date().toISOString(),
|
|
601
|
+
};
|
|
602
|
+
const signature = this.signCheckpoint(hash);
|
|
603
|
+
if (signature)
|
|
604
|
+
payload.signature = signature;
|
|
605
|
+
fs.writeFileSync(this.checkpointPath, JSON.stringify(payload), { mode: 0o600 });
|
|
606
|
+
}
|
|
607
|
+
catch (err) {
|
|
608
|
+
logger.debug(`audit-logger: writing tamper-anchor checkpoint: ${err instanceof Error ? err.message : String(err)}`);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/** Read the external checkpoint, returning null if absent or unreadable. */
|
|
612
|
+
readCheckpoint() {
|
|
613
|
+
try {
|
|
614
|
+
if (!fs.existsSync(this.checkpointPath))
|
|
615
|
+
return null;
|
|
616
|
+
const parsed = JSON.parse(fs.readFileSync(this.checkpointPath, "utf-8"));
|
|
617
|
+
if (typeof parsed.hash !== "string" || parsed.hash.length === 0)
|
|
618
|
+
return null;
|
|
619
|
+
return { hash: parsed.hash, signature: parsed.signature };
|
|
620
|
+
}
|
|
621
|
+
catch (err) {
|
|
622
|
+
logger.debug(`audit-logger: reading tamper-anchor checkpoint: ${err instanceof Error ? err.message : String(err)}`);
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
486
626
|
disableHashChainForSession() {
|
|
487
627
|
if (!this.hashChainWarningLogged) {
|
|
488
628
|
logger.warning(AuditLogger.MISSING_HASH_WARNING);
|
|
@@ -507,9 +647,19 @@ export class AuditLogger {
|
|
|
507
647
|
process.on("beforeExit", () => {
|
|
508
648
|
AuditLogger.flushAllSync();
|
|
509
649
|
});
|
|
650
|
+
// Mirror SIGTERM for SIGINT (Ctrl-C) and SIGHUP so buffered audit events are
|
|
651
|
+
// flushed synchronously on those signals too (M5). The process entry point owns
|
|
652
|
+
// termination (it calls process.exit after its own async shutdown), so these are
|
|
653
|
+
// additive flush-only safety nets and do not suppress termination or hang.
|
|
510
654
|
process.on("SIGTERM", () => {
|
|
511
655
|
AuditLogger.flushAllSync();
|
|
512
656
|
});
|
|
657
|
+
process.on("SIGINT", () => {
|
|
658
|
+
AuditLogger.flushAllSync();
|
|
659
|
+
});
|
|
660
|
+
process.on("SIGHUP", () => {
|
|
661
|
+
AuditLogger.flushAllSync();
|
|
662
|
+
});
|
|
513
663
|
AuditLogger.processHandlersRegistered = true;
|
|
514
664
|
}
|
|
515
665
|
static flushAllSync() {
|
|
@@ -521,6 +671,19 @@ export class AuditLogger {
|
|
|
521
671
|
if (!this.config.enabled || this.pendingEvents.length === 0) {
|
|
522
672
|
return;
|
|
523
673
|
}
|
|
674
|
+
// Re-chain the batch in write order before serializing. Buffered events were created
|
|
675
|
+
// with empty previousHash/hash (those are stamped inside flushEvent's lock on the async
|
|
676
|
+
// path); on the shutdown path we must stamp them here, advancing the running pointer
|
|
677
|
+
// per event, or the chain forks. Uses the same computeHash as the normal path so
|
|
678
|
+
// verifyIntegrity passes (H20).
|
|
679
|
+
if (this.config.hashChainEnabled) {
|
|
680
|
+
for (const event of this.pendingEvents) {
|
|
681
|
+
event.previousHash = this.previousHash;
|
|
682
|
+
const { hash: _ignored, ...eventWithoutHash } = event;
|
|
683
|
+
event.hash = this.computeHash(eventWithoutHash);
|
|
684
|
+
this.previousHash = event.hash;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
524
687
|
const groupedEvents = new Map();
|
|
525
688
|
for (const event of this.pendingEvents) {
|
|
526
689
|
const logFile = this.getLogFilePathForTimestamp(event.timestamp);
|
|
@@ -539,6 +702,10 @@ export class AuditLogger {
|
|
|
539
702
|
}
|
|
540
703
|
this.currentLogFile = logFile;
|
|
541
704
|
}
|
|
705
|
+
// Anchor the final advanced hash externally on the shutdown path too (M6).
|
|
706
|
+
if (this.config.hashChainEnabled && this.previousHash && this.previousHash !== "GENESIS") {
|
|
707
|
+
this.writeCheckpoint(this.previousHash);
|
|
708
|
+
}
|
|
542
709
|
this.pendingEvents = [];
|
|
543
710
|
}
|
|
544
711
|
writeWithSyncLock(logFile, lines) {
|
|
@@ -567,7 +734,9 @@ export class AuditLogger {
|
|
|
567
734
|
try {
|
|
568
735
|
const content = fs.readFileSync(lockPath, "utf-8");
|
|
569
736
|
const existing = JSON.parse(content);
|
|
570
|
-
|
|
737
|
+
// Use the shared stale-lock threshold (L15) so this sync shutdown path and the
|
|
738
|
+
// async FileLock util agree on staleness for locks on the SAME audit files.
|
|
739
|
+
if (typeof existing.timestamp === "number" && Date.now() - existing.timestamp > STALE_LOCK_THRESHOLD_MS) {
|
|
571
740
|
fs.unlinkSync(lockPath);
|
|
572
741
|
continue;
|
|
573
742
|
}
|
|
@@ -631,4 +800,3 @@ export const audit = {
|
|
|
631
800
|
configChange: (setting, oldValue, newValue, changedBy) => getAuditLogger().logConfigChange(setting, oldValue, newValue, changedBy),
|
|
632
801
|
retention: (action, dataType, count, details) => getAuditLogger().logRetentionEvent(action, dataType, count, details),
|
|
633
802
|
};
|
|
634
|
-
//# sourceMappingURL=audit-logger.js.map
|
package/dist/utils/crypto.d.ts
CHANGED
|
@@ -57,20 +57,23 @@ interface ClassicalEncryptedData {
|
|
|
57
57
|
version: number;
|
|
58
58
|
algorithm: string;
|
|
59
59
|
nonce: string;
|
|
60
|
-
salt
|
|
60
|
+
salt?: string;
|
|
61
61
|
ciphertext: string;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Thrown when an encrypted file exists but cannot be decrypted (e.g. wrong
|
|
65
|
+
* key after rotation, corruption, or tampering). Distinct from a genuinely
|
|
66
|
+
* absent file (load() returns null), so callers can avoid overwriting
|
|
67
|
+
* good-but-undecryptable state.
|
|
65
68
|
*/
|
|
66
|
-
export declare
|
|
69
|
+
export declare class DecryptionError extends Error {
|
|
70
|
+
readonly file: string;
|
|
71
|
+
constructor(message: string, file: string);
|
|
72
|
+
}
|
|
67
73
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Note: This provides obscurity, not true security. It's a fallback
|
|
71
|
-
* when no user key is provided.
|
|
74
|
+
* Derive a key from a passphrase using PBKDF2
|
|
72
75
|
*/
|
|
73
|
-
export declare function
|
|
76
|
+
export declare function deriveKey(passphrase: string, salt: Buffer, iterations?: number): Buffer;
|
|
74
77
|
export declare function getOrCreateMachineKey(keyPath: string): Buffer;
|
|
75
78
|
/**
|
|
76
79
|
* Generate ML-KEM key pair for post-quantum encryption
|
|
@@ -114,6 +117,13 @@ export declare class SecureStorage {
|
|
|
114
117
|
private pqKeyPair;
|
|
115
118
|
private initialized;
|
|
116
119
|
private keyStorePath;
|
|
120
|
+
/**
|
|
121
|
+
* Captured at construction, before config.enabled can be mutated by
|
|
122
|
+
* initialize()/initializeClassicalKey(). Records whether the caller
|
|
123
|
+
* actually intended encryption. Used to fail closed: if encryption was
|
|
124
|
+
* expected but is unavailable, we refuse to write plaintext.
|
|
125
|
+
*/
|
|
126
|
+
private readonly encryptionExpected;
|
|
117
127
|
constructor(config?: Partial<EncryptionConfig>);
|
|
118
128
|
/**
|
|
119
129
|
* Initialize the secure storage (derive/load keys)
|
|
@@ -175,4 +185,3 @@ export declare class SecureStorage {
|
|
|
175
185
|
*/
|
|
176
186
|
export declare function getSecureStorage(): SecureStorage;
|
|
177
187
|
export {};
|
|
178
|
-
//# sourceMappingURL=crypto.d.ts.map
|