@harperfast/harper 5.2.9 → 5.3.0-alpha.1
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/agent/mcpTools.ts +1 -1
- package/agent/session.ts +25 -14
- package/bin/cliOperations.ts +46 -9
- package/bin/copyDb.ts +282 -59
- package/bin/deploySetup.ts +16 -5
- package/bin/harper.ts +1 -1
- package/bin/help.ts +4 -1
- package/bin/lite.ts +4 -1
- package/bin/restart.ts +59 -3
- package/bin/run.ts +6 -11
- package/bin/upgrade.js +7 -3
- package/bin/workloadIdentity.ts +119 -0
- package/components/Application.ts +2414 -242
- package/components/ApplicationScope.ts +8 -0
- package/components/EntryHandler.ts +59 -39
- package/components/OptionsWatcher.ts +150 -74
- package/components/RuntimeModuleTracker.ts +38 -7
- package/components/Scope.ts +37 -15
- package/components/awaitRestart.ts +84 -0
- package/components/componentLoader.ts +340 -30
- package/components/componentPreparationLock.ts +16 -5
- package/components/mcp/adapters/harperHttp.ts +4 -0
- package/components/mcp/listChanged.ts +4 -0
- package/components/mcp/toolRegistry.ts +2 -0
- package/components/mcp/tools/operations.ts +9 -0
- package/components/mcp/tools/schemas/operationDescriptions.ts +2 -2
- package/components/operations.js +270 -78
- package/components/operationsValidation.js +49 -1
- package/components/status/ComponentStatusRegistry.ts +59 -0
- package/config/RootConfigWatcher.ts +80 -34
- package/config/configUtils.ts +291 -34
- package/config/harperConfigEnvVars.ts +170 -27
- package/config-root.schema.json +29 -0
- package/dataLayer/blobBackup.ts +160 -50
- package/dataLayer/delete.ts +6 -1
- package/dataLayer/harperBridge/ResourceBridge.ts +52 -8
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +3 -1
- package/dataLayer/hdbInfoController.ts +34 -1
- package/dataLayer/insert.ts +44 -1
- package/dataLayer/rocksdbBackup.ts +53 -10
- package/dataLayer/schema.ts +11 -1
- package/dataLayer/schemaDescribe.ts +8 -1
- package/dist/agent/mcpTools.js +1 -1
- package/dist/agent/mcpTools.js.map +1 -1
- package/dist/agent/session.d.ts +22 -0
- package/dist/agent/session.js +26 -15
- package/dist/agent/session.js.map +1 -1
- package/dist/bin/cliOperations.js +48 -9
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/copyDb.d.ts +12 -1
- package/dist/bin/copyDb.js +248 -60
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/deploySetup.d.ts +2 -0
- package/dist/bin/deploySetup.js +11 -3
- package/dist/bin/deploySetup.js.map +1 -1
- package/dist/bin/harper.js +1 -1
- package/dist/bin/harper.js.map +1 -1
- package/dist/bin/help.js +4 -1
- package/dist/bin/help.js.map +1 -1
- package/dist/bin/lite.js +4 -1
- package/dist/bin/lite.js.map +1 -1
- package/dist/bin/restart.js +54 -5
- package/dist/bin/restart.js.map +1 -1
- package/dist/bin/run.js +4 -10
- package/dist/bin/run.js.map +1 -1
- package/dist/bin/upgrade.js +4 -3
- package/dist/bin/upgrade.js.map +1 -1
- package/dist/bin/workloadIdentity.d.ts +18 -0
- package/dist/bin/workloadIdentity.js +100 -0
- package/dist/bin/workloadIdentity.js.map +1 -0
- package/dist/components/Application.d.ts +139 -16
- package/dist/components/Application.js +2215 -267
- package/dist/components/Application.js.map +1 -1
- package/dist/components/ApplicationScope.d.ts +8 -0
- package/dist/components/ApplicationScope.js +7 -0
- package/dist/components/ApplicationScope.js.map +1 -1
- package/dist/components/EntryHandler.js +26 -10
- package/dist/components/EntryHandler.js.map +1 -1
- package/dist/components/OptionsWatcher.d.ts +1 -0
- package/dist/components/OptionsWatcher.js +141 -74
- package/dist/components/OptionsWatcher.js.map +1 -1
- package/dist/components/RuntimeModuleTracker.js +40 -6
- package/dist/components/RuntimeModuleTracker.js.map +1 -1
- package/dist/components/Scope.js +38 -13
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/awaitRestart.d.ts +33 -0
- package/dist/components/awaitRestart.js +61 -0
- package/dist/components/awaitRestart.js.map +1 -0
- package/dist/components/componentLoader.d.ts +38 -1
- package/dist/components/componentLoader.js +279 -22
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/componentPreparationLock.d.ts +5 -0
- package/dist/components/componentPreparationLock.js +14 -6
- package/dist/components/componentPreparationLock.js.map +1 -1
- package/dist/components/mcp/adapters/harperHttp.js +4 -0
- package/dist/components/mcp/adapters/harperHttp.js.map +1 -1
- package/dist/components/mcp/listChanged.js +5 -0
- package/dist/components/mcp/listChanged.js.map +1 -1
- package/dist/components/mcp/toolRegistry.d.ts +1 -0
- package/dist/components/mcp/toolRegistry.js.map +1 -1
- package/dist/components/mcp/tools/operations.d.ts +5 -0
- package/dist/components/mcp/tools/operations.js +9 -0
- package/dist/components/mcp/tools/operations.js.map +1 -1
- package/dist/components/mcp/tools/schemas/operationDescriptions.js +2 -2
- package/dist/components/mcp/tools/schemas/operationDescriptions.js.map +1 -1
- package/dist/components/operations.js +231 -77
- package/dist/components/operations.js.map +1 -1
- package/dist/components/operationsValidation.js +49 -1
- package/dist/components/operationsValidation.js.map +1 -1
- package/dist/components/status/ComponentStatusRegistry.d.ts +0 -4
- package/dist/components/status/ComponentStatusRegistry.js +63 -0
- package/dist/components/status/ComponentStatusRegistry.js.map +1 -1
- package/dist/config/RootConfigWatcher.d.ts +7 -1
- package/dist/config/RootConfigWatcher.js +64 -27
- package/dist/config/RootConfigWatcher.js.map +1 -1
- package/dist/config/configUtils.d.ts +9 -1
- package/dist/config/configUtils.js +254 -33
- package/dist/config/configUtils.js.map +1 -1
- package/dist/config/harperConfigEnvVars.d.ts +16 -0
- package/dist/config/harperConfigEnvVars.js +162 -25
- package/dist/config/harperConfigEnvVars.js.map +1 -1
- package/dist/dataLayer/blobBackup.d.ts +49 -20
- package/dist/dataLayer/blobBackup.js +139 -50
- package/dist/dataLayer/blobBackup.js.map +1 -1
- package/dist/dataLayer/delete.js +1 -1
- package/dist/dataLayer/delete.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +14 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.js +51 -10
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.d.ts +3 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +3 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js.map +1 -1
- package/dist/dataLayer/hdbInfoController.d.ts +10 -0
- package/dist/dataLayer/hdbInfoController.js +30 -1
- package/dist/dataLayer/hdbInfoController.js.map +1 -1
- package/dist/dataLayer/insert.d.ts +9 -1
- package/dist/dataLayer/insert.js +30 -0
- package/dist/dataLayer/insert.js.map +1 -1
- package/dist/dataLayer/rocksdbBackup.d.ts +2 -2
- package/dist/dataLayer/rocksdbBackup.js +45 -8
- package/dist/dataLayer/rocksdbBackup.js.map +1 -1
- package/dist/dataLayer/schema.js +8 -0
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.js +8 -1
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +52 -0
- package/dist/resources/DatabaseTransaction.d.ts +55 -0
- package/dist/resources/DatabaseTransaction.js +459 -45
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/LMDBTransaction.js +22 -4
- package/dist/resources/LMDBTransaction.js.map +1 -1
- package/dist/resources/PrimaryRocksDatabase.d.ts +1 -0
- package/dist/resources/PrimaryRocksDatabase.js +29 -0
- package/dist/resources/PrimaryRocksDatabase.js.map +1 -1
- package/dist/resources/RecordEncoder.d.ts +20 -0
- package/dist/resources/RecordEncoder.js +94 -9
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/RequestTarget.d.ts +2 -0
- package/dist/resources/RequestTarget.js.map +1 -1
- package/dist/resources/Resource.js +20 -11
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +20 -1
- package/dist/resources/ResourceInterface.js.map +1 -1
- package/dist/resources/RocksIndexStore.d.ts +6 -1
- package/dist/resources/RocksIndexStore.js +24 -9
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/RocksTransactionLogStore.d.ts +14 -1
- package/dist/resources/RocksTransactionLogStore.js +57 -17
- package/dist/resources/RocksTransactionLogStore.js.map +1 -1
- package/dist/resources/Table.d.ts +112 -8
- package/dist/resources/Table.js +1073 -191
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/auditStore.d.ts +11 -2
- package/dist/resources/auditStore.js +325 -71
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/blob.d.ts +129 -9
- package/dist/resources/blob.js +992 -114
- package/dist/resources/blob.js.map +1 -1
- package/dist/resources/branchDatabase.d.ts +48 -0
- package/dist/resources/branchDatabase.js +892 -0
- package/dist/resources/branchDatabase.js.map +1 -0
- package/dist/resources/crdt.js +50 -12
- package/dist/resources/crdt.js.map +1 -1
- package/dist/resources/databases.d.ts +150 -0
- package/dist/resources/databases.js +1200 -239
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/defineTable.d.ts +10 -2
- package/dist/resources/defineTable.js +9 -1
- package/dist/resources/defineTable.js.map +1 -1
- package/dist/resources/graphql.d.ts +1 -1
- package/dist/resources/graphql.js +50 -15
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +1 -0
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +6 -2
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/resources/longLivedTransactions.d.ts +71 -0
- package/dist/resources/longLivedTransactions.js +358 -0
- package/dist/resources/longLivedTransactions.js.map +1 -0
- package/dist/resources/models/backendRegistry.d.ts +26 -0
- package/dist/resources/models/backendRegistry.js +60 -2
- package/dist/resources/models/backendRegistry.js.map +1 -1
- package/dist/resources/models/bootstrap.d.ts +33 -1
- package/dist/resources/models/bootstrap.js +416 -31
- package/dist/resources/models/bootstrap.js.map +1 -1
- package/dist/resources/recordLock.d.ts +80 -0
- package/dist/resources/recordLock.js +184 -0
- package/dist/resources/recordLock.js.map +1 -0
- package/dist/resources/replayLogs.d.ts +14 -1
- package/dist/resources/replayLogs.js +152 -24
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/replayLogsGuards.d.ts +94 -7
- package/dist/resources/replayLogsGuards.js +111 -7
- package/dist/resources/replayLogsGuards.js.map +1 -1
- package/dist/resources/search.js +158 -6
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/transactionBroadcast.d.ts +1 -1
- package/dist/resources/transactionBroadcast.js +2 -2
- package/dist/resources/transactionBroadcast.js.map +1 -1
- package/dist/security/auth.js +61 -30
- package/dist/security/auth.js.map +1 -1
- package/dist/security/authn/oidc/claims.d.ts +22 -0
- package/dist/security/authn/oidc/claims.js +71 -0
- package/dist/security/authn/oidc/claims.js.map +1 -0
- package/dist/security/authn/oidc/identityToken.d.ts +27 -0
- package/dist/security/authn/oidc/identityToken.js +111 -0
- package/dist/security/authn/oidc/identityToken.js.map +1 -0
- package/dist/security/authn/oidc/jwks.d.ts +25 -0
- package/dist/security/authn/oidc/jwks.js +261 -0
- package/dist/security/authn/oidc/jwks.js.map +1 -0
- package/dist/security/authn/oidc/providers/generic.d.ts +13 -0
- package/dist/security/authn/oidc/providers/generic.js +34 -0
- package/dist/security/authn/oidc/providers/generic.js.map +1 -0
- package/dist/security/authn/oidc/providers/githubActions.d.ts +11 -0
- package/dist/security/authn/oidc/providers/githubActions.js +129 -0
- package/dist/security/authn/oidc/providers/githubActions.js.map +1 -0
- package/dist/security/authn/oidc/providers/index.d.ts +37 -0
- package/dist/security/authn/oidc/providers/index.js +24 -0
- package/dist/security/authn/oidc/providers/index.js.map +1 -0
- package/dist/security/authn/oidc/tokenExchange.d.ts +12 -0
- package/dist/security/authn/oidc/tokenExchange.js +306 -0
- package/dist/security/authn/oidc/tokenExchange.js.map +1 -0
- package/dist/security/authn/oidc/trustPolicyOperations.d.ts +49 -0
- package/dist/security/authn/oidc/trustPolicyOperations.js +358 -0
- package/dist/security/authn/oidc/trustPolicyOperations.js.map +1 -0
- package/dist/security/authn/oidc/types.d.ts +38 -0
- package/dist/security/authn/oidc/types.js +6 -0
- package/dist/security/authn/oidc/types.js.map +1 -0
- package/dist/security/certificateVerification/index.js +40 -11
- package/dist/security/certificateVerification/index.js.map +1 -1
- package/dist/security/certificateVerification/trustedIssuers.d.ts +24 -0
- package/dist/security/certificateVerification/trustedIssuers.js +79 -0
- package/dist/security/certificateVerification/trustedIssuers.js.map +1 -0
- package/dist/security/certificateVerification/types.d.ts +1 -0
- package/dist/security/credentialProvenance.d.ts +35 -0
- package/dist/security/credentialProvenance.js +51 -0
- package/dist/security/credentialProvenance.js.map +1 -0
- package/dist/security/credentialRejection.d.ts +4 -0
- package/dist/security/credentialRejection.js +24 -0
- package/dist/security/credentialRejection.js.map +1 -0
- package/dist/security/deferredAuthentication.d.ts +36 -0
- package/dist/security/deferredAuthentication.js +70 -0
- package/dist/security/deferredAuthentication.js.map +1 -0
- package/dist/security/impersonation.d.ts +21 -0
- package/dist/security/impersonation.js +108 -9
- package/dist/security/impersonation.js.map +1 -1
- package/dist/security/jsLoader.d.ts +6 -0
- package/dist/security/jsLoader.js +75 -15
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.js +301 -71
- package/dist/security/keys.js.map +1 -1
- package/dist/security/operationScope.d.ts +21 -0
- package/dist/security/operationScope.js +36 -0
- package/dist/security/operationScope.js.map +1 -0
- package/dist/security/permissionsTranslator.js +21 -0
- package/dist/security/permissionsTranslator.js.map +1 -1
- package/dist/security/tokenAuthentication.d.ts +19 -1
- package/dist/security/tokenAuthentication.js +191 -10
- package/dist/security/tokenAuthentication.js.map +1 -1
- package/dist/security/user.js +4 -3
- package/dist/security/user.js.map +1 -1
- package/dist/server/DurableSubscriptionsSession.d.ts +2 -2
- package/dist/server/DurableSubscriptionsSession.js +67 -10
- package/dist/server/DurableSubscriptionsSession.js.map +1 -1
- package/dist/server/REST.js +73 -0
- package/dist/server/REST.js.map +1 -1
- package/dist/server/graphqlQuerying.js +4 -0
- package/dist/server/graphqlQuerying.js.map +1 -1
- package/dist/server/http.d.ts +11 -0
- package/dist/server/http.js +88 -15
- package/dist/server/http.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +8 -1
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/server/jobs/jobProcess.js +6 -2
- package/dist/server/jobs/jobProcess.js.map +1 -1
- package/dist/server/jobs/jobs.js +4 -1
- package/dist/server/jobs/jobs.js.map +1 -1
- package/dist/server/liveSubscriptionAuth.d.ts +26 -4
- package/dist/server/liveSubscriptionAuth.js +105 -39
- package/dist/server/liveSubscriptionAuth.js.map +1 -1
- package/dist/server/loadRootComponents.js +49 -10
- package/dist/server/loadRootComponents.js.map +1 -1
- package/dist/server/mqtt.d.ts +2 -0
- package/dist/server/mqtt.js +165 -30
- package/dist/server/mqtt.js.map +1 -1
- package/dist/server/nodeName.d.ts +2 -0
- package/dist/server/nodeName.js +107 -23
- package/dist/server/nodeName.js.map +1 -1
- package/dist/server/serverHelpers/Headers.d.ts +25 -0
- package/dist/server/serverHelpers/Headers.js +139 -1
- package/dist/server/serverHelpers/Headers.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.d.ts +9 -0
- package/dist/server/serverHelpers/contentTypes.js +32 -25
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/deployValidationState.d.ts +3 -0
- package/dist/server/serverHelpers/deployValidationState.js +9 -19
- package/dist/server/serverHelpers/deployValidationState.js.map +1 -1
- package/dist/server/serverHelpers/operationAuthorizationState.d.ts +12 -0
- package/dist/server/serverHelpers/operationAuthorizationState.js +24 -2
- package/dist/server/serverHelpers/operationAuthorizationState.js.map +1 -1
- package/dist/server/serverHelpers/registeredOperations.d.ts +5 -4
- package/dist/server/serverHelpers/registeredOperations.js +74 -21
- package/dist/server/serverHelpers/registeredOperations.js.map +1 -1
- package/dist/server/serverHelpers/requestSanitization.d.ts +11 -0
- package/dist/server/serverHelpers/requestSanitization.js +20 -0
- package/dist/server/serverHelpers/requestSanitization.js.map +1 -0
- package/dist/server/serverHelpers/serverHandlers.js +6 -3
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
- package/dist/server/serverHelpers/serverUtilities.d.ts +18 -0
- package/dist/server/serverHelpers/serverUtilities.js +90 -20
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/server/serverHelpers/sharedMessageEncoding.d.ts +67 -0
- package/dist/server/serverHelpers/sharedMessageEncoding.js +280 -0
- package/dist/server/serverHelpers/sharedMessageEncoding.js.map +1 -0
- package/dist/server/serverHelpers/uwsServer.js +19 -1
- package/dist/server/serverHelpers/uwsServer.js.map +1 -1
- package/dist/server/static.js +24 -28
- package/dist/server/static.js.map +1 -1
- package/dist/server/storageReclamation.d.ts +12 -0
- package/dist/server/storageReclamation.js +26 -0
- package/dist/server/storageReclamation.js.map +1 -1
- package/dist/server/threads/itc.d.ts +7 -2
- package/dist/server/threads/itc.js +5 -1
- package/dist/server/threads/itc.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +26 -3
- package/dist/server/threads/manageThreads.js +517 -65
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/socketRouter.js +89 -26
- package/dist/server/threads/socketRouter.js.map +1 -1
- package/dist/server/threads/threadHeapMemory.d.ts +2 -0
- package/dist/server/threads/threadHeapMemory.js +31 -0
- package/dist/server/threads/threadHeapMemory.js.map +1 -0
- package/dist/server/threads/threadServer.js +46 -15
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/sqlEngine/config.d.ts +1 -3
- package/dist/sqlEngine/config.js +19 -16
- package/dist/sqlEngine/config.js.map +1 -1
- package/dist/sqlTranslator/index.d.ts +1 -1
- package/dist/sqlTranslator/index.js +30 -7
- package/dist/sqlTranslator/index.js.map +1 -1
- package/dist/upgrade/directives/5-3-0.d.ts +7 -0
- package/dist/upgrade/directives/5-3-0.js +148 -0
- package/dist/upgrade/directives/5-3-0.js.map +1 -0
- package/dist/upgrade/directives/directivesController.js +2 -1
- package/dist/upgrade/directives/directivesController.js.map +1 -1
- package/dist/utility/OperationFunctionCaller.js +2 -1
- package/dist/utility/OperationFunctionCaller.js.map +1 -1
- package/dist/utility/common_utils.d.ts +16 -0
- package/dist/utility/common_utils.js +32 -6
- package/dist/utility/common_utils.js.map +1 -1
- package/dist/utility/componentNames.d.ts +8 -0
- package/dist/utility/componentNames.js +12 -1
- package/dist/utility/componentNames.js.map +1 -1
- package/dist/utility/environment/environmentManager.js +3 -6
- package/dist/utility/environment/environmentManager.js.map +1 -1
- package/dist/utility/environment/systemInformation.d.ts +1 -0
- package/dist/utility/environment/systemInformation.js +1 -0
- package/dist/utility/environment/systemInformation.js.map +1 -1
- package/dist/utility/errors/commonErrors.d.ts +2 -0
- package/dist/utility/errors/commonErrors.js +2 -0
- package/dist/utility/errors/commonErrors.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +17 -0
- package/dist/utility/errors/hdbError.js +30 -1
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/globalSchema.d.ts +18 -0
- package/dist/utility/hdbTerms.d.ts +16 -0
- package/dist/utility/hdbTerms.js +18 -2
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/logging/harper_logger.d.ts +2 -0
- package/dist/utility/logging/harper_logger.js +91 -14
- package/dist/utility/logging/harper_logger.js.map +1 -1
- package/dist/utility/logging/logRotator.js +76 -49
- package/dist/utility/logging/logRotator.js.map +1 -1
- package/dist/utility/nodeIdentity.d.ts +9 -0
- package/dist/utility/nodeIdentity.js +58 -0
- package/dist/utility/nodeIdentity.js.map +1 -0
- package/dist/utility/npmUtilities.js +9 -7
- package/dist/utility/npmUtilities.js.map +1 -1
- package/dist/utility/operationPermissions.d.ts +3 -1
- package/dist/utility/operationPermissions.js +16 -1
- package/dist/utility/operationPermissions.js.map +1 -1
- package/dist/utility/operation_authorization.d.ts +10 -7
- package/dist/utility/operation_authorization.js +212 -41
- package/dist/utility/operation_authorization.js.map +1 -1
- package/dist/utility/watchPath.d.ts +29 -0
- package/dist/utility/watchPath.js +68 -0
- package/dist/utility/watchPath.js.map +1 -0
- package/dist/utility/watcherFallback.d.ts +86 -0
- package/dist/utility/watcherFallback.js +278 -1
- package/dist/utility/watcherFallback.js.map +1 -1
- package/dist/validation/configValidator.d.ts +12 -0
- package/dist/validation/configValidator.js +199 -72
- package/dist/validation/configValidator.js.map +1 -1
- package/dist/validation/installValidator.js +12 -0
- package/dist/validation/installValidator.js.map +1 -1
- package/dist/validation/validationWrapper.d.ts +11 -0
- package/dist/validation/validationWrapper.js +16 -3
- package/dist/validation/validationWrapper.js.map +1 -1
- package/index.ts +2 -0
- package/json/systemSchema.json +52 -0
- package/npm-shrinkwrap.json +196 -194
- package/package.json +7 -6
- package/resources/DESIGN.md +114 -52
- package/resources/DatabaseTransaction.ts +521 -43
- package/resources/LMDBTransaction.ts +26 -4
- package/resources/PrimaryRocksDatabase.ts +28 -1
- package/resources/RecordEncoder.ts +103 -8
- package/resources/RequestTarget.ts +2 -0
- package/resources/Resource.ts +17 -9
- package/resources/ResourceInterface.ts +23 -0
- package/resources/RocksIndexStore.ts +30 -9
- package/resources/RocksTransactionLogStore.ts +78 -21
- package/resources/Table.ts +1110 -159
- package/resources/auditStore.ts +331 -73
- package/resources/blob.ts +1029 -110
- package/resources/branchDatabase.ts +941 -0
- package/resources/crdt.ts +76 -12
- package/resources/databases.ts +1310 -252
- package/resources/defineTable.ts +18 -2
- package/resources/graphql.ts +70 -16
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +6 -2
- package/resources/longLivedTransactions.ts +360 -0
- package/resources/models/backendRegistry.ts +84 -2
- package/resources/models/bootstrap.ts +473 -28
- package/resources/recordLock.ts +253 -0
- package/resources/replayLogs.ts +147 -26
- package/resources/replayLogsGuards.ts +171 -8
- package/resources/search.ts +154 -7
- package/resources/transactionBroadcast.ts +3 -3
- package/security/auth.ts +68 -29
- package/security/authn/oidc/claims.ts +72 -0
- package/security/authn/oidc/identityToken.ts +129 -0
- package/security/authn/oidc/jwks.ts +260 -0
- package/security/authn/oidc/providers/generic.ts +40 -0
- package/security/authn/oidc/providers/githubActions.ts +137 -0
- package/security/authn/oidc/providers/index.ts +52 -0
- package/security/authn/oidc/tokenExchange.ts +300 -0
- package/security/authn/oidc/trustPolicyOperations.ts +343 -0
- package/security/authn/oidc/types.ts +41 -0
- package/security/certificateVerification/index.ts +54 -13
- package/security/certificateVerification/trustedIssuers.ts +76 -0
- package/security/certificateVerification/types.ts +1 -0
- package/security/credentialProvenance.ts +47 -0
- package/security/credentialRejection.ts +22 -0
- package/security/deferredAuthentication.ts +71 -0
- package/security/impersonation.ts +117 -12
- package/security/jsLoader.ts +81 -18
- package/security/keys.ts +298 -72
- package/security/operationScope.ts +33 -0
- package/security/permissionsTranslator.js +23 -0
- package/security/tokenAuthentication.ts +233 -12
- package/security/user.ts +4 -3
- package/server/DESIGN.md +183 -16
- package/server/DurableSubscriptionsSession.ts +71 -11
- package/server/REST.ts +79 -1
- package/server/graphqlQuerying.ts +4 -0
- package/server/http.ts +99 -18
- package/server/itc/serverHandlers.js +8 -1
- package/server/jobs/jobProcess.ts +8 -2
- package/server/jobs/jobs.ts +4 -1
- package/server/liveSubscriptionAuth.ts +129 -46
- package/server/loadRootComponents.js +50 -8
- package/server/mqtt.ts +179 -38
- package/server/nodeName.ts +103 -21
- package/server/serverHelpers/Headers.ts +131 -0
- package/server/serverHelpers/contentTypes.ts +29 -21
- package/server/serverHelpers/deployValidationState.ts +24 -13
- package/server/serverHelpers/operationAuthorizationState.ts +34 -3
- package/server/serverHelpers/registeredOperations.ts +79 -22
- package/server/serverHelpers/requestSanitization.ts +15 -0
- package/server/serverHelpers/serverHandlers.js +6 -3
- package/server/serverHelpers/serverUtilities.ts +104 -31
- package/server/serverHelpers/sharedMessageEncoding.ts +307 -0
- package/server/serverHelpers/uwsServer.ts +17 -2
- package/server/static.ts +23 -29
- package/server/storageReclamation.ts +23 -0
- package/server/threads/itc.js +11 -1
- package/server/threads/manageThreads.js +526 -56
- package/server/threads/socketRouter.ts +81 -26
- package/server/threads/threadHeapMemory.ts +26 -0
- package/server/threads/threadServer.js +43 -15
- package/sqlTranslator/index.ts +31 -8
- package/studio/web/assets/Chat-BnCBegQz.js +2267 -0
- package/studio/web/assets/FloatingChat-CoDW1ySS.js +23 -0
- package/studio/web/assets/{abnfDiagram-VCTEODGH-C0_BAZyO.js → abnfDiagram-VCTEODGH-B0BebmD2.js} +1 -1
- package/studio/web/assets/{alertDialog-DIHt7Z0r.js → alertDialog-CQyAJJhl.js} +1 -1
- package/studio/web/assets/{apiToken-c3Rd-w6g.js → apiToken-Bwk5BLXW.js} +1 -1
- package/studio/web/assets/applications-DHxGi7JH.js +296 -0
- package/studio/web/assets/architecture-7GRP2DOG-LB-MLAAb.js +1 -0
- package/studio/web/assets/{architectureDiagram-5GKGNRK7-BWzrASgm.js → architectureDiagram-5GKGNRK7-7SW3GD-K.js} +1 -1
- package/studio/web/assets/authStore-C3Nfubqr.js +3 -0
- package/studio/web/assets/{blockDiagram-NRAW4CY4-BdJX9Khj.js → blockDiagram-I7D4REHJ-BqguiadH.js} +2 -2
- package/studio/web/assets/{button-DhiX-njv.js → button-BIsUKRZq.js} +2 -2
- package/studio/web/assets/{c4Diagram-UCG6FXSJ-CI6MzGmQ.js → c4Diagram-7LVT6UL2-LBNf8t_X.js} +1 -1
- package/studio/web/assets/channel-yictG-U-.js +1 -0
- package/studio/web/assets/{chevron-up-Df2c8uoU.js → chevron-up-DtKGqDn3.js} +1 -1
- package/studio/web/assets/{chunk-TEH6E4GO-P87k5mNi.js → chunk-4HAMMTFA-DWtTut21.js} +1 -1
- package/studio/web/assets/{chunk-75Z2AOVW-BT8tVmks.js → chunk-75Z2AOVW-QGQD6th2.js} +1 -1
- package/studio/web/assets/{chunk-DU6HZSFF-9kAOOmI6.js → chunk-DU6HZSFF-Chq20Ba5.js} +1 -1
- package/studio/web/assets/{chunk-F27PBJKO-BW7ao8AY.js → chunk-F27PBJKO-BVA5EPhV.js} +1 -1
- package/studio/web/assets/{chunk-GMAD6QVW-BNyXpoQO.js → chunk-GMAD6QVW-BeS7S07A.js} +1 -1
- package/studio/web/assets/{chunk-OBVCFTLP-D4wWOqDQ.js → chunk-GVQU2GXP-sbwVIQ8i.js} +1 -1
- package/studio/web/assets/{chunk-G27WJ6UU-COyLMcgK.js → chunk-IMKFNOWR-Bnh3tAVd.js} +1 -1
- package/studio/web/assets/{chunk-JQ64N6SF-Cyz1IeLf.js → chunk-L3NEJ4N5-COfUyKII.js} +1 -1
- package/studio/web/assets/chunk-OSK3NFVY-ByciRftO.js +10 -0
- package/studio/web/assets/{chunk-P2QGCYS3-DmIFY4d7.js → chunk-P2QGCYS3-CP1VhG_c.js} +1 -1
- package/studio/web/assets/{chunk-POPQ4Y6H-BPrvMyKz.js → chunk-POPQ4Y6H-ClWhhkwW.js} +1 -1
- package/studio/web/assets/{chunk-PWAF6VOD-2zB6IW9i.js → chunk-PWAF6VOD-1z1THyS5.js} +1 -1
- package/studio/web/assets/{chunk-RHFEMEQ7-2FgyI8YU.js → chunk-SHT3W25Y-LpQkMsah.js} +2 -2
- package/studio/web/assets/{chunk-SVP7TREG-FwtbH2QC.js → chunk-SVP7TREG-jtdAHw0S.js} +1 -1
- package/studio/web/assets/{chunk-LCL6LL3I-HOzK_ppE.js → chunk-TICWLB2K-VOwzetX-.js} +1 -1
- package/studio/web/assets/classDiagram-ZZMXUADV-VaEwSy_g.js +1 -0
- package/studio/web/assets/classDiagram-v2-VYDZK3BY-VaEwSy_g.js +1 -0
- package/studio/web/assets/{createLucideIcon-BKGPfjm2.js → createLucideIcon-CzW9508A.js} +1 -1
- package/studio/web/assets/{cssMode-CEN2mzSA.js → cssMode-s0cWI-_M.js} +1 -1
- package/studio/web/assets/{cynefin-OW5HDTMX-BRkpLFQV.js → cynefin-OW5HDTMX-BbdbCvub.js} +1 -1
- package/studio/web/assets/{cynefinDiagram-5FMLGOSQ-CHT1DaX6.js → cynefinDiagram-5FMLGOSQ-TP-aIqbt.js} +1 -1
- package/studio/web/assets/{dagre-3AP2YEHR-DpUXBh63.js → dagre-GXQ25YYZ-DShnGpGo.js} +1 -1
- package/studio/web/assets/{diagram-S7CK7UJ4-BuymVFZT.js → diagram-S7CK7UJ4-aoCVTtcy.js} +1 -1
- package/studio/web/assets/{diagram-UQ7AKVKN-CyP148RM.js → diagram-UQ7AKVKN-DglXtQ6x.js} +1 -1
- package/studio/web/assets/{diagram-VSXAHHWV-CoCAg3M9.js → diagram-VSXAHHWV-fhEdmkwM.js} +1 -1
- package/studio/web/assets/{diagram-VX7I27RA-BpOqCFca.js → diagram-VX7I27RA-DccVJet6.js} +1 -1
- package/studio/web/assets/{diagram-Z3DM3KII-Bfpw7Vbj.js → diagram-Z3DM3KII-D-RyJJb7.js} +1 -1
- package/studio/web/assets/{dialog-CBf0Mr1d.js → dialog-Cn2uWgD4.js} +1 -1
- package/studio/web/assets/{dist-lkA3O3eM.js → dist-DP8UjMB_.js} +1 -1
- package/studio/web/assets/{download-BtTOBem-.js → download-B5T5r7ss.js} +1 -1
- package/studio/web/assets/{ebnfDiagram-PWID7BFC-DS_6aWqL.js → ebnfDiagram-PWID7BFC-DJGpIpz_.js} +1 -1
- package/studio/web/assets/{editor-D8oDeCTL.js → editor-DNcRHK54.js} +1 -1
- package/studio/web/assets/{erDiagram-SSCWMZ5O-DJNk6Fgw.js → erDiagram-RLTQ6QDP-CIfNlgkC.js} +1 -1
- package/studio/web/assets/eventmodeling-NTZA5JFV-CLxnp2CR.js +1 -0
- package/studio/web/assets/flowDiagram-HODETNUW-BIbhmz9f.js +1 -0
- package/studio/web/assets/{ganttDiagram-EL5Y4UJY-2pOExxMY.js → ganttDiagram-EL5Y4UJY-BxToTzzD.js} +1 -1
- package/studio/web/assets/{getAnalytics-D4LKGeVy.js → getAnalytics-GHK8ORfM.js} +1 -1
- package/studio/web/assets/{gitGraph-4MIJSDKK-CH5ZxwzF.js → gitGraph-4MIJSDKK-D2s2w8lE.js} +1 -1
- package/studio/web/assets/{gitGraphDiagram-WWUBYQGX-DVIsIhbO.js → gitGraphDiagram-WWUBYQGX-Dwntd4-x.js} +1 -1
- package/studio/web/assets/{html-u3vOg7LJ.js → html-Bdssedlg.js} +1 -1
- package/studio/web/assets/{htmlMode-DyO31v-P.js → htmlMode-CoDlJ3fw.js} +1 -1
- package/studio/web/assets/{index-Cxj2_wsl.css → index-7RMEgVG1.css} +1 -1
- package/studio/web/assets/index-D6sxmFLR.js +824 -0
- package/studio/web/assets/index.lazy-tmU5BS8s.js +2 -0
- package/studio/web/assets/{info-A6RAGUB7-CPQfTnaG.js → info-A6RAGUB7-DYjkvb0C.js} +1 -1
- package/studio/web/assets/{infoDiagram-RXCK75RN-DlwLYlwm.js → infoDiagram-27XIBGKW-Bnp1FJE5.js} +1 -1
- package/studio/web/assets/{ishikawaDiagram-5VMMS53U-BRXRp29U.js → ishikawaDiagram-5VMMS53U-D9Xh2r6X.js} +1 -1
- package/studio/web/assets/{javascript-CUvxOyTC.js → javascript-B8meVSTH.js} +1 -1
- package/studio/web/assets/{journeyDiagram-EYS64GPL-B0ou8k0n.js → journeyDiagram-3NMN7TZE-CokIi6ll.js} +2 -2
- package/studio/web/assets/{jsonMode-f_IwbF3D.js → jsonMode-DpIPd35T.js} +1 -1
- package/studio/web/assets/{kanban-definition-3QL26DDD-uYg7iYzp.js → kanban-definition-UXKFOSKX-CukSFJfX.js} +1 -1
- package/studio/web/assets/{languageServices-DXtZ6rEF.js → languageServices-C_5FMJzQ.js} +1 -1
- package/studio/web/assets/{lspLanguageFeatures-B4pCF1zO.js → lspLanguageFeatures-BIzNBzPK.js} +1 -1
- package/studio/web/assets/{mermaid-parser.core-Ck-fC8b7.js → mermaid-parser.core-BlEsOWNO.js} +3 -3
- package/studio/web/assets/{mermaid.core-CP8aNNYm.js → mermaid.core-BlkGaMIH.js} +5 -5
- package/studio/web/assets/{mindmap-definition-FBJOCRG2-CgTZ-rit.js → mindmap-definition-YA3MSWOX-IprMc_0j.js} +1 -1
- package/studio/web/assets/{notifications-D3tIQ4sg.js → notifications-CQf18QKb.js} +1 -1
- package/studio/web/assets/notifications-CvZivSbh.js +1 -0
- package/studio/web/assets/{packet-AYTQ26CC-DEyoPtPb.js → packet-AYTQ26CC-Bi3V04Zi.js} +1 -1
- package/studio/web/assets/{pegDiagram-XKGWAZYB-DrD-7sD9.js → pegDiagram-XKGWAZYB-BNuPDLZY.js} +1 -1
- package/studio/web/assets/{pie-WAS4IAKB-wjj-EI1d.js → pie-WAS4IAKB-_6DoDbng.js} +1 -1
- package/studio/web/assets/{pieDiagram-E7YTZNPT-GntqDCzv.js → pieDiagram-E7YTZNPT-DqNb6Ht2.js} +1 -1
- package/studio/web/assets/{profile-DZWU7MgT.js → profile-DdOwtntb.js} +1 -1
- package/studio/web/assets/{quadrantDiagram-AXDQQJYC-0UeqXQGd.js → quadrantDiagram-AXDQQJYC-BGH9E2YR.js} +1 -1
- package/studio/web/assets/{radar-RG4KPBEZ-DFSA5h7k.js → radar-RG4KPBEZ-DDdVczcL.js} +1 -1
- package/studio/web/assets/{railroad-74A4TZTK-CaOUG9wR.js → railroad-74A4TZTK-BJUP4Jds.js} +1 -1
- package/studio/web/assets/railroad-abnf-HS5TGJTU-Bm3L1L0h.js +1 -0
- package/studio/web/assets/railroad-ebnf-LZEXJU2U-CKzLGlkw.js +1 -0
- package/studio/web/assets/railroad-peg-WCYAUIDC-S8xLjslx.js +1 -0
- package/studio/web/assets/{railroadDiagram-O6MQD6OU-yHUELZaV.js → railroadDiagram-O6MQD6OU-DGTPh2KZ.js} +1 -1
- package/studio/web/assets/{regions-CkyurXzE.js → regions-n69fwagr.js} +1 -1
- package/studio/web/assets/{register-BUyhWjBO.js → register-PfWTCXWB.js} +3 -3
- package/studio/web/assets/{requirementDiagram-EFPCY7ZU-DNEGFjuW.js → requirementDiagram-BXWQKSXE-BJnO6uLz.js} +1 -1
- package/studio/web/assets/{sankeyDiagram-P5KCCOFB-DpyAmSVR.js → sankeyDiagram-P5KCCOFB-0vSOdymH.js} +1 -1
- package/studio/web/assets/{sequenceDiagram-WJ2MYXX4-TyaT7xNk.js → sequenceDiagram-WJ2MYXX4-hETizDWE.js} +1 -1
- package/studio/web/assets/{setComponentFile-CeyKSZAa.js → setComponentFile-Bg6O7X0S.js} +1 -1
- package/studio/web/assets/{setup-D2kn7cAA.js → setup-CUx_aUDl.js} +2 -2
- package/studio/web/assets/{stateDiagram-HBIQ2CUA-CeEdTArZ.js → stateDiagram-D77RDMKH-CdYQ_KtC.js} +1 -1
- package/studio/web/assets/stateDiagram-v2-MP3YSRHH-CdKuzQMT.js +1 -0
- package/studio/web/assets/status-D7BVKqX9.js +61 -0
- package/studio/web/assets/{swimlanes-XN3QIQJK-B54FmF46.js → swimlanes-42K2YHIH-B8cHIpU4.js} +1 -1
- package/studio/web/assets/swimlanesDiagram-VR7AAH4N-DmOSJwaH.js +8 -0
- package/studio/web/assets/{tabs-B_G5zscN.js → tabs-BrHu7gJi.js} +1 -1
- package/studio/web/assets/{timeline-definition-24CTP7MA-D-a9ujbo.js → timeline-definition-24CTP7MA-BJWYSXqF.js} +1 -1
- package/studio/web/assets/{toggleHighContrast-C0UW6rI2.js → toggleHighContrast-DBSyXzMr.js} +1 -1
- package/studio/web/assets/{treeView-Q6P3EWNA-CrW_6JnS.js → treeView-Q6P3EWNA-qxe_v6CQ.js} +1 -1
- package/studio/web/assets/{treemap-WGGIJYW6-BxyYLdP_.js → treemap-WGGIJYW6-dDo97XXF.js} +1 -1
- package/studio/web/assets/{tsMode-DBC0zmDx.js → tsMode-BByKCjBS.js} +1 -1
- package/studio/web/assets/{typescript-DApRQir3.js → typescript-DDLnLpw9.js} +1 -1
- package/studio/web/assets/{useEntityRestURL-DB6JStU1.js → useEntityRestURL-31CHGaHk.js} +1 -1
- package/studio/web/assets/{useLocalStorage-Dtj1QS8_.js → useLocalStorage-BqMR3D8_.js} +1 -1
- package/studio/web/assets/vendor-core-c2JRRJpV.js +58 -0
- package/studio/web/assets/vendor-datadog-CLUcJXOo.js +6 -0
- package/studio/web/assets/{vendor-react-Dyj4O3HE.js → vendor-react-CJV_K1u4.js} +1 -1
- package/studio/web/assets/vendor-tanstack-DxzraizX.js +1 -0
- package/studio/web/assets/{vendor-ui-vhu-UHhF.js → vendor-ui-BUjK0h8a.js} +2 -2
- package/studio/web/assets/{vennDiagram-4TSXK5OY-Cy7s7Mpy.js → vennDiagram-4TSXK5OY-A3i-lCdl.js} +1 -1
- package/studio/web/assets/{wardley-WFR3VGLG-BeBL35g2.js → wardley-WFR3VGLG-B0ik-_6g.js} +1 -1
- package/studio/web/assets/{wardleyDiagram-VM6X3IG4-BylmIGSg.js → wardleyDiagram-VM6X3IG4-CjrkKWUR.js} +1 -1
- package/studio/web/assets/{workers-C0bFIedw.js → workers-pR3jRY9D.js} +1 -1
- package/studio/web/assets/x-DIzaLEdK.js +1 -0
- package/studio/web/assets/{xml-HWd01lU-.js → xml-2iRnMhQO.js} +1 -1
- package/studio/web/assets/{xychartDiagram-S5SC5T6Z-CoKALMXr.js → xychartDiagram-S5SC5T6Z-Biok4GYV.js} +1 -1
- package/studio/web/assets/{yaml-CIH0Nt-h.js → yaml-Bf92gJpd.js} +1 -1
- package/studio/web/index.html +14 -14
- package/upgrade/directives/5-3-0.ts +132 -0
- package/upgrade/directives/directivesController.ts +2 -1
- package/utility/OperationFunctionCaller.ts +2 -1
- package/utility/common_utils.ts +30 -5
- package/utility/componentNames.ts +12 -0
- package/utility/environment/environmentManager.ts +3 -7
- package/utility/environment/systemInformation.ts +7 -0
- package/utility/errors/commonErrors.ts +4 -0
- package/utility/errors/hdbError.ts +29 -0
- package/utility/hdbTerms.ts +17 -0
- package/utility/logging/harper_logger.ts +87 -14
- package/utility/logging/logRotator.ts +72 -45
- package/utility/nodeIdentity.ts +45 -0
- package/utility/npmUtilities.ts +10 -8
- package/utility/operationPermissions.ts +18 -1
- package/utility/operation_authorization.ts +231 -42
- package/utility/watchPath.ts +63 -0
- package/utility/watcherFallback.ts +270 -0
- package/validation/configValidator.ts +209 -72
- package/validation/installValidator.ts +15 -0
- package/validation/validationWrapper.ts +18 -4
- package/studio/web/assets/Chat-JpO8EtUu.js +0 -2067
- package/studio/web/assets/FloatingChat-Bcj3xSZu.js +0 -23
- package/studio/web/assets/applications-ByqLRKyZ.js +0 -296
- package/studio/web/assets/architecture-7GRP2DOG-DNdx5tEU.js +0 -1
- package/studio/web/assets/authStore-qKmCZcaf.js +0 -3
- package/studio/web/assets/channel-DtCV8PTL.js +0 -1
- package/studio/web/assets/chunk-R7TYR2AO-Irip67yr.js +0 -10
- package/studio/web/assets/classDiagram-DTDB5LWJ-DbO_dCNE.js +0 -1
- package/studio/web/assets/classDiagram-v2-JRS7N3AN-DbO_dCNE.js +0 -1
- package/studio/web/assets/eventmodeling-NTZA5JFV-5jbe4A5P.js +0 -1
- package/studio/web/assets/flowDiagram-A5DVABFB-Dp9Ezlow.js +0 -1
- package/studio/web/assets/index-aSt5tY-L.js +0 -824
- package/studio/web/assets/index.lazy-B9jiPwT8.js +0 -2
- package/studio/web/assets/notifications-CUoYgU98.js +0 -1
- package/studio/web/assets/railroad-abnf-HS5TGJTU-Bc0Qi0WH.js +0 -1
- package/studio/web/assets/railroad-ebnf-LZEXJU2U-G8rVVZ2C.js +0 -1
- package/studio/web/assets/railroad-peg-WCYAUIDC-CrehKBhC.js +0 -1
- package/studio/web/assets/stateDiagram-v2-4QOOHH4V-D4tuw9Su.js +0 -1
- package/studio/web/assets/status-D7Xn5ePA.js +0 -61
- package/studio/web/assets/swimlanesDiagram-VK2B7HYN-XOhmNEvq.js +0 -8
- package/studio/web/assets/vendor-core-RCcadM3e.js +0 -73
- package/studio/web/assets/vendor-datadog-BRv-mOv1.js +0 -6
- package/studio/web/assets/vendor-tanstack-BiFWSB3W.js +0 -1
- package/studio/web/assets/x-B9o9hsep.js +0 -1
- /package/studio/web/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issuer-agnostic claim matching and constraint validation (#2171).
|
|
3
|
+
*
|
|
4
|
+
* Pure — no network, no storage, and nothing that knows which issuer a token came from. Rules that
|
|
5
|
+
* depend on the issuer live in providers/.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ClientError } from '../../../utility/errors/hdbError.ts';
|
|
9
|
+
import type { ClaimConstraint, TokenClaims } from './types.ts';
|
|
10
|
+
|
|
11
|
+
/** Issuers may encode a numeric id as a JSON number; anything non-scalar is not comparable. */
|
|
12
|
+
function claimToString(value: unknown): string | undefined {
|
|
13
|
+
if (typeof value === 'string') return value;
|
|
14
|
+
if (typeof value === 'number' && Number.isFinite(value)) return String(value);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns undefined on a match, or the first failure's reason — for the log, never the caller.
|
|
20
|
+
*
|
|
21
|
+
* A constrained claim absent from the token fails rather than passes, so a policy cannot be weakened
|
|
22
|
+
* by an issuer that stops emitting a claim.
|
|
23
|
+
*/
|
|
24
|
+
export function matchTrustPolicyClaims(
|
|
25
|
+
claims: TokenClaims,
|
|
26
|
+
policyClaims: Record<string, ClaimConstraint>
|
|
27
|
+
): string | undefined {
|
|
28
|
+
const constraints = Object.entries(policyClaims);
|
|
29
|
+
// validateClaimConstraintShape rejects this at write time; this backstops a row that reached the
|
|
30
|
+
// table another way, such as replication from a peer.
|
|
31
|
+
if (constraints.length === 0) return 'policy constrains no claims';
|
|
32
|
+
|
|
33
|
+
for (const [claimName, constraint] of constraints) {
|
|
34
|
+
const actual = claimToString(claims[claimName]);
|
|
35
|
+
if (actual === undefined || actual === '') return `token has no usable ${claimName} claim`;
|
|
36
|
+
const accepted = Array.isArray(constraint) ? constraint : [constraint];
|
|
37
|
+
// Exact membership, deliberately — never a prefix, wildcard, or regex. Relaxing this to
|
|
38
|
+
// something like `startsWith` is the classic trusted-publishing escalation: a policy pinning
|
|
39
|
+
// `HarperFast/my-app` would then also admit `HarperFast/my-app-evil`, a repository anyone can
|
|
40
|
+
// create. unitTests/security/authn/oidc/claims.test.js pins both argument orders.
|
|
41
|
+
if (!accepted.includes(actual)) return `${claimName} does not match the policy`;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Validates the *shape* of a policy's constraints — that each is a usable set of comparable values.
|
|
48
|
+
* Whether the set is specific enough to be safe depends on the issuer; that is the provider profile's
|
|
49
|
+
* assertPolicyIsSpecific.
|
|
50
|
+
*
|
|
51
|
+
* Throws ClientError naming the first problem; the reader is an administrator writing a policy.
|
|
52
|
+
*/
|
|
53
|
+
export function validateClaimConstraintShape(
|
|
54
|
+
policyClaims: unknown
|
|
55
|
+
): asserts policyClaims is Record<string, ClaimConstraint> {
|
|
56
|
+
if (!policyClaims || typeof policyClaims !== 'object' || Array.isArray(policyClaims)) {
|
|
57
|
+
throw new ClientError('claims must be an object of claim constraints');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const entries = Object.entries(policyClaims as Record<string, unknown>);
|
|
61
|
+
if (entries.length === 0) throw new ClientError('claims must constrain at least one claim');
|
|
62
|
+
|
|
63
|
+
for (const [claimName, constraint] of entries) {
|
|
64
|
+
const values = Array.isArray(constraint) ? constraint : [constraint];
|
|
65
|
+
if (values.length === 0) throw new ClientError(`claims.${claimName} must accept at least one value`);
|
|
66
|
+
for (const value of values) {
|
|
67
|
+
if (typeof value !== 'string' || value === '') {
|
|
68
|
+
throw new ClientError(`claims.${claimName} must be a non-empty string or an array of non-empty strings`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity-token verification for OIDC trusted publishing (#2171).
|
|
3
|
+
*
|
|
4
|
+
* Verifies that a token was signed by the configured issuer and is addressed to this instance.
|
|
5
|
+
* Matching it against a policy's claim constraints is separate (claims.ts), because one verification
|
|
6
|
+
* serves every policy sharing an issuer and audience.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import jwt, { type Algorithm, type JwtPayload } from 'jsonwebtoken';
|
|
10
|
+
import type { KeyObject } from 'node:crypto';
|
|
11
|
+
import { ClientError } from '../../../utility/errors/hdbError.ts';
|
|
12
|
+
import { loggerWithTag } from '../../../utility/logging/logger.ts';
|
|
13
|
+
import { getSigningKey as defaultGetSigningKey, normalizeIssuer } from './jwks.ts';
|
|
14
|
+
import { profileForIssuer } from './providers/index.ts';
|
|
15
|
+
import type { TokenClaims } from './types.ts';
|
|
16
|
+
|
|
17
|
+
const logger = loggerWithTag('oidc-trust');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Asymmetric signatures only. Passing this to jwt.verify is what prevents algorithm confusion: an
|
|
21
|
+
* `alg: none` token, or one HMAC-signed with a public key as the secret, is rejected before the
|
|
22
|
+
* signature is considered.
|
|
23
|
+
*/
|
|
24
|
+
const ALLOWED_ALGORITHMS: Algorithm[] = [
|
|
25
|
+
'RS256',
|
|
26
|
+
'RS384',
|
|
27
|
+
'RS512',
|
|
28
|
+
'ES256',
|
|
29
|
+
'ES384',
|
|
30
|
+
'ES512',
|
|
31
|
+
'PS256',
|
|
32
|
+
'PS384',
|
|
33
|
+
'PS512',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const CLOCK_TOLERANCE_SECONDS = 60;
|
|
37
|
+
|
|
38
|
+
/** CI identity tokens are minted per job and live minutes; a far-future expiry is not one to honor. */
|
|
39
|
+
const MAX_TOKEN_LIFETIME_SECONDS = 3_600;
|
|
40
|
+
|
|
41
|
+
export interface VerifyTokenTarget {
|
|
42
|
+
issuer: string;
|
|
43
|
+
audience: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface VerifyTokenOptions {
|
|
47
|
+
/** Overridable for tests; defaults to the network-backed JWKS lookup. */
|
|
48
|
+
getSigningKey?: (issuer: string, kid: unknown) => Promise<KeyObject>;
|
|
49
|
+
/** Seconds since the epoch to evaluate expiry against; defaults to the real clock. */
|
|
50
|
+
clockTimestamp?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Refuses a token. Shared with the exchange so both halves fail identically: the endpoint is
|
|
55
|
+
* unauthenticated, and a caller told exactly which check failed can probe a policy one claim at a
|
|
56
|
+
* time. The reason goes to the log instead.
|
|
57
|
+
*/
|
|
58
|
+
export function rejectToken(detail: string): never {
|
|
59
|
+
logger.warn?.(`Rejecting identity token: ${detail}`);
|
|
60
|
+
throw new ClientError('Identity token was rejected', 401);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Verifies a CI identity token against one issuer/audience pair and returns its normalized claims. */
|
|
64
|
+
export async function verifyIdentityToken(
|
|
65
|
+
token: unknown,
|
|
66
|
+
target: VerifyTokenTarget,
|
|
67
|
+
options: VerifyTokenOptions = {}
|
|
68
|
+
): Promise<TokenClaims> {
|
|
69
|
+
if (typeof token !== 'string' || token === '') throw new ClientError('token is required');
|
|
70
|
+
const issuer = normalizeIssuer(target.issuer);
|
|
71
|
+
if (typeof target.audience !== 'string' || target.audience === '') {
|
|
72
|
+
throw new ClientError('audience is required');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const decoded = jwt.decode(token, { complete: true });
|
|
76
|
+
if (!decoded) rejectToken('token is not a well-formed JWT');
|
|
77
|
+
|
|
78
|
+
// Checked before resolving a key so a garbage header costs no outbound request.
|
|
79
|
+
if (!ALLOWED_ALGORITHMS.includes(decoded.header.alg as Algorithm)) {
|
|
80
|
+
rejectToken(`unsupported algorithm ${decoded.header.alg}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const getSigningKey = options.getSigningKey ?? defaultGetSigningKey;
|
|
84
|
+
const key = await getSigningKey(issuer, decoded.header.kid);
|
|
85
|
+
|
|
86
|
+
let payload: JwtPayload;
|
|
87
|
+
try {
|
|
88
|
+
payload = jwt.verify(token, key, {
|
|
89
|
+
algorithms: ALLOWED_ALGORITHMS,
|
|
90
|
+
// Both spellings, because `issuer` here is normalized (trailing slash stripped) while
|
|
91
|
+
// jsonwebtoken compares it byte-for-byte against the raw `iss`. Azure AD v1 emits
|
|
92
|
+
// `https://sts.windows.net/<tenant>/`, which would otherwise never authenticate — and the
|
|
93
|
+
// generic profile exists precisely to serve issuers like it with no provider code. This
|
|
94
|
+
// cannot widen trust: normalizeIssuer already maps the two forms to one value, which is
|
|
95
|
+
// what keys the JWKS cache, the discovery check, and the policy lookup.
|
|
96
|
+
issuer: [issuer, `${issuer}/`],
|
|
97
|
+
audience: target.audience,
|
|
98
|
+
clockTolerance: CLOCK_TOLERANCE_SECONDS,
|
|
99
|
+
...(options.clockTimestamp === undefined ? {} : { clockTimestamp: options.clockTimestamp }),
|
|
100
|
+
}) as JwtPayload;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
rejectToken((error as Error).message);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// jsonwebtoken only enforces `exp` when present, so a token without one never expires.
|
|
106
|
+
if (typeof payload.exp !== 'number') rejectToken('token has no exp claim');
|
|
107
|
+
// `iat` is REQUIRED by OIDC, and required here rather than treated as optional: skipping the
|
|
108
|
+
// ceiling when it is absent means a token carrying a distant `exp` and no `iat` is unbounded —
|
|
109
|
+
// the ceiling would silently not apply to exactly the token that most needs it.
|
|
110
|
+
if (typeof payload.iat !== 'number') rejectToken('token has no iat claim');
|
|
111
|
+
|
|
112
|
+
// Bounded against the verification clock, not only as `exp - iat`. jsonwebtoken validates `exp`
|
|
113
|
+
// and `nbf` but never rejects a future `iat`, so an issuer that shifts the whole pair forward
|
|
114
|
+
// keeps a small delta and still hands out a token valid far longer than the ceiling. Both the
|
|
115
|
+
// delta and the absolute distance to `exp` are checked; the tolerance mirrors the one given to
|
|
116
|
+
// jwt.verify so genuine clock skew is not treated as an attack.
|
|
117
|
+
const now = options.clockTimestamp ?? Math.floor(Date.now() / 1000);
|
|
118
|
+
if (payload.iat > now + CLOCK_TOLERANCE_SECONDS) rejectToken('token iat is in the future');
|
|
119
|
+
if (payload.exp - payload.iat > MAX_TOKEN_LIFETIME_SECONDS) {
|
|
120
|
+
rejectToken(`token lifetime exceeds ${MAX_TOKEN_LIFETIME_SECONDS}s`);
|
|
121
|
+
}
|
|
122
|
+
if (payload.exp - now > MAX_TOKEN_LIFETIME_SECONDS + CLOCK_TOLERANCE_SECONDS) {
|
|
123
|
+
rejectToken(`token expires more than ${MAX_TOKEN_LIFETIME_SECONDS}s from now`);
|
|
124
|
+
}
|
|
125
|
+
// No `jti` requirement: not every issuer emits one (Azure uses `uti`, others omit it), and the
|
|
126
|
+
// exchange keys replay on a hash of the token itself, which is universal.
|
|
127
|
+
|
|
128
|
+
return profileForIssuer(issuer).normalizeClaims(payload as TokenClaims);
|
|
129
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OIDC discovery and JWKS retrieval for trusted publishing (#2171).
|
|
3
|
+
*
|
|
4
|
+
* The issuer's signing keys are the root of trust for an exchanged token, and the endpoint that
|
|
5
|
+
* reaches them is unauthenticated — hence HTTPS only, bounded body, bounded time, and a rate limit
|
|
6
|
+
* on the refetch an unrecognized `kid` triggers, without which forged `kid`s become one outbound
|
|
7
|
+
* fetch per request.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createPublicKey, type KeyObject } from 'node:crypto';
|
|
11
|
+
import { loggerWithTag } from '../../../utility/logging/logger.ts';
|
|
12
|
+
import { ClientError, ServerError } from '../../../utility/errors/hdbError.ts';
|
|
13
|
+
|
|
14
|
+
const logger = loggerWithTag('oidc-trust');
|
|
15
|
+
|
|
16
|
+
const DISCOVERY_PATH = '/.well-known/openid-configuration';
|
|
17
|
+
/** How long a fetched key set is served without revalidation. */
|
|
18
|
+
const JWKS_CACHE_TTL_MS = 3_600_000;
|
|
19
|
+
/** Floor between refetches triggered by an unrecognized `kid`. */
|
|
20
|
+
const MIN_REFETCH_INTERVAL_MS = 60_000;
|
|
21
|
+
/**
|
|
22
|
+
* How long a cached key set survives a failed refetch. Bounded, so a network blip does not break
|
|
23
|
+
* deploys but a pulled key does not stay honored forever.
|
|
24
|
+
*/
|
|
25
|
+
const STALE_KEY_GRACE_MS = 86_400_000;
|
|
26
|
+
const FETCH_TIMEOUT_MS = 5_000;
|
|
27
|
+
const MAX_RESPONSE_BYTES = 1_048_576;
|
|
28
|
+
/** Asymmetric only: an `oct` key in a JWKS is the setup for algorithm confusion. */
|
|
29
|
+
const SUPPORTED_KEY_TYPES = ['RSA', 'EC'];
|
|
30
|
+
|
|
31
|
+
interface IssuerKeys {
|
|
32
|
+
keys: Map<string, KeyObject>;
|
|
33
|
+
fetchedAt: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const issuerKeyCache = new Map<string, IssuerKeys>();
|
|
37
|
+
const inFlightLoads = new Map<string, Promise<IssuerKeys>>();
|
|
38
|
+
/**
|
|
39
|
+
* When an unrecognized `kid` last drove a refetch, per issuer. Outside the cache entry on purpose:
|
|
40
|
+
* every successful fetch replaces that entry, and a rate limit that resets whenever it fires is not
|
|
41
|
+
* a rate limit. Separating them also lets a genuine key rotation be picked up on first use.
|
|
42
|
+
*/
|
|
43
|
+
const unknownKidRefetchAt = new Map<string, number>();
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* When a refresh for an issuer last FAILED, per issuer. Tracked separately from `fetchedAt`, which a
|
|
47
|
+
* failed fetch does not advance — so without this, every request wave arriving after the cache went
|
|
48
|
+
* stale starts discovery again and rides the same timeout before falling back to the same stale key.
|
|
49
|
+
* The exchange is unauthenticated and picks its issuer from an unverified JWT, and issuer key ids are
|
|
50
|
+
* public, so an anonymous caller could keep that cycle running for the length of an issuer outage:
|
|
51
|
+
* exactly when the stale-key grace is supposed to be absorbing load, not generating it.
|
|
52
|
+
*/
|
|
53
|
+
const failedRefreshAt = new Map<string, number>();
|
|
54
|
+
|
|
55
|
+
/** How long a failed refresh suppresses the next one, while a usable stale key is still on hand. */
|
|
56
|
+
const FAILED_REFRESH_BACKOFF_MS = 30_000;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Bumped by every clear. A fetch that was already in flight when the cache was cleared must not
|
|
60
|
+
* write its now-stale result back: clearing drops `inFlightLoads`, but the orphaned fetch still
|
|
61
|
+
* holds a reference and would repopulate the entry an operator just discarded — which for a clear
|
|
62
|
+
* issued precisely because the cached key is wrong means the re-read silently does nothing.
|
|
63
|
+
*/
|
|
64
|
+
let cacheGeneration = 0;
|
|
65
|
+
|
|
66
|
+
/** Drops all cached key sets. Exported for tests and for an operator forcing a re-read. */
|
|
67
|
+
export function clearJwksCache(): void {
|
|
68
|
+
cacheGeneration++;
|
|
69
|
+
issuerKeyCache.clear();
|
|
70
|
+
inFlightLoads.clear();
|
|
71
|
+
unknownKidRefetchAt.clear();
|
|
72
|
+
failedRefreshAt.clear();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Canonicalizes an issuer URL. The result is both the cache key and the discovery base, so a policy
|
|
77
|
+
* stored with a trailing slash and one without must not become two entries for the same issuer.
|
|
78
|
+
*/
|
|
79
|
+
export function normalizeIssuer(issuer: unknown): string {
|
|
80
|
+
if (typeof issuer !== 'string' || issuer === '') throw new ClientError('issuer is required');
|
|
81
|
+
let url: URL;
|
|
82
|
+
try {
|
|
83
|
+
url = new URL(issuer);
|
|
84
|
+
} catch {
|
|
85
|
+
throw new ClientError(`issuer is not a valid URL: ${issuer}`);
|
|
86
|
+
}
|
|
87
|
+
if (url.protocol !== 'https:') throw new ClientError('issuer must be an https URL');
|
|
88
|
+
if (url.search !== '' || url.hash !== '') throw new ClientError('issuer must not carry a query or fragment');
|
|
89
|
+
return url.origin + (url.pathname === '/' ? '' : url.pathname.replace(/\/$/, ''));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* `content-length` is checked first as a cheap rejection, then the body is counted as it streams —
|
|
94
|
+
* the header is advisory, and a hostile endpoint can simply omit it.
|
|
95
|
+
*/
|
|
96
|
+
async function readBoundedJson(response: Response, url: string): Promise<any> {
|
|
97
|
+
const declaredLength = Number(response.headers.get('content-length'));
|
|
98
|
+
if (Number.isFinite(declaredLength) && declaredLength > MAX_RESPONSE_BYTES) {
|
|
99
|
+
throw new ServerError(`Response from ${url} exceeds ${MAX_RESPONSE_BYTES} bytes`);
|
|
100
|
+
}
|
|
101
|
+
const chunks: Buffer[] = [];
|
|
102
|
+
let total = 0;
|
|
103
|
+
if (response.body) {
|
|
104
|
+
for await (const chunk of response.body as unknown as AsyncIterable<Uint8Array>) {
|
|
105
|
+
total += chunk.length;
|
|
106
|
+
if (total > MAX_RESPONSE_BYTES) {
|
|
107
|
+
throw new ServerError(`Response from ${url} exceeds ${MAX_RESPONSE_BYTES} bytes`);
|
|
108
|
+
}
|
|
109
|
+
chunks.push(Buffer.from(chunk));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw new ServerError(`Response from ${url} is not valid JSON: ${(error as Error).message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function fetchJson(url: string): Promise<any> {
|
|
120
|
+
let response: Response;
|
|
121
|
+
try {
|
|
122
|
+
response = await fetch(url, {
|
|
123
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
124
|
+
headers: { accept: 'application/json' },
|
|
125
|
+
redirect: 'error',
|
|
126
|
+
});
|
|
127
|
+
} catch (error) {
|
|
128
|
+
throw new ServerError(`Could not reach ${url}: ${(error as Error).message}`);
|
|
129
|
+
}
|
|
130
|
+
if (!response.ok) throw new ServerError(`${url} responded ${response.status}`);
|
|
131
|
+
return readBoundedJson(response, url);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The discovery document's own `issuer` must equal the one we asked about — the spec requires it,
|
|
136
|
+
* and it stops a misdirected document from quietly re-pointing an issuer we trust.
|
|
137
|
+
*/
|
|
138
|
+
async function discoverJwksUri(issuer: string): Promise<string> {
|
|
139
|
+
const document = await fetchJson(issuer + DISCOVERY_PATH);
|
|
140
|
+
// Swallowed rather than propagated: normalizeIssuer raises ClientError, the wrong shape for a
|
|
141
|
+
// malformed *server* response.
|
|
142
|
+
let declaredIssuer: string | undefined;
|
|
143
|
+
try {
|
|
144
|
+
declaredIssuer = normalizeIssuer(document?.issuer);
|
|
145
|
+
} catch {
|
|
146
|
+
declaredIssuer = undefined;
|
|
147
|
+
}
|
|
148
|
+
if (declaredIssuer !== issuer) {
|
|
149
|
+
throw new ServerError(`Discovery document at ${issuer} declares a different issuer`);
|
|
150
|
+
}
|
|
151
|
+
const jwksUri = document?.jwks_uri;
|
|
152
|
+
if (typeof jwksUri !== 'string' || !jwksUri.startsWith('https://')) {
|
|
153
|
+
throw new ServerError(`Discovery document at ${issuer} has no https jwks_uri`);
|
|
154
|
+
}
|
|
155
|
+
return jwksUri;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Undefined for a key we will not honor. One unusable entry must not poison the set: issuers publish
|
|
160
|
+
* keys for other purposes, and an unknown future type should degrade rather than fail the fetch.
|
|
161
|
+
*/
|
|
162
|
+
function toSigningKey(jwk: any): KeyObject | undefined {
|
|
163
|
+
if (!jwk || typeof jwk !== 'object') return undefined;
|
|
164
|
+
if (typeof jwk.kid !== 'string' || jwk.kid === '') return undefined;
|
|
165
|
+
if (jwk.use !== undefined && jwk.use !== 'sig') return undefined;
|
|
166
|
+
if (!SUPPORTED_KEY_TYPES.includes(jwk.kty)) return undefined;
|
|
167
|
+
try {
|
|
168
|
+
return createPublicKey({ key: jwk, format: 'jwk' });
|
|
169
|
+
} catch (error) {
|
|
170
|
+
logger.warn?.(`Skipping unusable JWK ${jwk.kid}: ${(error as Error).message}`);
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function fetchIssuerKeys(issuer: string): Promise<IssuerKeys> {
|
|
176
|
+
// Sampled before the first await, so any clear during the fetch is detectable at the end.
|
|
177
|
+
const generation = cacheGeneration;
|
|
178
|
+
const jwksUri = await discoverJwksUri(issuer);
|
|
179
|
+
const jwks = await fetchJson(jwksUri);
|
|
180
|
+
if (!Array.isArray(jwks?.keys)) throw new ServerError(`JWKS at ${jwksUri} has no keys array`);
|
|
181
|
+
|
|
182
|
+
const keys = new Map<string, KeyObject>();
|
|
183
|
+
for (const jwk of jwks.keys) {
|
|
184
|
+
const key = toSigningKey(jwk);
|
|
185
|
+
if (key) keys.set(jwk.kid, key);
|
|
186
|
+
}
|
|
187
|
+
if (keys.size === 0) throw new ServerError(`JWKS at ${jwksUri} contains no usable signing keys`);
|
|
188
|
+
|
|
189
|
+
const entry: IssuerKeys = { keys, fetchedAt: Date.now() };
|
|
190
|
+
// Still returned to the caller that asked for it — it is freshly fetched and valid — but only
|
|
191
|
+
// cached if no clear happened while this was in flight.
|
|
192
|
+
if (generation === cacheGeneration) issuerKeyCache.set(issuer, entry);
|
|
193
|
+
logger.debug?.(`Loaded ${keys.size} signing key(s) for ${issuer}`);
|
|
194
|
+
return entry;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Loads an issuer's keys, collapsing concurrent callers onto one fetch. */
|
|
198
|
+
function loadIssuerKeys(issuer: string): Promise<IssuerKeys> {
|
|
199
|
+
const existing = inFlightLoads.get(issuer);
|
|
200
|
+
if (existing) return existing;
|
|
201
|
+
|
|
202
|
+
const load = fetchIssuerKeys(issuer).finally(() => inFlightLoads.delete(issuer));
|
|
203
|
+
inFlightLoads.set(issuer, load);
|
|
204
|
+
return load;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Resolves the public key an issuer used to sign a token, by `kid`. */
|
|
208
|
+
/**
|
|
209
|
+
* `now` exists so the two time-based bounds below can be tested — the cache TTL and, more
|
|
210
|
+
* importantly, the STALE_KEY_GRACE_MS ceiling that stops a pulled key being honored forever through
|
|
211
|
+
* a prolonged outage. Reaching either otherwise needs a cache aged past an hour, and this repo bars
|
|
212
|
+
* new fake timers. Mirrors the `clockTimestamp` seam verifyIdentityToken already takes, rather than
|
|
213
|
+
* inventing a second convention. Callers in production pass nothing.
|
|
214
|
+
*/
|
|
215
|
+
export async function getSigningKey(issuer: string, kid: unknown, now: number = Date.now()): Promise<KeyObject> {
|
|
216
|
+
if (typeof kid !== 'string' || kid === '') throw new ClientError('Token has no key id', 401);
|
|
217
|
+
const normalizedIssuer = normalizeIssuer(issuer);
|
|
218
|
+
const cached = issuerKeyCache.get(normalizedIssuer);
|
|
219
|
+
|
|
220
|
+
if (cached && now - cached.fetchedAt < JWKS_CACHE_TTL_MS) {
|
|
221
|
+
const key = cached.keys.get(kid);
|
|
222
|
+
if (key) return key;
|
|
223
|
+
// Unknown kid against a still-fresh set: refetch once, then hold the line for the window. The
|
|
224
|
+
// timestamp is recorded before the fetch so a failing issuer is rate-limited like a succeeding one.
|
|
225
|
+
if (now - (unknownKidRefetchAt.get(normalizedIssuer) ?? 0) < MIN_REFETCH_INTERVAL_MS) {
|
|
226
|
+
throw new ClientError('Token signing key is not recognized', 401);
|
|
227
|
+
}
|
|
228
|
+
unknownKidRefetchAt.set(normalizedIssuer, now);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// A usable stale key, if the cache is expired but still inside the grace window.
|
|
232
|
+
const staleKey = cached && now - cached.fetchedAt < STALE_KEY_GRACE_MS ? cached.keys.get(kid) : undefined;
|
|
233
|
+
|
|
234
|
+
// Skip the fetch entirely while a recent one is known to have failed. Not gated on having a stale
|
|
235
|
+
// key: the fetch is the expensive part, and the issuer we have NEVER cached is the worse case —
|
|
236
|
+
// there is nothing to fall back to, so without this every request rides the full discovery and
|
|
237
|
+
// timeout. Refusing for the backoff interval bounds what an anonymous caller can drive, at the
|
|
238
|
+
// cost of a legitimate first exchange waiting out that interval after a blip. Fails closed.
|
|
239
|
+
if (now - (failedRefreshAt.get(normalizedIssuer) ?? 0) < FAILED_REFRESH_BACKOFF_MS) {
|
|
240
|
+
if (staleKey) return staleKey;
|
|
241
|
+
throw new ServerError(`Signing keys for ${normalizedIssuer} are temporarily unavailable; a recent refresh failed`);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
let refreshed: IssuerKeys;
|
|
245
|
+
try {
|
|
246
|
+
refreshed = await loadIssuerKeys(normalizedIssuer);
|
|
247
|
+
} catch (error) {
|
|
248
|
+
// Recorded whether or not a stale key rescues this request, so the backoff also covers the
|
|
249
|
+
// issuer whose keys we have never held.
|
|
250
|
+
failedRefreshAt.set(normalizedIssuer, now);
|
|
251
|
+
if (!staleKey) throw error;
|
|
252
|
+
logger.warn?.(`Using cached signing key for ${normalizedIssuer}; refresh failed: ${(error as Error).message}`);
|
|
253
|
+
return staleKey;
|
|
254
|
+
}
|
|
255
|
+
failedRefreshAt.delete(normalizedIssuer);
|
|
256
|
+
|
|
257
|
+
const key = refreshed.keys.get(kid);
|
|
258
|
+
if (!key) throw new ClientError('Token signing key is not recognized', 401);
|
|
259
|
+
return key;
|
|
260
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback profile for issuers with no registered provider profile (#2171).
|
|
3
|
+
*
|
|
4
|
+
* Strict rather than permissive: the policy must pin `sub`. That is what makes workload identity work
|
|
5
|
+
* with zero provider code — a Kubernetes service-account token
|
|
6
|
+
* (`system:serviceaccount:<namespace>:<name>`), a GCP service account, and a SPIFFE SVID all carry a
|
|
7
|
+
* stable canonical subject, so pinning it identifies exactly one principal.
|
|
8
|
+
*
|
|
9
|
+
* GitHub Actions needs its own profile precisely because its `sub` is the one claim you should not
|
|
10
|
+
* pin: it varies by trigger, and its format changed for repositories created after 2026-07-15.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { ClientError } from '../../../../utility/errors/hdbError.ts';
|
|
14
|
+
import type { ClaimConstraint, TokenClaims } from '../types.ts';
|
|
15
|
+
import type { IdentityProviderProfile } from './index.ts';
|
|
16
|
+
|
|
17
|
+
export const genericProfile: IdentityProviderProfile = {
|
|
18
|
+
name: 'generic OIDC',
|
|
19
|
+
|
|
20
|
+
assertPolicyIsSpecific(policyClaims: Record<string, ClaimConstraint>): void {
|
|
21
|
+
if (policyClaims.sub === undefined) {
|
|
22
|
+
throw new ClientError(
|
|
23
|
+
'claims must pin `sub` for an issuer with no registered provider profile — it is the only ' +
|
|
24
|
+
'claim every OIDC issuer defines as identifying a single principal. Register a provider ' +
|
|
25
|
+
'profile if this issuer needs richer rules.'
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// No known shared default audience; the required `sub` pin already binds the policy to one principal.
|
|
31
|
+
assertAudienceIsSpecific(): void {},
|
|
32
|
+
|
|
33
|
+
normalizeClaims(payload: TokenClaims): TokenClaims {
|
|
34
|
+
return { ...payload };
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
describePrincipal(claims: TokenClaims): string {
|
|
38
|
+
return typeof claims.sub === 'string' ? claims.sub : 'unknown principal';
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Actions provider profile (#2171).
|
|
3
|
+
*
|
|
4
|
+
* The only module that should know anything about GitHub. Its rules are deliberately stricter than
|
|
5
|
+
* npm's trusted-publishing model, and scoping them here means that strictness never constrains
|
|
6
|
+
* another issuer.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ClientError } from '../../../../utility/errors/hdbError.ts';
|
|
10
|
+
import type { ClaimConstraint, TokenClaims } from '../types.ts';
|
|
11
|
+
import type { IdentityProviderProfile } from './index.ts';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Workflow references are `<owner>/<repo>/<path>@<ref>` and the ref is always a full `refs/...` name.
|
|
15
|
+
* Splitting on `@refs/` rather than the first or last `@` is exact, because a path segment cannot
|
|
16
|
+
* contain `/` — so this cannot occur inside the path, and a branch named `release@2` cannot fool it.
|
|
17
|
+
*/
|
|
18
|
+
const REF_QUALIFIER = '@refs/';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* GitHub's default audience is the repository owner's URL, shared by every repository under that
|
|
22
|
+
* owner, so accepting it would make a token minted by any repo in the org valid here — the one
|
|
23
|
+
* mistake the audience field exists to prevent.
|
|
24
|
+
*/
|
|
25
|
+
const SHARED_DEFAULT_AUDIENCE = /^https:\/\/github\.com\/[^/]+\/?$/i;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Structural requirements on a policy's claim set, each guarding a distinct way a policy can be
|
|
29
|
+
* accidentally broad. Satisfying none of a row's claims admits, in order: any repository, any
|
|
30
|
+
* workflow in that repository, any branch that can be pushed to it.
|
|
31
|
+
*
|
|
32
|
+
* `repository_owner` is absent from the first row on purpose — it identifies an org, not a
|
|
33
|
+
* repository, so it would admit every repo in the org. `ref_type` is absent from the third for the
|
|
34
|
+
* same shape of reason: `ref_type: tag` still admits any tag, and anyone with push access can create
|
|
35
|
+
* one. A tag-triggered release pins `environment` and leans on GitHub's environment protection.
|
|
36
|
+
*
|
|
37
|
+
* `job_workflow_ref` pins the workflow (second row) but deliberately does NOT gate the ref (third).
|
|
38
|
+
* For a reusable workflow it names the workflow that RAN, not the caller that invoked it — the
|
|
39
|
+
* caller's ref lives in `workflow_ref`/`ref`. Its `@ref` suffix therefore describes the reusable
|
|
40
|
+
* workflow's own branch, which is constant however it is called, so accepting it as a ref gate would
|
|
41
|
+
* admit any branch of any caller repository that references that reusable workflow: precisely the
|
|
42
|
+
* hole the third row exists to close.
|
|
43
|
+
*
|
|
44
|
+
* `sub` is deliberately not accepted as a pin: it varies by trigger, and its format changed for
|
|
45
|
+
* repositories created after 2026-07-15 (immutable subjects embed owner and repo ids).
|
|
46
|
+
*/
|
|
47
|
+
const STRUCTURAL_REQUIREMENTS = [
|
|
48
|
+
{
|
|
49
|
+
requirement: 'pin the repository',
|
|
50
|
+
claims: ['repository_id', 'repository'],
|
|
51
|
+
because: ' (repository_id is immutable and survives renames)',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
requirement: 'pin the workflow',
|
|
55
|
+
claims: ['workflow_ref', 'workflow_path', 'job_workflow_ref', 'job_workflow_path'],
|
|
56
|
+
because: '',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
requirement: 'gate the ref',
|
|
60
|
+
claims: ['workflow_ref', 'ref', 'environment'],
|
|
61
|
+
because: ' — otherwise any branch that can be pushed to the repository can run the workflow and mint a token',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
/** Returns undefined rather than guessing when the value is not a ref-qualified reference. */
|
|
66
|
+
export function splitWorkflowPath(workflowRef: unknown): string | undefined {
|
|
67
|
+
if (typeof workflowRef !== 'string') return undefined;
|
|
68
|
+
const qualifierIndex = workflowRef.indexOf(REF_QUALIFIER);
|
|
69
|
+
return qualifierIndex === -1 ? undefined : workflowRef.slice(0, qualifierIndex);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const githubActionsProfile: IdentityProviderProfile = {
|
|
73
|
+
name: 'GitHub Actions',
|
|
74
|
+
|
|
75
|
+
assertPolicyIsSpecific(policyClaims: Record<string, ClaimConstraint>): void {
|
|
76
|
+
const constrained = new Set(Object.keys(policyClaims));
|
|
77
|
+
for (const { requirement, claims, because } of STRUCTURAL_REQUIREMENTS) {
|
|
78
|
+
if (!claims.some((claimName) => constrained.has(claimName))) {
|
|
79
|
+
throw new ClientError(`claims must ${requirement} with one of: ${claims.join(', ')}${because}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
assertAudienceIsSpecific(audience: string): void {
|
|
85
|
+
if (SHARED_DEFAULT_AUDIENCE.test(audience)) {
|
|
86
|
+
throw new ClientError(
|
|
87
|
+
`'audience' must identify this instance, not '${audience}' — GitHub's default audience is shared ` +
|
|
88
|
+
`by every repository under an owner, so a token minted for any of them would be accepted here. ` +
|
|
89
|
+
`Use the instance URL the CI client targets.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Adds `workflow_path` / `job_workflow_path` — the workflow reference with the ref removed — so a
|
|
96
|
+
* policy can pin the workflow *file* while gating the ref some other way. A tag-triggered release
|
|
97
|
+
* cannot pin `workflow_ref`, because the tag is unknown when the policy is written.
|
|
98
|
+
*
|
|
99
|
+
* A claim the token actually carries is never displaced by one we synthesized.
|
|
100
|
+
*/
|
|
101
|
+
normalizeClaims(payload: TokenClaims): TokenClaims {
|
|
102
|
+
const claims: TokenClaims = { ...payload };
|
|
103
|
+
for (const [source, derived] of [
|
|
104
|
+
['workflow_ref', 'workflow_path'],
|
|
105
|
+
['job_workflow_ref', 'job_workflow_path'],
|
|
106
|
+
]) {
|
|
107
|
+
const path = splitWorkflowPath(payload[source]);
|
|
108
|
+
if (path !== undefined && claims[derived] === undefined) claims[derived] = path;
|
|
109
|
+
}
|
|
110
|
+
return claims;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A `pull_request_target` run executes the base repository's workflow with its secrets while a
|
|
115
|
+
* fork controls the checked-out code. A plain `pull_request` run from a fork gets no
|
|
116
|
+
* `id-token: write` and so cannot mint at all, but `pull_request_target` can — so it is denied
|
|
117
|
+
* unless a policy constrains `event_name`, which is the explicit opt-in.
|
|
118
|
+
*/
|
|
119
|
+
vetoClaims(claims: TokenClaims, policyClaims: Record<string, ClaimConstraint>): string | undefined {
|
|
120
|
+
if (claims.event_name === 'pull_request_target' && policyClaims.event_name === undefined) {
|
|
121
|
+
return 'pull_request_target is denied unless the policy constrains event_name';
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
describePrincipal(claims: TokenClaims): string {
|
|
127
|
+
return [
|
|
128
|
+
claims.repository,
|
|
129
|
+
claims.workflow_ref ?? claims.workflow_path,
|
|
130
|
+
claims.environment && `environment=${claims.environment}`,
|
|
131
|
+
claims.run_id && `run=${claims.run_id}`,
|
|
132
|
+
claims.actor && `actor=${claims.actor}`,
|
|
133
|
+
]
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.join(' ');
|
|
136
|
+
},
|
|
137
|
+
};
|