@decionis/agentsafe 0.1.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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +909 -0
- package/dist/Cli.d.ts +3 -0
- package/dist/Cli.d.ts.map +1 -0
- package/dist/Cli.js +150 -0
- package/dist/Cli.js.map +1 -0
- package/dist/Index.d.ts +104 -0
- package/dist/Index.d.ts.map +1 -0
- package/dist/Index.js +102 -0
- package/dist/Index.js.map +1 -0
- package/dist/Serve.d.ts +26 -0
- package/dist/Serve.d.ts.map +1 -0
- package/dist/Serve.js +143 -0
- package/dist/Serve.js.map +1 -0
- package/dist/TrustedExecutor.d.ts +66 -0
- package/dist/TrustedExecutor.d.ts.map +1 -0
- package/dist/TrustedExecutor.js +170 -0
- package/dist/TrustedExecutor.js.map +1 -0
- package/dist/Version.d.ts +6 -0
- package/dist/Version.d.ts.map +1 -0
- package/dist/Version.js +21 -0
- package/dist/Version.js.map +1 -0
- package/dist/adapters/AdapterActionHandler.d.ts +48 -0
- package/dist/adapters/AdapterActionHandler.d.ts.map +1 -0
- package/dist/adapters/AdapterActionHandler.js +148 -0
- package/dist/adapters/AdapterActionHandler.js.map +1 -0
- package/dist/adapters/EffectAdapter.d.ts +96 -0
- package/dist/adapters/EffectAdapter.d.ts.map +1 -0
- package/dist/adapters/EffectAdapter.js +16 -0
- package/dist/adapters/EffectAdapter.js.map +1 -0
- package/dist/adapters/EffectAwareGrantVerifier.d.ts +30 -0
- package/dist/adapters/EffectAwareGrantVerifier.d.ts.map +1 -0
- package/dist/adapters/EffectAwareGrantVerifier.js +38 -0
- package/dist/adapters/EffectAwareGrantVerifier.js.map +1 -0
- package/dist/adapters/EffectComparison.d.ts +20 -0
- package/dist/adapters/EffectComparison.d.ts.map +1 -0
- package/dist/adapters/EffectComparison.js +48 -0
- package/dist/adapters/EffectComparison.js.map +1 -0
- package/dist/adapters/EffectEvidenceBuilder.d.ts +60 -0
- package/dist/adapters/EffectEvidenceBuilder.d.ts.map +1 -0
- package/dist/adapters/EffectEvidenceBuilder.js +127 -0
- package/dist/adapters/EffectEvidenceBuilder.js.map +1 -0
- package/dist/adapters/EffectEvidenceRegister.d.ts +31 -0
- package/dist/adapters/EffectEvidenceRegister.d.ts.map +1 -0
- package/dist/adapters/EffectEvidenceRegister.js +21 -0
- package/dist/adapters/EffectEvidenceRegister.js.map +1 -0
- package/dist/adapters/JcsDigest.d.ts +43 -0
- package/dist/adapters/JcsDigest.d.ts.map +1 -0
- package/dist/adapters/JcsDigest.js +86 -0
- package/dist/adapters/JcsDigest.js.map +1 -0
- package/dist/adapters/banking/BankingAction.d.ts +146 -0
- package/dist/adapters/banking/BankingAction.d.ts.map +1 -0
- package/dist/adapters/banking/BankingAction.js +102 -0
- package/dist/adapters/banking/BankingAction.js.map +1 -0
- package/dist/adapters/banking/BankingAdapter.d.ts +60 -0
- package/dist/adapters/banking/BankingAdapter.d.ts.map +1 -0
- package/dist/adapters/banking/BankingAdapter.js +107 -0
- package/dist/adapters/banking/BankingAdapter.js.map +1 -0
- package/dist/adapters/banking/BankingHandlers.d.ts +24 -0
- package/dist/adapters/banking/BankingHandlers.d.ts.map +1 -0
- package/dist/adapters/banking/BankingHandlers.js +47 -0
- package/dist/adapters/banking/BankingHandlers.js.map +1 -0
- package/dist/adapters/banking/BankingIntentBinder.d.ts +47 -0
- package/dist/adapters/banking/BankingIntentBinder.d.ts.map +1 -0
- package/dist/adapters/banking/BankingIntentBinder.js +64 -0
- package/dist/adapters/banking/BankingIntentBinder.js.map +1 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts +55 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts.map +1 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.js +248 -0
- package/dist/adapters/banking/CoreBankingHttpAdapter.js.map +1 -0
- package/dist/adapters/banking/Currency.d.ts +10 -0
- package/dist/adapters/banking/Currency.d.ts.map +1 -0
- package/dist/adapters/banking/Currency.js +91 -0
- package/dist/adapters/banking/Currency.js.map +1 -0
- package/dist/adapters/banking/EffectProjections.d.ts +52 -0
- package/dist/adapters/banking/EffectProjections.d.ts.map +1 -0
- package/dist/adapters/banking/EffectProjections.js +140 -0
- package/dist/adapters/banking/EffectProjections.js.map +1 -0
- package/dist/adapters/banking/Iban.d.ts +18 -0
- package/dist/adapters/banking/Iban.d.ts.map +1 -0
- package/dist/adapters/banking/Iban.js +38 -0
- package/dist/adapters/banking/Iban.js.map +1 -0
- package/dist/adapters/banking/Money.d.ts +32 -0
- package/dist/adapters/banking/Money.d.ts.map +1 -0
- package/dist/adapters/banking/Money.js +81 -0
- package/dist/adapters/banking/Money.js.map +1 -0
- package/dist/adapters/banking/ReasonCodes.d.ts +19 -0
- package/dist/adapters/banking/ReasonCodes.d.ts.map +1 -0
- package/dist/adapters/banking/ReasonCodes.js +35 -0
- package/dist/adapters/banking/ReasonCodes.js.map +1 -0
- package/dist/audit/ChainJournal.d.ts +38 -0
- package/dist/audit/ChainJournal.d.ts.map +1 -0
- package/dist/audit/ChainJournal.js +97 -0
- package/dist/audit/ChainJournal.js.map +1 -0
- package/dist/audit/HashChain.d.ts +39 -0
- package/dist/audit/HashChain.d.ts.map +1 -0
- package/dist/audit/HashChain.js +63 -0
- package/dist/audit/HashChain.js.map +1 -0
- package/dist/audit/HashChainedAuditSink.d.ts +22 -0
- package/dist/audit/HashChainedAuditSink.d.ts.map +1 -0
- package/dist/audit/HashChainedAuditSink.js +26 -0
- package/dist/audit/HashChainedAuditSink.js.map +1 -0
- package/dist/audit/LineAuditSink.d.ts +19 -0
- package/dist/audit/LineAuditSink.d.ts.map +1 -0
- package/dist/audit/LineAuditSink.js +35 -0
- package/dist/audit/LineAuditSink.js.map +1 -0
- package/dist/cli/Arguments.d.ts +26 -0
- package/dist/cli/Arguments.d.ts.map +1 -0
- package/dist/cli/Arguments.js +66 -0
- package/dist/cli/Arguments.js.map +1 -0
- package/dist/cli/CliProcess.d.ts +29 -0
- package/dist/cli/CliProcess.d.ts.map +1 -0
- package/dist/cli/CliProcess.js +78 -0
- package/dist/cli/CliProcess.js.map +1 -0
- package/dist/cli/Commands.d.ts +8 -0
- package/dist/cli/Commands.d.ts.map +1 -0
- package/dist/cli/Commands.js +67 -0
- package/dist/cli/Commands.js.map +1 -0
- package/dist/cli/ConfigCommand.d.ts +7 -0
- package/dist/cli/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/ConfigCommand.js +77 -0
- package/dist/cli/ConfigCommand.js.map +1 -0
- package/dist/cli/ConfigFile.d.ts +21 -0
- package/dist/cli/ConfigFile.d.ts.map +1 -0
- package/dist/cli/ConfigFile.js +57 -0
- package/dist/cli/ConfigFile.js.map +1 -0
- package/dist/cli/Credentials.d.ts +15 -0
- package/dist/cli/Credentials.d.ts.map +1 -0
- package/dist/cli/Credentials.js +51 -0
- package/dist/cli/Credentials.js.map +1 -0
- package/dist/cli/Doctor.d.ts +25 -0
- package/dist/cli/Doctor.d.ts.map +1 -0
- package/dist/cli/Doctor.js +211 -0
- package/dist/cli/Doctor.js.map +1 -0
- package/dist/cli/Help.d.ts +3 -0
- package/dist/cli/Help.d.ts.map +1 -0
- package/dist/cli/Help.js +38 -0
- package/dist/cli/Help.js.map +1 -0
- package/dist/cli/Init.d.ts +32 -0
- package/dist/cli/Init.d.ts.map +1 -0
- package/dist/cli/Init.js +163 -0
- package/dist/cli/Init.js.map +1 -0
- package/dist/cli/Login.d.ts +16 -0
- package/dist/cli/Login.d.ts.map +1 -0
- package/dist/cli/Login.js +74 -0
- package/dist/cli/Login.js.map +1 -0
- package/dist/cli/Proxy.d.ts +41 -0
- package/dist/cli/Proxy.d.ts.map +1 -0
- package/dist/cli/Proxy.js +161 -0
- package/dist/cli/Proxy.js.map +1 -0
- package/dist/cli/Status.d.ts +7 -0
- package/dist/cli/Status.d.ts.map +1 -0
- package/dist/cli/Status.js +64 -0
- package/dist/cli/Status.js.map +1 -0
- package/dist/cli/TestCommand.d.ts +36 -0
- package/dist/cli/TestCommand.d.ts.map +1 -0
- package/dist/cli/TestCommand.js +173 -0
- package/dist/cli/TestCommand.js.map +1 -0
- package/dist/config/ConfigKeys.d.ts +10 -0
- package/dist/config/ConfigKeys.d.ts.map +1 -0
- package/dist/config/ConfigKeys.js +105 -0
- package/dist/config/ConfigKeys.js.map +1 -0
- package/dist/config/ExecutorConfig.d.ts +254 -0
- package/dist/config/ExecutorConfig.d.ts.map +1 -0
- package/dist/config/ExecutorConfig.js +637 -0
- package/dist/config/ExecutorConfig.js.map +1 -0
- package/dist/containment/ContainmentProbe.d.ts +87 -0
- package/dist/containment/ContainmentProbe.d.ts.map +1 -0
- package/dist/containment/ContainmentProbe.js +103 -0
- package/dist/containment/ContainmentProbe.js.map +1 -0
- package/dist/credential/CredentialError.d.ts +6 -0
- package/dist/credential/CredentialError.d.ts.map +1 -0
- package/dist/credential/CredentialError.js +10 -0
- package/dist/credential/CredentialError.js.map +1 -0
- package/dist/credential/DownstreamCredential.d.ts +38 -0
- package/dist/credential/DownstreamCredential.d.ts.map +1 -0
- package/dist/credential/DownstreamCredential.js +2 -0
- package/dist/credential/DownstreamCredential.js.map +1 -0
- package/dist/credential/GrantOf.d.ts +10 -0
- package/dist/credential/GrantOf.d.ts.map +1 -0
- package/dist/credential/GrantOf.js +16 -0
- package/dist/credential/GrantOf.js.map +1 -0
- package/dist/credential/PrivateKeyJwtCredential.d.ts +43 -0
- package/dist/credential/PrivateKeyJwtCredential.d.ts.map +1 -0
- package/dist/credential/PrivateKeyJwtCredential.js +126 -0
- package/dist/credential/PrivateKeyJwtCredential.js.map +1 -0
- package/dist/credential/SignedRequestCredential.d.ts +112 -0
- package/dist/credential/SignedRequestCredential.d.ts.map +1 -0
- package/dist/credential/SignedRequestCredential.js +255 -0
- package/dist/credential/SignedRequestCredential.js.map +1 -0
- package/dist/credential/StaticHeaderCredential.d.ts +16 -0
- package/dist/credential/StaticHeaderCredential.d.ts.map +1 -0
- package/dist/credential/StaticHeaderCredential.js +21 -0
- package/dist/credential/StaticHeaderCredential.js.map +1 -0
- package/dist/egress/EgressError.d.ts +13 -0
- package/dist/egress/EgressError.d.ts.map +1 -0
- package/dist/egress/EgressError.js +16 -0
- package/dist/egress/EgressError.js.map +1 -0
- package/dist/egress/EgressPolicy.d.ts +55 -0
- package/dist/egress/EgressPolicy.d.ts.map +1 -0
- package/dist/egress/EgressPolicy.js +137 -0
- package/dist/egress/EgressPolicy.js.map +1 -0
- package/dist/egress/GlobalFetchLock.d.ts +16 -0
- package/dist/egress/GlobalFetchLock.d.ts.map +1 -0
- package/dist/egress/GlobalFetchLock.js +34 -0
- package/dist/egress/GlobalFetchLock.js.map +1 -0
- package/dist/egress/GuardedFetch.d.ts +56 -0
- package/dist/egress/GuardedFetch.d.ts.map +1 -0
- package/dist/egress/GuardedFetch.js +300 -0
- package/dist/egress/GuardedFetch.js.map +1 -0
- package/dist/egress/TcpProbe.d.ts +35 -0
- package/dist/egress/TcpProbe.d.ts.map +1 -0
- package/dist/egress/TcpProbe.js +45 -0
- package/dist/egress/TcpProbe.js.map +1 -0
- package/dist/gateway/Activation.d.ts +39 -0
- package/dist/gateway/Activation.d.ts.map +1 -0
- package/dist/gateway/Activation.js +61 -0
- package/dist/gateway/Activation.js.map +1 -0
- package/dist/gateway/BoundaryTest.d.ts +92 -0
- package/dist/gateway/BoundaryTest.d.ts.map +1 -0
- package/dist/gateway/BoundaryTest.js +349 -0
- package/dist/gateway/BoundaryTest.js.map +1 -0
- package/dist/gateway/DemoAuthority.d.ts +41 -0
- package/dist/gateway/DemoAuthority.d.ts.map +1 -0
- package/dist/gateway/DemoAuthority.js +66 -0
- package/dist/gateway/DemoAuthority.js.map +1 -0
- package/dist/gateway/ForwardHandler.d.ts +56 -0
- package/dist/gateway/ForwardHandler.d.ts.map +1 -0
- package/dist/gateway/ForwardHandler.js +111 -0
- package/dist/gateway/ForwardHandler.js.map +1 -0
- package/dist/gateway/Gateway.d.ts +142 -0
- package/dist/gateway/Gateway.d.ts.map +1 -0
- package/dist/gateway/Gateway.js +819 -0
- package/dist/gateway/Gateway.js.map +1 -0
- package/dist/gateway/GatewayConfig.d.ts +237 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -0
- package/dist/gateway/GatewayConfig.js +706 -0
- package/dist/gateway/GatewayConfig.js.map +1 -0
- package/dist/gateway/GatewayMetrics.d.ts +26 -0
- package/dist/gateway/GatewayMetrics.d.ts.map +1 -0
- package/dist/gateway/GatewayMetrics.js +28 -0
- package/dist/gateway/GatewayMetrics.js.map +1 -0
- package/dist/gateway/GatewayReport.d.ts +74 -0
- package/dist/gateway/GatewayReport.d.ts.map +1 -0
- package/dist/gateway/GatewayReport.js +109 -0
- package/dist/gateway/GatewayReport.js.map +1 -0
- package/dist/gateway/InterceptedRequest.d.ts +53 -0
- package/dist/gateway/InterceptedRequest.d.ts.map +1 -0
- package/dist/gateway/InterceptedRequest.js +80 -0
- package/dist/gateway/InterceptedRequest.js.map +1 -0
- package/dist/gateway/RouteTable.d.ts +28 -0
- package/dist/gateway/RouteTable.d.ts.map +1 -0
- package/dist/gateway/RouteTable.js +72 -0
- package/dist/gateway/RouteTable.js.map +1 -0
- package/dist/gateway/Upstream.d.ts +46 -0
- package/dist/gateway/Upstream.d.ts.map +1 -0
- package/dist/gateway/Upstream.js +158 -0
- package/dist/gateway/Upstream.js.map +1 -0
- package/dist/handlers/ForwardRequestHandler.d.ts +26 -0
- package/dist/handlers/ForwardRequestHandler.d.ts.map +1 -0
- package/dist/handlers/ForwardRequestHandler.js +98 -0
- package/dist/handlers/ForwardRequestHandler.js.map +1 -0
- package/dist/handlers/HandlerRegistration.d.ts +37 -0
- package/dist/handlers/HandlerRegistration.d.ts.map +1 -0
- package/dist/handlers/HandlerRegistration.js +2 -0
- package/dist/handlers/HandlerRegistration.js.map +1 -0
- package/dist/handlers/JournaledActionHandler.d.ts +31 -0
- package/dist/handlers/JournaledActionHandler.d.ts.map +1 -0
- package/dist/handlers/JournaledActionHandler.js +63 -0
- package/dist/handlers/JournaledActionHandler.js.map +1 -0
- package/dist/http/ExecutorHttpServer.d.ts +33 -0
- package/dist/http/ExecutorHttpServer.d.ts.map +1 -0
- package/dist/http/ExecutorHttpServer.js +176 -0
- package/dist/http/ExecutorHttpServer.js.map +1 -0
- package/dist/http/GatewayHttpServer.d.ts +42 -0
- package/dist/http/GatewayHttpServer.d.ts.map +1 -0
- package/dist/http/GatewayHttpServer.js +195 -0
- package/dist/http/GatewayHttpServer.js.map +1 -0
- package/dist/http/RecordingTarget.d.ts +18 -0
- package/dist/http/RecordingTarget.d.ts.map +1 -0
- package/dist/http/RecordingTarget.js +71 -0
- package/dist/http/RecordingTarget.js.map +1 -0
- package/dist/http/RequestContext.d.ts +17 -0
- package/dist/http/RequestContext.d.ts.map +1 -0
- package/dist/http/RequestContext.js +19 -0
- package/dist/http/RequestContext.js.map +1 -0
- package/dist/http/Routes.d.ts +93 -0
- package/dist/http/Routes.d.ts.map +1 -0
- package/dist/http/Routes.js +46 -0
- package/dist/http/Routes.js.map +1 -0
- package/dist/http/TlsListener.d.ts +38 -0
- package/dist/http/TlsListener.d.ts.map +1 -0
- package/dist/http/TlsListener.js +52 -0
- package/dist/http/TlsListener.js.map +1 -0
- package/dist/identity/Authenticator.d.ts +58 -0
- package/dist/identity/Authenticator.d.ts.map +1 -0
- package/dist/identity/Authenticator.js +170 -0
- package/dist/identity/Authenticator.js.map +1 -0
- package/dist/identity/PeerIdentity.d.ts +24 -0
- package/dist/identity/PeerIdentity.d.ts.map +1 -0
- package/dist/identity/PeerIdentity.js +29 -0
- package/dist/identity/PeerIdentity.js.map +1 -0
- package/dist/identity/PrincipalRegistry.d.ts +102 -0
- package/dist/identity/PrincipalRegistry.d.ts.map +1 -0
- package/dist/identity/PrincipalRegistry.js +191 -0
- package/dist/identity/PrincipalRegistry.js.map +1 -0
- package/dist/identity/PrincipalsFile.d.ts +152 -0
- package/dist/identity/PrincipalsFile.d.ts.map +1 -0
- package/dist/identity/PrincipalsFile.js +125 -0
- package/dist/identity/PrincipalsFile.js.map +1 -0
- package/dist/identity/RateLimiter.d.ts +43 -0
- package/dist/identity/RateLimiter.d.ts.map +1 -0
- package/dist/identity/RateLimiter.js +84 -0
- package/dist/identity/RateLimiter.js.map +1 -0
- package/dist/identity/SeparationOfDuties.d.ts +11 -0
- package/dist/identity/SeparationOfDuties.d.ts.map +1 -0
- package/dist/identity/SeparationOfDuties.js +25 -0
- package/dist/identity/SeparationOfDuties.js.map +1 -0
- package/dist/identity/WorkloadJwtVerifier.d.ts +57 -0
- package/dist/identity/WorkloadJwtVerifier.d.ts.map +1 -0
- package/dist/identity/WorkloadJwtVerifier.js +145 -0
- package/dist/identity/WorkloadJwtVerifier.js.map +1 -0
- package/dist/incident/EvidenceExport.d.ts +128 -0
- package/dist/incident/EvidenceExport.d.ts.map +1 -0
- package/dist/incident/EvidenceExport.js +187 -0
- package/dist/incident/EvidenceExport.js.map +1 -0
- package/dist/incident/FileProbe.d.ts +22 -0
- package/dist/incident/FileProbe.d.ts.map +1 -0
- package/dist/incident/FileProbe.js +31 -0
- package/dist/incident/FileProbe.js.map +1 -0
- package/dist/incident/HaltSwitch.d.ts +95 -0
- package/dist/incident/HaltSwitch.d.ts.map +1 -0
- package/dist/incident/HaltSwitch.js +171 -0
- package/dist/incident/HaltSwitch.js.map +1 -0
- package/dist/incident/Metrics.d.ts +71 -0
- package/dist/incident/Metrics.d.ts.map +1 -0
- package/dist/incident/Metrics.js +146 -0
- package/dist/incident/Metrics.js.map +1 -0
- package/dist/incident/SecurityEvents.d.ts +182 -0
- package/dist/incident/SecurityEvents.d.ts.map +1 -0
- package/dist/incident/SecurityEvents.js +167 -0
- package/dist/incident/SecurityEvents.js.map +1 -0
- package/dist/journal/ExecutionJournal.d.ts +96 -0
- package/dist/journal/ExecutionJournal.d.ts.map +1 -0
- package/dist/journal/ExecutionJournal.js +100 -0
- package/dist/journal/ExecutionJournal.js.map +1 -0
- package/dist/journal/FileExecutionJournal.d.ts +38 -0
- package/dist/journal/FileExecutionJournal.d.ts.map +1 -0
- package/dist/journal/FileExecutionJournal.js +137 -0
- package/dist/journal/FileExecutionJournal.js.map +1 -0
- package/dist/journal/InMemoryExecutionJournal.d.ts +23 -0
- package/dist/journal/InMemoryExecutionJournal.d.ts.map +1 -0
- package/dist/journal/InMemoryExecutionJournal.js +47 -0
- package/dist/journal/InMemoryExecutionJournal.js.map +1 -0
- package/dist/journal/StartupReconciler.d.ts +47 -0
- package/dist/journal/StartupReconciler.d.ts.map +1 -0
- package/dist/journal/StartupReconciler.js +89 -0
- package/dist/journal/StartupReconciler.js.map +1 -0
- package/dist/limits/HardLimits.d.ts +63 -0
- package/dist/limits/HardLimits.d.ts.map +1 -0
- package/dist/limits/HardLimits.js +120 -0
- package/dist/limits/HardLimits.js.map +1 -0
- package/dist/logging/LineEmitter.d.ts +26 -0
- package/dist/logging/LineEmitter.d.ts.map +1 -0
- package/dist/logging/LineEmitter.js +36 -0
- package/dist/logging/LineEmitter.js.map +1 -0
- package/dist/posture/HostPosture.d.ts +60 -0
- package/dist/posture/HostPosture.d.ts.map +1 -0
- package/dist/posture/HostPosture.js +104 -0
- package/dist/posture/HostPosture.js.map +1 -0
- package/dist/posture/PostureChecks.d.ts +52 -0
- package/dist/posture/PostureChecks.d.ts.map +1 -0
- package/dist/posture/PostureChecks.js +172 -0
- package/dist/posture/PostureChecks.js.map +1 -0
- package/dist/secrets/CompositeSecretStore.d.ts +37 -0
- package/dist/secrets/CompositeSecretStore.d.ts.map +1 -0
- package/dist/secrets/CompositeSecretStore.js +99 -0
- package/dist/secrets/CompositeSecretStore.js.map +1 -0
- package/dist/secrets/EnvSecretStore.d.ts +18 -0
- package/dist/secrets/EnvSecretStore.d.ts.map +1 -0
- package/dist/secrets/EnvSecretStore.js +46 -0
- package/dist/secrets/EnvSecretStore.js.map +1 -0
- package/dist/secrets/FileSecretStore.d.ts +60 -0
- package/dist/secrets/FileSecretStore.d.ts.map +1 -0
- package/dist/secrets/FileSecretStore.js +180 -0
- package/dist/secrets/FileSecretStore.js.map +1 -0
- package/dist/secrets/Redactor.d.ts +32 -0
- package/dist/secrets/Redactor.d.ts.map +1 -0
- package/dist/secrets/Redactor.js +108 -0
- package/dist/secrets/Redactor.js.map +1 -0
- package/dist/secrets/SecretHandle.d.ts +34 -0
- package/dist/secrets/SecretHandle.d.ts.map +1 -0
- package/dist/secrets/SecretHandle.js +71 -0
- package/dist/secrets/SecretHandle.js.map +1 -0
- package/dist/secrets/SecretStore.d.ts +37 -0
- package/dist/secrets/SecretStore.d.ts.map +1 -0
- package/dist/secrets/SecretStore.js +12 -0
- package/dist/secrets/SecretStore.js.map +1 -0
- package/dist/service/AuthorityClients.d.ts +50 -0
- package/dist/service/AuthorityClients.d.ts.map +1 -0
- package/dist/service/AuthorityClients.js +83 -0
- package/dist/service/AuthorityClients.js.map +1 -0
- package/dist/service/EscalationResolver.d.ts +97 -0
- package/dist/service/EscalationResolver.d.ts.map +1 -0
- package/dist/service/EscalationResolver.js +196 -0
- package/dist/service/EscalationResolver.js.map +1 -0
- package/dist/service/Requests.d.ts +99 -0
- package/dist/service/Requests.d.ts.map +1 -0
- package/dist/service/Requests.js +42 -0
- package/dist/service/Requests.js.map +1 -0
- package/dist/service/ServiceError.d.ts +20 -0
- package/dist/service/ServiceError.d.ts.map +1 -0
- package/dist/service/ServiceError.js +25 -0
- package/dist/service/ServiceError.js.map +1 -0
- package/dist/service/TrustedExecutorService.d.ts +221 -0
- package/dist/service/TrustedExecutorService.d.ts.map +1 -0
- package/dist/service/TrustedExecutorService.js +1066 -0
- package/dist/service/TrustedExecutorService.js.map +1 -0
- package/dist/time/ClockSkewGuard.d.ts +25 -0
- package/dist/time/ClockSkewGuard.d.ts.map +1 -0
- package/dist/time/ClockSkewGuard.js +35 -0
- package/dist/time/ClockSkewGuard.js.map +1 -0
- package/dist/time/MonotonicClock.d.ts +35 -0
- package/dist/time/MonotonicClock.d.ts.map +1 -0
- package/dist/time/MonotonicClock.js +52 -0
- package/dist/time/MonotonicClock.js.map +1 -0
- package/dist/verify/VerifyAuditChain.d.ts +36 -0
- package/dist/verify/VerifyAuditChain.d.ts.map +1 -0
- package/dist/verify/VerifyAuditChain.js +109 -0
- package/dist/verify/VerifyAuditChain.js.map +1 -0
- package/dist/verify/VerifyEvidenceBundle.d.ts +50 -0
- package/dist/verify/VerifyEvidenceBundle.d.ts.map +1 -0
- package/dist/verify/VerifyEvidenceBundle.js +157 -0
- package/dist/verify/VerifyEvidenceBundle.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { SecretHandle } from "../secrets/SecretHandle.js";
|
|
2
|
+
import type { DownstreamCredential, DownstreamRequest } from "./DownstreamCredential.js";
|
|
3
|
+
export type SignedRequestAlgorithm = "ed25519" | "hmac-sha256";
|
|
4
|
+
export interface SignedRequestOptions {
|
|
5
|
+
readonly algorithm: SignedRequestAlgorithm;
|
|
6
|
+
readonly keyId: string;
|
|
7
|
+
}
|
|
8
|
+
/** Covered on every request: what was sent, to where, for which intent. */
|
|
9
|
+
export declare const BASE_COMPONENTS: readonly ["@method", "@path", "content-digest", "idempotency-key", "x-agent-safe-intent-hash"];
|
|
10
|
+
/** Covered on a dispatch: which grant, and which decision, this request executes under. */
|
|
11
|
+
export declare const GRANT_COMPONENTS: readonly ["x-agent-safe-grant-id", "x-agent-safe-decision-id"];
|
|
12
|
+
/** Covered when the authority attested the claim: its proof, bound to this request. */
|
|
13
|
+
export declare const ATTESTATION_COMPONENT: "x-agent-safe-claim-attestation";
|
|
14
|
+
/** Every component this credential can cover, in the order the base lists them. */
|
|
15
|
+
export declare const SIGNED_COMPONENTS: readonly ["@method", "@path", "content-digest", "idempotency-key", "x-agent-safe-intent-hash", "x-agent-safe-grant-id", "x-agent-safe-decision-id", "x-agent-safe-claim-attestation"];
|
|
16
|
+
export type SignedComponent = (typeof SIGNED_COMPONENTS)[number];
|
|
17
|
+
export declare const SIGNATURE_LABEL = "agentsafe";
|
|
18
|
+
/** What a verifier on the downstream side needs to rebuild the base. */
|
|
19
|
+
export interface SignedRequestMaterial {
|
|
20
|
+
readonly method: string;
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly body: string | null;
|
|
23
|
+
readonly idempotencyKey: string;
|
|
24
|
+
readonly intentHash: string;
|
|
25
|
+
readonly grantId?: string;
|
|
26
|
+
readonly decisionId?: string;
|
|
27
|
+
readonly claimAttestation?: string;
|
|
28
|
+
}
|
|
29
|
+
/** What a downstream may insist the signature cover before it acts. */
|
|
30
|
+
export interface SignedRequestVerification {
|
|
31
|
+
/**
|
|
32
|
+
* Components that must be among the covered ones. A system of record that
|
|
33
|
+
* effects anything requires the grant pair and the attestation; a read that
|
|
34
|
+
* effects nothing may accept the base alone. The base is always required.
|
|
35
|
+
*/
|
|
36
|
+
readonly require?: readonly SignedComponent[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* RFC 9421 HTTP message signatures with an RFC 9530 content digest. The base
|
|
40
|
+
* always covers the method, the path, the body's digest, the idempotency key
|
|
41
|
+
* and the intent hash, so the downstream can prove that this process,
|
|
42
|
+
* holding this key, sent this request for this intent. A dispatch also
|
|
43
|
+
* covers the grant id and the decision id, and, when the authority attested
|
|
44
|
+
* the claim, the attestation itself: then the downstream can prove that the
|
|
45
|
+
* authority claimed this grant for this intent, which is the difference
|
|
46
|
+
* between refusing an unsigned instruction and refusing an unauthorized one.
|
|
47
|
+
*
|
|
48
|
+
* `signature-input` names exactly what was covered, and the verifier rebuilds
|
|
49
|
+
* from that rather than from a fixed list: a request that carries a grant
|
|
50
|
+
* header the signature does not cover proves nothing about that grant. The
|
|
51
|
+
* handler must send every covered header with the value it asked the
|
|
52
|
+
* credential to sign; the reference handlers do. Ed25519 or HMAC-SHA256;
|
|
53
|
+
* the key is a secret handle read at each request.
|
|
54
|
+
*/
|
|
55
|
+
export declare class SignedRequestCredential implements DownstreamCredential {
|
|
56
|
+
private readonly options;
|
|
57
|
+
private readonly key;
|
|
58
|
+
private readonly clock;
|
|
59
|
+
readonly kind: "SIGNED_REQUEST";
|
|
60
|
+
constructor(options: SignedRequestOptions, key: () => SecretHandle, clock?: () => number);
|
|
61
|
+
/** The RFC 9530 digest of a body, the empty body included. */
|
|
62
|
+
static contentDigest(body: string | null): string;
|
|
63
|
+
/** The components this material can cover, in base order. */
|
|
64
|
+
static componentsFor(material: SignedRequestMaterial): readonly SignedComponent[];
|
|
65
|
+
/** The signature parameters, as they appear in `signature-input` and at the base's end. */
|
|
66
|
+
static parameters(created: number, keyId: string, algorithm: SignedRequestAlgorithm, components?: readonly SignedComponent[]): string;
|
|
67
|
+
/** The covered components a `signature-input` names, or null when it names one this credential does not know. */
|
|
68
|
+
static coveredComponents(parameters: string): readonly SignedComponent[] | null;
|
|
69
|
+
/** One line of the base, or null when the material cannot supply the component. */
|
|
70
|
+
private static line;
|
|
71
|
+
/**
|
|
72
|
+
* The signature base, exactly as both sides must build it: one line per
|
|
73
|
+
* covered component in the order `parameters` lists them, then the
|
|
74
|
+
* parameters. Null when the parameters name a component the material does
|
|
75
|
+
* not have, which on the signing side is a bug and on the verifying side
|
|
76
|
+
* is a request that does not carry what its signature claims to cover.
|
|
77
|
+
*/
|
|
78
|
+
static base(material: SignedRequestMaterial, parameters: string): string | null;
|
|
79
|
+
/**
|
|
80
|
+
* What the downstream runs: read which components the signature covers,
|
|
81
|
+
* refuse if any it requires is missing, rebuild the base from the request
|
|
82
|
+
* it received, then check the signature with the public key (Ed25519) or
|
|
83
|
+
* the shared secret (HMAC-SHA256). The base five are always required; a
|
|
84
|
+
* system of record passes the grant pair and the attestation too.
|
|
85
|
+
*
|
|
86
|
+
* The base is built from `material`, which is what the downstream will act
|
|
87
|
+
* on. A header that says something else is not checked separately: if the
|
|
88
|
+
* two disagree, the base differs from the one that was signed and the
|
|
89
|
+
* signature fails, which is the refusal that matters.
|
|
90
|
+
*/
|
|
91
|
+
static verify(material: SignedRequestMaterial, headers: Readonly<Record<string, string>>, verifier: {
|
|
92
|
+
readonly publicKeyPem: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly secret: Uint8Array;
|
|
95
|
+
}, verification?: SignedRequestVerification): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The material a downstream rebuilds from the request it received. The
|
|
98
|
+
* grant fields come from the headers only when present, so a request that
|
|
99
|
+
* carries none is verified against the base and refused by a downstream
|
|
100
|
+
* that requires more.
|
|
101
|
+
*/
|
|
102
|
+
static materialFrom(received: {
|
|
103
|
+
readonly method: string;
|
|
104
|
+
readonly path: string;
|
|
105
|
+
readonly body: string | null;
|
|
106
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
107
|
+
}): SignedRequestMaterial;
|
|
108
|
+
/** The headers a handler must send beside the signature, with the values the signature covers. */
|
|
109
|
+
static coveredHeaders(request: DownstreamRequest): Readonly<Record<string, string>>;
|
|
110
|
+
headersFor(request: DownstreamRequest): Promise<Readonly<Record<string, string>>>;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=SignedRequestCredential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedRequestCredential.d.ts","sourceRoot":"","sources":["../../src/credential/SignedRequestCredential.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEzF,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,aAAa,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe,gGAMlB,CAAC;AAEX,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,gEAAiE,CAAC;AAE/F,uFAAuF;AACvF,eAAO,MAAM,qBA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C/F"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createHash, createHmac, createPrivateKey, createPublicKey, sign, timingSafeEqual, verify, } from "node:crypto";
|
|
2
|
+
/** Covered on every request: what was sent, to where, for which intent. */
|
|
3
|
+
export const BASE_COMPONENTS = [
|
|
4
|
+
"@method",
|
|
5
|
+
"@path",
|
|
6
|
+
"content-digest",
|
|
7
|
+
"idempotency-key",
|
|
8
|
+
"x-agent-safe-intent-hash",
|
|
9
|
+
];
|
|
10
|
+
/** Covered on a dispatch: which grant, and which decision, this request executes under. */
|
|
11
|
+
export const GRANT_COMPONENTS = ["x-agent-safe-grant-id", "x-agent-safe-decision-id"];
|
|
12
|
+
/** Covered when the authority attested the claim: its proof, bound to this request. */
|
|
13
|
+
export const ATTESTATION_COMPONENT = "x-agent-safe-claim-attestation";
|
|
14
|
+
/** Every component this credential can cover, in the order the base lists them. */
|
|
15
|
+
export const SIGNED_COMPONENTS = [
|
|
16
|
+
...BASE_COMPONENTS,
|
|
17
|
+
...GRANT_COMPONENTS,
|
|
18
|
+
ATTESTATION_COMPONENT,
|
|
19
|
+
];
|
|
20
|
+
export const SIGNATURE_LABEL = "agentsafe";
|
|
21
|
+
const COMPONENT_LIST = /^\(((?:"[^"]+"(?: |(?=\))))*)\)/;
|
|
22
|
+
/** `signature-input`: this credential's label, then the parameters from their opening parenthesis. */
|
|
23
|
+
const SIGNATURE_INPUT = /^agentsafe=(\(.*)/;
|
|
24
|
+
/** `signature`: this credential's label, then the base64 signature between colons. */
|
|
25
|
+
const SIGNATURE = /^agentsafe=:(.*):$/;
|
|
26
|
+
/**
|
|
27
|
+
* RFC 9421 HTTP message signatures with an RFC 9530 content digest. The base
|
|
28
|
+
* always covers the method, the path, the body's digest, the idempotency key
|
|
29
|
+
* and the intent hash, so the downstream can prove that this process,
|
|
30
|
+
* holding this key, sent this request for this intent. A dispatch also
|
|
31
|
+
* covers the grant id and the decision id, and, when the authority attested
|
|
32
|
+
* the claim, the attestation itself: then the downstream can prove that the
|
|
33
|
+
* authority claimed this grant for this intent, which is the difference
|
|
34
|
+
* between refusing an unsigned instruction and refusing an unauthorized one.
|
|
35
|
+
*
|
|
36
|
+
* `signature-input` names exactly what was covered, and the verifier rebuilds
|
|
37
|
+
* from that rather than from a fixed list: a request that carries a grant
|
|
38
|
+
* header the signature does not cover proves nothing about that grant. The
|
|
39
|
+
* handler must send every covered header with the value it asked the
|
|
40
|
+
* credential to sign; the reference handlers do. Ed25519 or HMAC-SHA256;
|
|
41
|
+
* the key is a secret handle read at each request.
|
|
42
|
+
*/
|
|
43
|
+
export class SignedRequestCredential {
|
|
44
|
+
options;
|
|
45
|
+
key;
|
|
46
|
+
clock;
|
|
47
|
+
kind = "SIGNED_REQUEST";
|
|
48
|
+
constructor(options, key, clock = () => Date.now()) {
|
|
49
|
+
this.options = options;
|
|
50
|
+
this.key = key;
|
|
51
|
+
this.clock = clock;
|
|
52
|
+
}
|
|
53
|
+
/** The RFC 9530 digest of a body, the empty body included. */
|
|
54
|
+
static contentDigest(body) {
|
|
55
|
+
return `sha-256=:${createHash("sha256")
|
|
56
|
+
.update(body ?? "")
|
|
57
|
+
.digest("base64")}:`;
|
|
58
|
+
}
|
|
59
|
+
/** The components this material can cover, in base order. */
|
|
60
|
+
static componentsFor(material) {
|
|
61
|
+
const covered = [...BASE_COMPONENTS];
|
|
62
|
+
if (material.grantId !== undefined && material.decisionId !== undefined) {
|
|
63
|
+
covered.push(...GRANT_COMPONENTS);
|
|
64
|
+
if (material.claimAttestation !== undefined)
|
|
65
|
+
covered.push(ATTESTATION_COMPONENT);
|
|
66
|
+
}
|
|
67
|
+
return covered;
|
|
68
|
+
}
|
|
69
|
+
/** The signature parameters, as they appear in `signature-input` and at the base's end. */
|
|
70
|
+
static parameters(created, keyId, algorithm, components = BASE_COMPONENTS) {
|
|
71
|
+
const list = components.map((component) => `"${component}"`).join(" ");
|
|
72
|
+
return `(${list});created=${created};keyid="${keyId}";alg="${algorithm}"`;
|
|
73
|
+
}
|
|
74
|
+
/** The covered components a `signature-input` names, or null when it names one this credential does not know. */
|
|
75
|
+
static coveredComponents(parameters) {
|
|
76
|
+
const list = COMPONENT_LIST.exec(parameters)?.[1];
|
|
77
|
+
if (list === undefined)
|
|
78
|
+
return null;
|
|
79
|
+
const names = list.length === 0 ? [] : list.split(" ").map((quoted) => quoted.slice(1, -1));
|
|
80
|
+
const known = new Set(SIGNED_COMPONENTS);
|
|
81
|
+
if (names.some((name) => !known.has(name)) || new Set(names).size !== names.length)
|
|
82
|
+
return null;
|
|
83
|
+
return names;
|
|
84
|
+
}
|
|
85
|
+
/** One line of the base, or null when the material cannot supply the component. */
|
|
86
|
+
static line(component, material) {
|
|
87
|
+
switch (component) {
|
|
88
|
+
case "@method":
|
|
89
|
+
return `"@method": ${material.method.toUpperCase()}`;
|
|
90
|
+
case "@path":
|
|
91
|
+
return `"@path": ${material.path}`;
|
|
92
|
+
case "content-digest":
|
|
93
|
+
return `"content-digest": ${SignedRequestCredential.contentDigest(material.body)}`;
|
|
94
|
+
case "idempotency-key":
|
|
95
|
+
return `"idempotency-key": ${material.idempotencyKey}`;
|
|
96
|
+
case "x-agent-safe-intent-hash":
|
|
97
|
+
return `"x-agent-safe-intent-hash": ${material.intentHash}`;
|
|
98
|
+
case "x-agent-safe-grant-id":
|
|
99
|
+
return material.grantId === undefined
|
|
100
|
+
? null
|
|
101
|
+
: `"x-agent-safe-grant-id": ${material.grantId}`;
|
|
102
|
+
case "x-agent-safe-decision-id":
|
|
103
|
+
return material.decisionId === undefined
|
|
104
|
+
? null
|
|
105
|
+
: `"x-agent-safe-decision-id": ${material.decisionId}`;
|
|
106
|
+
case "x-agent-safe-claim-attestation":
|
|
107
|
+
return material.claimAttestation === undefined
|
|
108
|
+
? null
|
|
109
|
+
: `"x-agent-safe-claim-attestation": ${material.claimAttestation}`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The signature base, exactly as both sides must build it: one line per
|
|
114
|
+
* covered component in the order `parameters` lists them, then the
|
|
115
|
+
* parameters. Null when the parameters name a component the material does
|
|
116
|
+
* not have, which on the signing side is a bug and on the verifying side
|
|
117
|
+
* is a request that does not carry what its signature claims to cover.
|
|
118
|
+
*/
|
|
119
|
+
static base(material, parameters) {
|
|
120
|
+
const components = SignedRequestCredential.coveredComponents(parameters);
|
|
121
|
+
if (components === null)
|
|
122
|
+
return null;
|
|
123
|
+
const lines = [];
|
|
124
|
+
for (const component of components) {
|
|
125
|
+
const line = SignedRequestCredential.line(component, material);
|
|
126
|
+
if (line === null)
|
|
127
|
+
return null;
|
|
128
|
+
lines.push(line);
|
|
129
|
+
}
|
|
130
|
+
lines.push(`"@signature-params": ${parameters}`);
|
|
131
|
+
return lines.join("\n");
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* What the downstream runs: read which components the signature covers,
|
|
135
|
+
* refuse if any it requires is missing, rebuild the base from the request
|
|
136
|
+
* it received, then check the signature with the public key (Ed25519) or
|
|
137
|
+
* the shared secret (HMAC-SHA256). The base five are always required; a
|
|
138
|
+
* system of record passes the grant pair and the attestation too.
|
|
139
|
+
*
|
|
140
|
+
* The base is built from `material`, which is what the downstream will act
|
|
141
|
+
* on. A header that says something else is not checked separately: if the
|
|
142
|
+
* two disagree, the base differs from the one that was signed and the
|
|
143
|
+
* signature fails, which is the refusal that matters.
|
|
144
|
+
*/
|
|
145
|
+
static verify(material, headers, verifier, verification = {}) {
|
|
146
|
+
// Stryker disable next-line StringLiteral: an absent header and a string that is not this credential's parse the same, to nothing; the fallback satisfies the type.
|
|
147
|
+
const header = (name) => headers[name] ?? "";
|
|
148
|
+
// A `signature-input` that does not carry the label yields no covered
|
|
149
|
+
// list, which is the refusal below; the parameters need no check of
|
|
150
|
+
// their own.
|
|
151
|
+
// Stryker disable next-line StringLiteral: a non-match and any string that is not a component list parse the same, to nothing; the fallback satisfies the type.
|
|
152
|
+
const parameters = SIGNATURE_INPUT.exec(header("signature-input"))?.[1] ?? "";
|
|
153
|
+
const encoded = SIGNATURE.exec(header("signature"))?.[1];
|
|
154
|
+
if (encoded === undefined)
|
|
155
|
+
return false;
|
|
156
|
+
if (header("content-digest") !== SignedRequestCredential.contentDigest(material.body)) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const covered = SignedRequestCredential.coveredComponents(parameters);
|
|
160
|
+
if (covered === null)
|
|
161
|
+
return false;
|
|
162
|
+
for (const component of [...BASE_COMPONENTS, ...(verification.require ?? [])]) {
|
|
163
|
+
if (!covered.includes(component))
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const built = SignedRequestCredential.base(material, parameters);
|
|
167
|
+
if (built === null)
|
|
168
|
+
return false;
|
|
169
|
+
const base = Buffer.from(built);
|
|
170
|
+
const bytes = Buffer.from(encoded, "base64");
|
|
171
|
+
switch (/;alg="([a-z0-9-]+)"/.exec(parameters)?.[1]) {
|
|
172
|
+
case "ed25519":
|
|
173
|
+
return ("publicKeyPem" in verifier &&
|
|
174
|
+
verify(null, base, createPublicKey(verifier.publicKeyPem), bytes));
|
|
175
|
+
case "hmac-sha256": {
|
|
176
|
+
if (!("secret" in verifier))
|
|
177
|
+
return false;
|
|
178
|
+
const expected = createHmac("sha256", verifier.secret).update(base).digest();
|
|
179
|
+
// A MAC is compared in constant time, and only at its own length: a
|
|
180
|
+
// signature of another length is not a MAC over this base at all.
|
|
181
|
+
return bytes.length === expected.length && timingSafeEqual(expected, bytes);
|
|
182
|
+
}
|
|
183
|
+
default:
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The material a downstream rebuilds from the request it received. The
|
|
189
|
+
* grant fields come from the headers only when present, so a request that
|
|
190
|
+
* carries none is verified against the base and refused by a downstream
|
|
191
|
+
* that requires more.
|
|
192
|
+
*/
|
|
193
|
+
static materialFrom(received) {
|
|
194
|
+
const { headers } = received;
|
|
195
|
+
const grantId = headers["x-agent-safe-grant-id"];
|
|
196
|
+
const decisionId = headers["x-agent-safe-decision-id"];
|
|
197
|
+
const claimAttestation = headers["x-agent-safe-claim-attestation"];
|
|
198
|
+
return {
|
|
199
|
+
method: received.method,
|
|
200
|
+
path: received.path,
|
|
201
|
+
body: received.body,
|
|
202
|
+
idempotencyKey: headers["idempotency-key"] ?? "",
|
|
203
|
+
intentHash: headers["x-agent-safe-intent-hash"] ?? "",
|
|
204
|
+
...(grantId === undefined ? {} : { grantId }),
|
|
205
|
+
...(decisionId === undefined ? {} : { decisionId }),
|
|
206
|
+
...(claimAttestation === undefined ? {} : { claimAttestation }),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/** The headers a handler must send beside the signature, with the values the signature covers. */
|
|
210
|
+
static coveredHeaders(request) {
|
|
211
|
+
return {
|
|
212
|
+
"idempotency-key": request.idempotencyKey,
|
|
213
|
+
"x-agent-safe-intent-hash": request.intentHash,
|
|
214
|
+
...(request.grant === undefined
|
|
215
|
+
? {}
|
|
216
|
+
: {
|
|
217
|
+
"x-agent-safe-grant-id": request.grant.id,
|
|
218
|
+
"x-agent-safe-decision-id": request.grant.decisionId,
|
|
219
|
+
...(request.grant.claimAttestation === undefined
|
|
220
|
+
? {}
|
|
221
|
+
: { "x-agent-safe-claim-attestation": request.grant.claimAttestation }),
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async headersFor(request) {
|
|
226
|
+
const created = Math.floor(this.clock() / 1_000);
|
|
227
|
+
// The material is exactly what the covered headers will say, read the way
|
|
228
|
+
// a downstream reads them, so the two sides cannot drift.
|
|
229
|
+
const covered = SignedRequestCredential.coveredHeaders(request);
|
|
230
|
+
const material = SignedRequestCredential.materialFrom({
|
|
231
|
+
method: request.method,
|
|
232
|
+
path: new URL(request.url).pathname,
|
|
233
|
+
body: request.body,
|
|
234
|
+
headers: covered,
|
|
235
|
+
});
|
|
236
|
+
const parameters = SignedRequestCredential.parameters(created, this.options.keyId, this.options.algorithm, SignedRequestCredential.componentsFor(material));
|
|
237
|
+
// The components were chosen from this material one line up, so every one
|
|
238
|
+
// resolves; the branch exists so the type narrows, not because it can run.
|
|
239
|
+
const built = SignedRequestCredential.base(material, parameters);
|
|
240
|
+
// Stryker disable next-line all: unreachable by construction, and a test that reached it would be testing the type checker.
|
|
241
|
+
if (built === null)
|
|
242
|
+
throw new Error("SIGNED_REQUEST_BASE_UNBUILDABLE");
|
|
243
|
+
const base = Buffer.from(built);
|
|
244
|
+
const signature = this.key().use((material) => this.options.algorithm === "ed25519"
|
|
245
|
+
? sign(null, base, createPrivateKey(material))
|
|
246
|
+
: createHmac("sha256", material).update(base).digest());
|
|
247
|
+
return await Promise.resolve({
|
|
248
|
+
...covered,
|
|
249
|
+
"content-digest": SignedRequestCredential.contentDigest(request.body),
|
|
250
|
+
"signature-input": `${SIGNATURE_LABEL}=${parameters}`,
|
|
251
|
+
signature: `${SIGNATURE_LABEL}=:${signature.toString("base64")}:`,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=SignedRequestCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedRequestCredential.js","sourceRoot":"","sources":["../../src/credential/SignedRequestCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,eAAe,EACf,MAAM,GACP,MAAM,aAAa,CAAC;AAWrB,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS;IACT,OAAO;IACP,gBAAgB;IAChB,iBAAiB;IACjB,0BAA0B;CAClB,CAAC;AAEX,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,uBAAuB,EAAE,0BAA0B,CAAU,CAAC;AAE/F,uFAAuF;AACvF,MAAM,CAAC,MAAM,qBAAqB,GAAG,gCAAyC,CAAC;AAE/E,mFAAmF;AACnF,MAA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E,uBAAuB,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC;YACrE,iBAAiB,EAAE,GAAG,eAAe,IAAI,UAAU,EAAE;YACrD,SAAS,EAAE,GAAG,eAAe,KAAK,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;SAClE,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SecretHandle } from "../secrets/SecretHandle.js";
|
|
2
|
+
import type { DownstreamCredential } from "./DownstreamCredential.js";
|
|
3
|
+
/**
|
|
4
|
+
* The downstream expects one header carrying a static value, prefix included,
|
|
5
|
+
* as the reference deployment does. The value is read from the current
|
|
6
|
+
* handle at each dispatch, so a rotated credential is used from the next
|
|
7
|
+
* request on, and the string exists only for the request that carries it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class StaticHeaderCredential implements DownstreamCredential {
|
|
10
|
+
private readonly headerName;
|
|
11
|
+
private readonly secret;
|
|
12
|
+
readonly kind = "STATIC_HEADER";
|
|
13
|
+
constructor(headerName: string, secret: () => SecretHandle);
|
|
14
|
+
headersFor(): Promise<Readonly<Record<string, string>>>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=StaticHeaderCredential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticHeaderCredential.d.ts","sourceRoot":"","sources":["../../src/credential/StaticHeaderCredential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IAI/D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,SAAgB,IAAI,mBAAmB;gBAGpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,YAAY;IAGtC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAK/D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The downstream expects one header carrying a static value, prefix included,
|
|
3
|
+
* as the reference deployment does. The value is read from the current
|
|
4
|
+
* handle at each dispatch, so a rotated credential is used from the next
|
|
5
|
+
* request on, and the string exists only for the request that carries it.
|
|
6
|
+
*/
|
|
7
|
+
export class StaticHeaderCredential {
|
|
8
|
+
headerName;
|
|
9
|
+
secret;
|
|
10
|
+
kind = "STATIC_HEADER";
|
|
11
|
+
constructor(headerName, secret) {
|
|
12
|
+
this.headerName = headerName;
|
|
13
|
+
this.secret = secret;
|
|
14
|
+
}
|
|
15
|
+
headersFor() {
|
|
16
|
+
return Promise.resolve({
|
|
17
|
+
[this.headerName]: this.secret().use((value) => value.toString("utf8")),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=StaticHeaderCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticHeaderCredential.js","sourceRoot":"","sources":["../../src/credential/StaticHeaderCredential.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IAId;IACA;IAJH,IAAI,GAAG,eAAe,CAAC;IAEvC,YACmB,UAAkB,EAClB,MAA0B;QAD1B,eAAU,GAAV,UAAU,CAAQ;QAClB,WAAM,GAAN,MAAM,CAAoB;IAC1C,CAAC;IAEG,UAAU;QACf,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACxE,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Every way the sealed egress refuses a request, as a stable code. */
|
|
2
|
+
export type EgressCode = "EGRESS_SCHEME_NOT_ALLOWED" | "EGRESS_ORIGIN_NOT_ALLOWED" | "EGRESS_PATH_NOT_ALLOWED" | "EGRESS_ADDRESS_REFUSED" | "EGRESS_TLS_REJECTED" | "EGRESS_TLS_PIN_MISMATCH" | "EGRESS_BODY_TOO_LARGE" | "EGRESS_TIMEOUT" | "EGRESS_REDIRECT_REFUSED" | "EGRESS_RESPONSE_INVALID" | "EGRESS_INIT_UNSUPPORTED" | "EGRESS_GLOBAL_FETCH_LOCKED";
|
|
3
|
+
/**
|
|
4
|
+
* A refusal by the executor's own egress policy: the code, and the origin it
|
|
5
|
+
* concerned. Never the path, the headers, or anything from the request or
|
|
6
|
+
* the response.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EgressError extends Error {
|
|
9
|
+
readonly code: EgressCode;
|
|
10
|
+
readonly origin: string | null;
|
|
11
|
+
constructor(code: EgressCode, origin?: string | null);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=EgressError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EgressError.d.ts","sourceRoot":"","sources":["../../src/egress/EgressError.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAClB,2BAA2B,GAC3B,2BAA2B,GAC3B,yBAAyB,GACzB,wBAAwB,GACxB,qBAAqB,GACrB,yBAAyB,GACzB,uBAAuB,GACvB,gBAAgB,GAChB,yBAAyB,GACzB,yBAAyB,GACzB,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;aAElB,IAAI,EAAE,UAAU;aAChB,MAAM,EAAE,MAAM,GAAG,IAAI;gBADrB,IAAI,EAAE,UAAU,EAChB,MAAM,GAAE,MAAM,GAAG,IAAW;CAK/C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refusal by the executor's own egress policy: the code, and the origin it
|
|
3
|
+
* concerned. Never the path, the headers, or anything from the request or
|
|
4
|
+
* the response.
|
|
5
|
+
*/
|
|
6
|
+
export class EgressError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
origin;
|
|
9
|
+
constructor(code, origin = null) {
|
|
10
|
+
super(code);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.origin = origin;
|
|
13
|
+
this.name = "EgressError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=EgressError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EgressError.js","sourceRoot":"","sources":["../../src/egress/EgressError.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAElB;IACA;IAFlB,YACkB,IAAgB,EAChB,SAAwB,IAAI;QAE5C,KAAK,CAAC,IAAI,CAAC,CAAC;QAHI,SAAI,GAAJ,IAAI,CAAY;QAChB,WAAM,GAAN,MAAM,CAAsB;QAG5C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ExecutorConfig } from "../config/ExecutorConfig.js";
|
|
2
|
+
import type { EgressCode } from "./EgressError.js";
|
|
3
|
+
/** One origin this process may reach, the paths under it, and how it is trusted. */
|
|
4
|
+
export interface EgressDestination {
|
|
5
|
+
readonly origin: string;
|
|
6
|
+
readonly pathPrefixes: readonly string[];
|
|
7
|
+
/** The PEM bundle to verify the peer against; the platform's store when null. */
|
|
8
|
+
readonly ca: string | null;
|
|
9
|
+
readonly pins: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export type EgressCheck = {
|
|
12
|
+
readonly allowed: true;
|
|
13
|
+
readonly destination: EgressDestination;
|
|
14
|
+
} | {
|
|
15
|
+
readonly allowed: false;
|
|
16
|
+
readonly code: EgressCode;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The sealed allowlist of where this process may open a connection: the
|
|
20
|
+
* authority, the Presence service when this process holds that credential,
|
|
21
|
+
* and the downstream and its lookup, each with the path prefix the
|
|
22
|
+
* configuration named and the trust anchor it declared. Nothing is added at
|
|
23
|
+
* run time; a handler that reaches elsewhere is refused before a socket
|
|
24
|
+
* exists. Private address ranges are allowed by design, because that is
|
|
25
|
+
* where an institution's systems live; what a configured name must never
|
|
26
|
+
* resolve to is this host, the link, multicast, or nowhere.
|
|
27
|
+
*/
|
|
28
|
+
export declare class EgressPolicy {
|
|
29
|
+
private readonly destinations;
|
|
30
|
+
constructor(destinations: readonly EgressDestination[]);
|
|
31
|
+
/** The policy a configuration implies; CA bundles are read once, here. */
|
|
32
|
+
static fromConfig(config: ExecutorConfig, readFile: (path: string) => string): EgressPolicy;
|
|
33
|
+
get origins(): readonly string[];
|
|
34
|
+
/** Scheme, origin, then path, in that order; the first failure is the answer. */
|
|
35
|
+
check(url: URL): EgressCheck;
|
|
36
|
+
/** The prefix itself, or anything below it as a path segment; never a sibling that merely shares characters. */
|
|
37
|
+
static underPrefix(pathname: string, prefix: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a resolved address may be connected to for an origin. A loopback
|
|
40
|
+
* origin must stay on this host; any other must never resolve to this
|
|
41
|
+
* host, the link, multicast, or nowhere. The lists are built per call so
|
|
42
|
+
* that nothing about them is decided at module load.
|
|
43
|
+
*/
|
|
44
|
+
static addressRefused(address: string, loopbackOrigin: boolean): boolean;
|
|
45
|
+
/** The three loopback spellings the configuration accepts. */
|
|
46
|
+
static isLoopbackHost(hostname: string): boolean;
|
|
47
|
+
/** The origin the configuration named, exactly as the URL class spells it. */
|
|
48
|
+
static originOf(url: string): string;
|
|
49
|
+
/** The path the configuration named, cut at a placeholder such as `{idempotency_key}`. */
|
|
50
|
+
static prefixOf(url: string): string;
|
|
51
|
+
/** `sha256/<base64>` over a DER SubjectPublicKeyInfo: the pin form the configuration takes. */
|
|
52
|
+
static spkiPin(spki: Uint8Array): string;
|
|
53
|
+
private static bundle;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=EgressPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EgressPolicy.d.ts","sourceRoot":"","sources":["../../src/egress/EgressPolicy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAE3D;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;gBAEnD,YAAY,EAAE,SAAS,iBAAiB,EAAE;IAiB7D,0EAA0E;WAC5D,UAAU,CACtB,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GACjC,YAAY;IAsCf,IAAW,OAAO,IAAI,SAAS,MAAM,EAAE,CAEtC;IAED,iFAAiF;IAC1E,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW;IAmBnC,g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