@decionis/agentsafe 0.5.0 → 0.7.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/README.md +62 -19
- package/dist/Cli.js +18 -1
- package/dist/Cli.js.map +1 -1
- package/dist/Index.d.ts +9 -4
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +7 -2
- package/dist/Index.js.map +1 -1
- package/dist/TrustedExecutor.d.ts.map +1 -1
- package/dist/TrustedExecutor.js +2 -0
- package/dist/TrustedExecutor.js.map +1 -1
- package/dist/adapters/AdapterActionHandler.d.ts +36 -12
- package/dist/adapters/AdapterActionHandler.d.ts.map +1 -1
- package/dist/adapters/AdapterActionHandler.js +99 -100
- package/dist/adapters/AdapterActionHandler.js.map +1 -1
- package/dist/adapters/EffectAdapter.d.ts +7 -103
- package/dist/adapters/EffectAdapter.d.ts.map +1 -1
- package/dist/adapters/EffectAdapter.js +7 -18
- package/dist/adapters/EffectAdapter.js.map +1 -1
- package/dist/adapters/EffectAdapterExecutor.d.ts +93 -0
- package/dist/adapters/EffectAdapterExecutor.d.ts.map +1 -0
- package/dist/adapters/EffectAdapterExecutor.js +191 -0
- package/dist/adapters/EffectAdapterExecutor.js.map +1 -0
- package/dist/adapters/banking/BankingExecutor.d.ts +35 -0
- package/dist/adapters/banking/BankingExecutor.d.ts.map +1 -0
- package/dist/adapters/banking/BankingExecutor.js +64 -0
- package/dist/adapters/banking/BankingExecutor.js.map +1 -0
- package/dist/adapters/banking/BankingHandlers.d.ts.map +1 -1
- package/dist/adapters/banking/BankingHandlers.js +6 -3
- package/dist/adapters/banking/BankingHandlers.js.map +1 -1
- package/dist/adapters/cards/CardAuthorizationExecutor.d.ts +66 -0
- package/dist/adapters/cards/CardAuthorizationExecutor.d.ts.map +1 -0
- package/dist/adapters/cards/CardAuthorizationExecutor.js +116 -0
- package/dist/adapters/cards/CardAuthorizationExecutor.js.map +1 -0
- package/dist/adapters/mcp/McpGuard.d.ts +32 -3
- package/dist/adapters/mcp/McpGuard.d.ts.map +1 -1
- package/dist/adapters/mcp/McpGuard.js +29 -5
- package/dist/adapters/mcp/McpGuard.js.map +1 -1
- package/dist/adapters/mcp/McpIntentBinder.d.ts +18 -3
- package/dist/adapters/mcp/McpIntentBinder.d.ts.map +1 -1
- package/dist/adapters/mcp/McpIntentBinder.js +48 -1
- package/dist/adapters/mcp/McpIntentBinder.js.map +1 -1
- package/dist/adapters/mcp/McpInvocation.d.ts +9 -2
- package/dist/adapters/mcp/McpInvocation.d.ts.map +1 -1
- package/dist/adapters/mcp/McpInvocation.js.map +1 -1
- package/dist/cli/Actions.d.ts +14 -0
- package/dist/cli/Actions.d.ts.map +1 -0
- package/dist/cli/Actions.js +168 -0
- package/dist/cli/Actions.js.map +1 -0
- package/dist/cli/Arguments.d.ts +4 -0
- package/dist/cli/Arguments.d.ts.map +1 -1
- package/dist/cli/Arguments.js +12 -3
- package/dist/cli/Arguments.js.map +1 -1
- package/dist/cli/ConfigCommand.d.ts.map +1 -1
- package/dist/cli/ConfigCommand.js +5 -0
- package/dist/cli/ConfigCommand.js.map +1 -1
- package/dist/cli/Doctor.d.ts.map +1 -1
- package/dist/cli/Doctor.js +2 -1
- package/dist/cli/Doctor.js.map +1 -1
- package/dist/cli/Help.d.ts.map +1 -1
- package/dist/cli/Help.js +13 -1
- package/dist/cli/Help.js.map +1 -1
- package/dist/cli/Host.d.ts +5 -2
- package/dist/cli/Host.d.ts.map +1 -1
- package/dist/cli/Host.js +24 -2
- package/dist/cli/Host.js.map +1 -1
- package/dist/cli/Profile.d.ts +24 -0
- package/dist/cli/Profile.d.ts.map +1 -0
- package/dist/cli/Profile.js +168 -0
- package/dist/cli/Profile.js.map +1 -0
- package/dist/cli/Records.d.ts +15 -0
- package/dist/cli/Records.d.ts.map +1 -0
- package/dist/cli/Records.js +205 -0
- package/dist/cli/Records.js.map +1 -0
- package/dist/config/ConfigKeys.d.ts +2 -2
- package/dist/config/ConfigKeys.d.ts.map +1 -1
- package/dist/config/ConfigKeys.js +6 -0
- package/dist/config/ConfigKeys.js.map +1 -1
- package/dist/config/ExecutorConfig.d.ts +29 -0
- package/dist/config/ExecutorConfig.d.ts.map +1 -1
- package/dist/config/ExecutorConfig.js +53 -1
- package/dist/config/ExecutorConfig.js.map +1 -1
- package/dist/gateway/ForwardHandler.d.ts +22 -4
- package/dist/gateway/ForwardHandler.d.ts.map +1 -1
- package/dist/gateway/ForwardHandler.js +27 -10
- package/dist/gateway/ForwardHandler.js.map +1 -1
- package/dist/gateway/Gateway.d.ts +123 -3
- package/dist/gateway/Gateway.d.ts.map +1 -1
- package/dist/gateway/Gateway.js +513 -16
- package/dist/gateway/Gateway.js.map +1 -1
- package/dist/gateway/GatewayConfig.d.ts +109 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -1
- package/dist/gateway/GatewayConfig.js +267 -9
- package/dist/gateway/GatewayConfig.js.map +1 -1
- package/dist/gateway/GatewayReport.d.ts +6 -2
- package/dist/gateway/GatewayReport.d.ts.map +1 -1
- package/dist/gateway/GatewayReport.js +3 -0
- package/dist/gateway/GatewayReport.js.map +1 -1
- package/dist/gateway/InterceptedRequest.d.ts +45 -1
- package/dist/gateway/InterceptedRequest.d.ts.map +1 -1
- package/dist/gateway/InterceptedRequest.js +43 -1
- package/dist/gateway/InterceptedRequest.js.map +1 -1
- package/dist/gateway/PolicySelector.d.ts +5 -0
- package/dist/gateway/PolicySelector.d.ts.map +1 -0
- package/dist/gateway/PolicySelector.js +9 -0
- package/dist/gateway/PolicySelector.js.map +1 -0
- package/dist/gateway/RouteTable.d.ts +44 -7
- package/dist/gateway/RouteTable.d.ts.map +1 -1
- package/dist/gateway/RouteTable.js +58 -9
- package/dist/gateway/RouteTable.js.map +1 -1
- package/dist/gateway/SubjectSessions.d.ts +113 -0
- package/dist/gateway/SubjectSessions.d.ts.map +1 -0
- package/dist/gateway/SubjectSessions.js +219 -0
- package/dist/gateway/SubjectSessions.js.map +1 -0
- package/dist/gateway/Upstream.d.ts +11 -0
- package/dist/gateway/Upstream.d.ts.map +1 -1
- package/dist/gateway/Upstream.js +19 -2
- package/dist/gateway/Upstream.js.map +1 -1
- package/dist/hosted/TenantHost.d.ts +24 -5
- package/dist/hosted/TenantHost.d.ts.map +1 -1
- package/dist/hosted/TenantHost.js +39 -10
- package/dist/hosted/TenantHost.js.map +1 -1
- package/dist/hosted/TenantRegistry.d.ts +20 -0
- package/dist/hosted/TenantRegistry.d.ts.map +1 -1
- package/dist/hosted/TenantRegistry.js +47 -1
- package/dist/hosted/TenantRegistry.js.map +1 -1
- package/dist/http/GatewayHttpServer.d.ts.map +1 -1
- package/dist/http/GatewayHttpServer.js +46 -2
- package/dist/http/GatewayHttpServer.js.map +1 -1
- package/dist/identity/WorkloadJwtVerifier.d.ts +13 -0
- package/dist/identity/WorkloadJwtVerifier.d.ts.map +1 -1
- package/dist/identity/WorkloadJwtVerifier.js +40 -8
- package/dist/identity/WorkloadJwtVerifier.js.map +1 -1
- package/dist/incident/HaltSwitch.d.ts +10 -2
- package/dist/incident/HaltSwitch.d.ts.map +1 -1
- package/dist/incident/HaltSwitch.js +22 -2
- package/dist/incident/HaltSwitch.js.map +1 -1
- package/dist/incident/SecurityEvents.d.ts +18 -0
- package/dist/incident/SecurityEvents.d.ts.map +1 -1
- package/dist/incident/SecurityEvents.js +17 -0
- package/dist/incident/SecurityEvents.js.map +1 -1
- package/dist/journal/ExecutionJournal.d.ts +5 -120
- package/dist/journal/ExecutionJournal.d.ts.map +1 -1
- package/dist/journal/ExecutionJournal.js +5 -125
- package/dist/journal/ExecutionJournal.js.map +1 -1
- package/dist/journal/FileExecutionJournal.d.ts +1 -0
- package/dist/journal/FileExecutionJournal.d.ts.map +1 -1
- package/dist/journal/FileExecutionJournal.js +4 -1
- package/dist/journal/FileExecutionJournal.js.map +1 -1
- package/dist/journal/InMemoryExecutionJournal.d.ts +2 -1
- package/dist/journal/InMemoryExecutionJournal.d.ts.map +1 -1
- package/dist/journal/InMemoryExecutionJournal.js +4 -1
- package/dist/journal/InMemoryExecutionJournal.js.map +1 -1
- package/dist/limits/HardLimits.d.ts.map +1 -1
- package/dist/limits/HardLimits.js.map +1 -1
- package/dist/outcomes/CardOutcomeEvidence.d.ts +56 -0
- package/dist/outcomes/CardOutcomeEvidence.d.ts.map +1 -0
- package/dist/outcomes/CardOutcomeEvidence.js +211 -0
- package/dist/outcomes/CardOutcomeEvidence.js.map +1 -0
- package/dist/outcomes/CardOutcomeFact.d.ts +90 -0
- package/dist/outcomes/CardOutcomeFact.d.ts.map +1 -0
- package/dist/outcomes/CardOutcomeFact.js +76 -0
- package/dist/outcomes/CardOutcomeFact.js.map +1 -0
- package/dist/outcomes/CardOutcomeLedger.d.ts +26 -0
- package/dist/outcomes/CardOutcomeLedger.d.ts.map +1 -0
- package/dist/outcomes/CardOutcomeLedger.js +31 -0
- package/dist/outcomes/CardOutcomeLedger.js.map +1 -0
- package/dist/outcomes/CardOutcomeRecorder.d.ts +35 -0
- package/dist/outcomes/CardOutcomeRecorder.d.ts.map +1 -0
- package/dist/outcomes/CardOutcomeRecorder.js +84 -0
- package/dist/outcomes/CardOutcomeRecorder.js.map +1 -0
- package/dist/outcomes/CardOutcomes.d.ts +68 -0
- package/dist/outcomes/CardOutcomes.d.ts.map +1 -0
- package/dist/outcomes/CardOutcomes.js +191 -0
- package/dist/outcomes/CardOutcomes.js.map +1 -0
- package/dist/outcomes/CoreOutcomeEvidenceClient.d.ts +54 -0
- package/dist/outcomes/CoreOutcomeEvidenceClient.d.ts.map +1 -0
- package/dist/outcomes/CoreOutcomeEvidenceClient.js +116 -0
- package/dist/outcomes/CoreOutcomeEvidenceClient.js.map +1 -0
- package/dist/outcomes/FileCardOutcomeLedger.d.ts +36 -0
- package/dist/outcomes/FileCardOutcomeLedger.d.ts.map +1 -0
- package/dist/outcomes/FileCardOutcomeLedger.js +152 -0
- package/dist/outcomes/FileCardOutcomeLedger.js.map +1 -0
- package/dist/outcomes/OutcomeEvidence.d.ts +238 -0
- package/dist/outcomes/OutcomeEvidence.d.ts.map +1 -0
- package/dist/outcomes/OutcomeEvidence.js +130 -0
- package/dist/outcomes/OutcomeEvidence.js.map +1 -0
- package/dist/outcomes/OutcomeEvidencePublisher.d.ts +81 -0
- package/dist/outcomes/OutcomeEvidencePublisher.d.ts.map +1 -0
- package/dist/outcomes/OutcomeEvidencePublisher.js +189 -0
- package/dist/outcomes/OutcomeEvidencePublisher.js.map +1 -0
- package/dist/outcomes/OutcomeEvidenceStore.d.ts +57 -0
- package/dist/outcomes/OutcomeEvidenceStore.d.ts.map +1 -0
- package/dist/outcomes/OutcomeEvidenceStore.js +191 -0
- package/dist/outcomes/OutcomeEvidenceStore.js.map +1 -0
- package/dist/service/Requests.d.ts +6 -0
- package/dist/service/Requests.d.ts.map +1 -1
- package/dist/service/Requests.js +9 -1
- package/dist/service/Requests.js.map +1 -1
- package/dist/service/TrustedExecutorService.d.ts +21 -1
- package/dist/service/TrustedExecutorService.d.ts.map +1 -1
- package/dist/service/TrustedExecutorService.js +73 -23
- package/dist/service/TrustedExecutorService.js.map +1 -1
- package/dist/time/MonotonicClock.d.ts +4 -32
- package/dist/time/MonotonicClock.d.ts.map +1 -1
- package/dist/time/MonotonicClock.js +4 -49
- package/dist/time/MonotonicClock.js.map +1 -1
- package/dist/verify/VerifyingProvider.d.ts +32 -6
- package/dist/verify/VerifyingProvider.d.ts.map +1 -1
- package/dist/verify/VerifyingProvider.js +16 -2
- package/dist/verify/VerifyingProvider.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type ActionHandler, type ActionRegistry } from "@decionis/agent-safe-pipeline";
|
|
3
|
-
import { type HttpActionParameters, type InterceptedRequest } from "./InterceptedRequest.js";
|
|
3
|
+
import { type HttpActionParameters, type HttpFactsParameters, type InterceptedRequest } from "./InterceptedRequest.js";
|
|
4
4
|
import type { Upstream, UpstreamResult } from "./Upstream.js";
|
|
5
5
|
/** The parameters an HTTP action carries; anything else the registry refuses before a grant is spent. */
|
|
6
6
|
export declare const HttpActionParametersSchema: z.ZodObject<{
|
|
@@ -13,7 +13,24 @@ export declare const HttpActionParametersSchema: z.ZodObject<{
|
|
|
13
13
|
path: z.ZodString;
|
|
14
14
|
query: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
15
15
|
body: z.ZodOptional<z.ZodType<import("@decionis/agent-safe-pipeline").JsonValue, unknown, z.core.$ZodTypeInternals<import("@decionis/agent-safe-pipeline").JsonValue, unknown>>>;
|
|
16
|
+
policy_id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
policy_version: z.ZodOptional<z.ZodString>;
|
|
16
18
|
}, z.core.$strict>;
|
|
19
|
+
/** A facts-only HTTP action's parameters: the profile operation and its template, nothing more. */
|
|
20
|
+
export declare const HttpFactsParametersSchema: z.ZodObject<{
|
|
21
|
+
method: z.ZodEnum<{
|
|
22
|
+
POST: "POST";
|
|
23
|
+
PUT: "PUT";
|
|
24
|
+
PATCH: "PATCH";
|
|
25
|
+
DELETE: "DELETE";
|
|
26
|
+
}>;
|
|
27
|
+
operation: z.ZodString;
|
|
28
|
+
path_template: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
/** Either shape; a facts-only one is told apart by its `operation`. */
|
|
31
|
+
export type HttpParameters = HttpActionParameters | HttpFactsParameters;
|
|
32
|
+
/** What the registry admits an HTTP action's parameters against: either shape, nothing else. */
|
|
33
|
+
export declare const HttpParametersSchema: z.ZodType<HttpParameters>;
|
|
17
34
|
/** What the handler leaves behind for the relay, whichever way the attempt ended. */
|
|
18
35
|
export interface ForwardOutcome {
|
|
19
36
|
readonly response: UpstreamResult | null;
|
|
@@ -47,10 +64,11 @@ export declare class RequestHolder {
|
|
|
47
64
|
* changed between the two is a failure before dispatch, not an execution.
|
|
48
65
|
* The upstream's status is the attempt's outcome: `2xx` and `3xx` commit,
|
|
49
66
|
* `4xx` is the provider's own refusal, `5xx` and a lost connection are
|
|
50
|
-
* unknown.
|
|
67
|
+
* unknown. A facts-only intent carries no path to compare: the held request
|
|
68
|
+
* is bound by its keyed digest instead, which covers the same bytes.
|
|
51
69
|
*/
|
|
52
|
-
export declare function httpForwardHandler(upstream: Upstream, holder: RequestHolder): ActionHandler<
|
|
70
|
+
export declare function httpForwardHandler(upstream: Upstream, holder: RequestHolder, digestKey: Uint8Array): ActionHandler<HttpParameters, UpstreamResult>;
|
|
53
71
|
/** Registers the one handler under every name the route table can produce, then seals. */
|
|
54
|
-
export declare function registerHttpActions(registry: ActionRegistry, actions: readonly string[], handler: ActionHandler<
|
|
72
|
+
export declare function registerHttpActions(registry: ActionRegistry, actions: readonly string[], handler: ActionHandler<HttpParameters, UpstreamResult>): ActionRegistry;
|
|
55
73
|
export {};
|
|
56
74
|
//# sourceMappingURL=ForwardHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForwardHandler.d.ts","sourceRoot":"","sources":["../../src/gateway/ForwardHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ForwardHandler.d.ts","sourceRoot":"","sources":["../../src/gateway/ForwardHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,yGAAyG;AACzG,eAAO,MAAM,0BAA0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,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC,GACrD,cAAc,CAGhB"}
|
|
@@ -3,14 +3,28 @@ import { JsonValueSchema, PreDispatchRefusal, ProviderRefusal, } from "@decionis
|
|
|
3
3
|
import { EFFECT_RECEIPT_HEADER } from "../verify/EffectReceipt.js";
|
|
4
4
|
import { dispatchBudgetMs, MonotonicDeadline } from "../time/MonotonicClock.js";
|
|
5
5
|
import { CONSEQUENTIAL_METHODS } from "./GatewayConfig.js";
|
|
6
|
-
import {
|
|
6
|
+
import { PolicyIdSchema, PolicyVersionSchema } from "./PolicySelector.js";
|
|
7
|
+
import { bodyDigest, keyedRequestDigest, requestDigest, } from "./InterceptedRequest.js";
|
|
7
8
|
/** The parameters an HTTP action carries; anything else the registry refuses before a grant is spent. */
|
|
8
9
|
export const HttpActionParametersSchema = z.strictObject({
|
|
9
10
|
method: z.enum(CONSEQUENTIAL_METHODS),
|
|
10
11
|
path: z.string().min(1).max(500),
|
|
11
12
|
query: z.record(z.string(), z.union([z.string(), z.array(z.string())])),
|
|
12
13
|
body: JsonValueSchema.optional(),
|
|
14
|
+
policy_id: PolicyIdSchema.optional(),
|
|
15
|
+
policy_version: PolicyVersionSchema.optional(),
|
|
13
16
|
});
|
|
17
|
+
/** A facts-only HTTP action's parameters: the profile operation and its template, nothing more. */
|
|
18
|
+
export const HttpFactsParametersSchema = z.strictObject({
|
|
19
|
+
method: z.enum(CONSEQUENTIAL_METHODS),
|
|
20
|
+
operation: z.string().min(1).max(120),
|
|
21
|
+
path_template: z.string().min(1).max(500),
|
|
22
|
+
});
|
|
23
|
+
/** What the registry admits an HTTP action's parameters against: either shape, nothing else. */
|
|
24
|
+
export const HttpParametersSchema = z.union([
|
|
25
|
+
HttpActionParametersSchema,
|
|
26
|
+
HttpFactsParametersSchema,
|
|
27
|
+
]);
|
|
14
28
|
/** Thrown after dispatch when the upstream answered with a server error: the effect is unknown. */
|
|
15
29
|
class UpstreamIndeterminate extends Error {
|
|
16
30
|
constructor() {
|
|
@@ -48,22 +62,25 @@ export class RequestHolder {
|
|
|
48
62
|
* changed between the two is a failure before dispatch, not an execution.
|
|
49
63
|
* The upstream's status is the attempt's outcome: `2xx` and `3xx` commit,
|
|
50
64
|
* `4xx` is the provider's own refusal, `5xx` and a lost connection are
|
|
51
|
-
* unknown.
|
|
65
|
+
* unknown. A facts-only intent carries no path to compare: the held request
|
|
66
|
+
* is bound by its keyed digest instead, which covers the same bytes.
|
|
52
67
|
*/
|
|
53
|
-
export function httpForwardHandler(upstream, holder) {
|
|
68
|
+
export function httpForwardHandler(upstream, holder, digestKey) {
|
|
54
69
|
return {
|
|
55
|
-
parametersSchema:
|
|
70
|
+
parametersSchema: HttpParametersSchema,
|
|
56
71
|
execute: async ({ intent, parameters, authorization, dispatch }) => {
|
|
57
72
|
const held = holder.get(intent.intent.intentId);
|
|
58
73
|
if (held === undefined)
|
|
59
74
|
throw new Error("REQUEST_NOT_HELD");
|
|
60
75
|
const request = held.request;
|
|
61
76
|
const context = intent.intent.context;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
const bound = "operation" in parameters
|
|
78
|
+
? context["request_hmac_sha256"] === keyedRequestDigest(request, digestKey)
|
|
79
|
+
: request.path === parameters.path &&
|
|
80
|
+
context["request_sha256"] === requestDigest(request) &&
|
|
81
|
+
context["body_bytes"] === request.body.length &&
|
|
82
|
+
context["body_sha256"] === bodyDigest(request.body);
|
|
83
|
+
if (request.method.toUpperCase() !== parameters.method || !bound) {
|
|
67
84
|
throw new PreDispatchRefusal("PAYLOAD_BINDING_MISMATCH");
|
|
68
85
|
}
|
|
69
86
|
const headers = upstream.headersFor(request, {
|
|
@@ -79,7 +96,7 @@ export function httpForwardHandler(upstream, holder) {
|
|
|
79
96
|
// Everything after this line is the point of no return.
|
|
80
97
|
let response;
|
|
81
98
|
try {
|
|
82
|
-
response = await upstream.send(parameters.method,
|
|
99
|
+
response = await upstream.send(parameters.method, request.path, request.search, headers, request.body, upstream.signal(deadline.remainingMs));
|
|
83
100
|
}
|
|
84
101
|
catch (error) {
|
|
85
102
|
held.outcome = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForwardHandler.js","sourceRoot":"","sources":["../../src/gateway/ForwardHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,UAAU,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"ForwardHandler.js","sourceRoot":"","sources":["../../src/gateway/ForwardHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,aAAa,GAId,MAAM,yBAAyB,CAAC;AAGjC,yGAAyG;AACzG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,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;AAED,0FAA0F;AAC1F,MAAM,UAAU,mBAAmB,CACjC,QAAwB,EACxB,OAA0B,EAC1B,OAAsD;IAEtD,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { type ProvenanceProvider } from "../provenance/ProvenanceProvider.js";
|
|
|
4
4
|
import { HashChain } from "../audit/HashChain.js";
|
|
5
5
|
import { type AddressResolver } from "../egress/GuardedFetch.js";
|
|
6
6
|
import type { FetchLike } from "../handlers/HandlerRegistration.js";
|
|
7
|
-
import type
|
|
7
|
+
import { type SecretStore } from "../secrets/SecretStore.js";
|
|
8
8
|
import { ActivationFunnel, type ActivationMilestone } from "./Activation.js";
|
|
9
9
|
import { type DemoAuthorityHandle } from "./DemoAuthority.js";
|
|
10
10
|
import { type GatewayConfig } from "./GatewayConfig.js";
|
|
@@ -49,6 +49,8 @@ export interface GatewayDependencies {
|
|
|
49
49
|
readonly upstreamResolve?: AddressResolver;
|
|
50
50
|
/** TXT lookup for the upstream's proof; the system resolver's when absent. */
|
|
51
51
|
readonly upstreamResolveTxt?: TxtResolver;
|
|
52
|
+
/** The transport under the guard for the identity provider's key set; `node:https` when absent. */
|
|
53
|
+
readonly subjectJwksFetch?: FetchLike;
|
|
52
54
|
readonly secrets?: SecretStore;
|
|
53
55
|
readonly demoAuthority?: () => Promise<DemoAuthorityHandle>;
|
|
54
56
|
readonly clock?: () => number;
|
|
@@ -127,6 +129,12 @@ export interface GatewayStatus {
|
|
|
127
129
|
readonly registry: RegistrySource | null;
|
|
128
130
|
/** Where the upstream's proof stands, when the gateway requires one; never its text. */
|
|
129
131
|
readonly upstream_proof: ProofSnapshot | null;
|
|
132
|
+
/** Whether this gateway is the only one its process serves, as an enforcing one must be. */
|
|
133
|
+
readonly dedicated: boolean;
|
|
134
|
+
/** The header the gateway presents its upstream credential in; never the value. */
|
|
135
|
+
readonly upstream_credential: {
|
|
136
|
+
readonly header: string;
|
|
137
|
+
} | null;
|
|
130
138
|
} | null;
|
|
131
139
|
}
|
|
132
140
|
/** How much of a `sha256:` digest a readback shows: enough to tell two apart, never the digest. */
|
|
@@ -167,8 +175,23 @@ export declare class Gateway {
|
|
|
167
175
|
readonly boundary: EnforcementBoundary;
|
|
168
176
|
readonly workload: WorkloadSignal | null;
|
|
169
177
|
private readonly proof;
|
|
178
|
+
private readonly sessions;
|
|
179
|
+
private readonly jwks;
|
|
170
180
|
private readonly held;
|
|
181
|
+
/**
|
|
182
|
+
* For each governed request whose operation names where the subject sits
|
|
183
|
+
* in its answer: the session and operation the answer is checked against,
|
|
184
|
+
* wherever it is relayed (enforced, observed in shadow, forwarded failing
|
|
185
|
+
* open, or after a resumed escalation, which holds the same request).
|
|
186
|
+
*/
|
|
187
|
+
private readonly answerScopes;
|
|
171
188
|
private readonly holder;
|
|
189
|
+
/**
|
|
190
|
+
* The key of the facts-only request digest: made here, held only here, so
|
|
191
|
+
* the digest an authority receives confirms nothing about the request to
|
|
192
|
+
* anyone else. A held escalation is resumed by this same gateway.
|
|
193
|
+
*/
|
|
194
|
+
private readonly digestKey;
|
|
172
195
|
private readonly capture;
|
|
173
196
|
private readonly executor;
|
|
174
197
|
private readonly shadow;
|
|
@@ -198,6 +221,15 @@ export declare class Gateway {
|
|
|
198
221
|
* this one replaces (`takeOver`).
|
|
199
222
|
*/
|
|
200
223
|
private static upstreamProof;
|
|
224
|
+
/** What the gateway does with reads: checked only when it pins subjects. */
|
|
225
|
+
private static readPolicy;
|
|
226
|
+
/**
|
|
227
|
+
* The identity provider's key set, when the gateway pins subjects: the file
|
|
228
|
+
* when there is one, else one fetch from the address at start, refused by
|
|
229
|
+
* name when it fails; refreshed from the address through the guarded
|
|
230
|
+
* egress, sealed to its origin, with the last good set kept on a failure.
|
|
231
|
+
*/
|
|
232
|
+
private static subjectKeys;
|
|
201
233
|
/** TXT through the system's resolver, bounded, so a check never waits on DNS for long. */
|
|
202
234
|
private static systemTxt;
|
|
203
235
|
get authorityLabel(): string;
|
|
@@ -213,7 +245,9 @@ export declare class Gateway {
|
|
|
213
245
|
* and once a day has passed since the last report.
|
|
214
246
|
*/
|
|
215
247
|
private shadowReportOnCadence;
|
|
216
|
-
plan(method: string, path: string): RoutePlan;
|
|
248
|
+
plan(method: string, path: string, search?: string): RoutePlan;
|
|
249
|
+
/** A query for planning only; a name the intent contract forbids is left out, and refused later. */
|
|
250
|
+
private static queryOf;
|
|
217
251
|
readiness(): {
|
|
218
252
|
readonly ready: boolean;
|
|
219
253
|
readonly body: Record<string, unknown>;
|
|
@@ -280,7 +314,13 @@ export declare class Gateway {
|
|
|
280
314
|
* that came through the gateway from one that never reached it.
|
|
281
315
|
*/
|
|
282
316
|
passthrough(request: InterceptedRequest): Promise<GatewayResponse>;
|
|
283
|
-
/**
|
|
317
|
+
/**
|
|
318
|
+
* A consequential request, through the whole lifecycle. When the gateway
|
|
319
|
+
* pins subjects, a session the request presents is resolved first: one
|
|
320
|
+
* that does not stand is refused before anything else, and the subject of
|
|
321
|
+
* one that does is stated to the authority as `session.subject`, so a
|
|
322
|
+
* write's policy can compare a fact with it.
|
|
323
|
+
*/
|
|
284
324
|
govern(request: InterceptedRequest, action: string): Promise<GatewayResponse>;
|
|
285
325
|
/**
|
|
286
326
|
* Why a request's tenant key refuses it, or null when it admits it: always
|
|
@@ -312,6 +352,86 @@ export declare class Gateway {
|
|
|
312
352
|
resume(intentId: string, resumeToken: string | null): Promise<GatewayResponse>;
|
|
313
353
|
close(): Promise<void>;
|
|
314
354
|
private captureIntent;
|
|
355
|
+
/**
|
|
356
|
+
* Facts-only privacy: the authority receives the profile operation that
|
|
357
|
+
* named the call, its path template and the facts it names, and the keyed
|
|
358
|
+
* digest that binds the held request. No path, query, header or body byte
|
|
359
|
+
* of the request is in the intent; a call the profile does not describe
|
|
360
|
+
* never reaches here, because the route table refused it.
|
|
361
|
+
*/
|
|
362
|
+
private captureFacts;
|
|
363
|
+
/**
|
|
364
|
+
* The pinned subject as the authority reads it: the fact `session.subject`.
|
|
365
|
+
* A verified claim of the identity provider, never a value of the request;
|
|
366
|
+
* absent, never null, when the request presented no session.
|
|
367
|
+
*/
|
|
368
|
+
private static sessionContext;
|
|
369
|
+
/** The session a request presents, when the gateway pins subjects; null when it presents none. */
|
|
370
|
+
private sessionOf;
|
|
371
|
+
/**
|
|
372
|
+
* A read a profile operation names, checked against the session's subject
|
|
373
|
+
* and never decided. Before it is sent: the request must present a session
|
|
374
|
+
* that stands, and when the operation says where the subject sits in the
|
|
375
|
+
* call, it must be the session's. After: when the operation says where the
|
|
376
|
+
* subject sits in each item of a successful answer, every item must name
|
|
377
|
+
* the session's subject, or the whole answer is refused and none of it is
|
|
378
|
+
* relayed; nothing is filtered, since a partial answer would look complete.
|
|
379
|
+
* An answer that is not a success is relayed as it came. Every refusal is
|
|
380
|
+
* a reason code and a line on the gateway's evidence chain.
|
|
381
|
+
*/
|
|
382
|
+
check(request: InterceptedRequest, operationId: string): Promise<GatewayResponse>;
|
|
383
|
+
/**
|
|
384
|
+
* Why a successful answer may not be relayed for this session, or null when
|
|
385
|
+
* it may: every item the operation's response pointer reaches must name the
|
|
386
|
+
* session's subject, and beside a list only the envelope's keys may stand.
|
|
387
|
+
* An answer that is not a success is relayed as it came.
|
|
388
|
+
*/
|
|
389
|
+
private answerRefusal;
|
|
390
|
+
/**
|
|
391
|
+
* A forwarded answer, relayed: as it came, or, when the request's operation
|
|
392
|
+
* names where the subject sits in its answer and the answer names another
|
|
393
|
+
* subject, withheld. The effect, if any, has happened; the response says
|
|
394
|
+
* the call reached the upstream (`WITHHELD`) and with what status, so a
|
|
395
|
+
* caller never takes it for a call that was not made.
|
|
396
|
+
*/
|
|
397
|
+
private answer;
|
|
398
|
+
/** The profile operation that named a governed call, when it names a subject; else null. */
|
|
399
|
+
private scopedOperation;
|
|
400
|
+
/**
|
|
401
|
+
* A checked read's query, decoded as RFC 3986 writes it: each name and
|
|
402
|
+
* value percent-decoded once, and a `+` refused rather than read as a space
|
|
403
|
+
* or a plus, since an upstream may read it either way and a subject check
|
|
404
|
+
* must see what the upstream sees. Null when a component does not decode,
|
|
405
|
+
* holds a `+`, or is a name the intent contract forbids.
|
|
406
|
+
*/
|
|
407
|
+
private static strictQuery;
|
|
408
|
+
/**
|
|
409
|
+
* RFC 8693 token exchange at the gateway: the identity provider's subject
|
|
410
|
+
* token in, a session token for this gateway out. The answer is the RFC's,
|
|
411
|
+
* never cached; issuing and refusing are both lines on the evidence chain,
|
|
412
|
+
* with the session's short digest and never a token or the subject.
|
|
413
|
+
*/
|
|
414
|
+
exchange(form: URLSearchParams): Promise<GatewayResponse>;
|
|
415
|
+
/** An OAuth token endpoint's answer: JSON, never stored by anything between. */
|
|
416
|
+
private oauth;
|
|
417
|
+
/**
|
|
418
|
+
* A subject refusal: the gateway's own answer, a report line and a line on
|
|
419
|
+
* the evidence chain naming the operation, the reason and the session by
|
|
420
|
+
* its short digest. `WITHHELD`, with the upstream's status, when the call
|
|
421
|
+
* reached the upstream and its answer was not relayed; `NOT_FORWARDED`
|
|
422
|
+
* otherwise.
|
|
423
|
+
*/
|
|
424
|
+
private subjectRefused;
|
|
425
|
+
/**
|
|
426
|
+
* The facts the gateway's API profile names for this call, when the profile
|
|
427
|
+
* named its action: each at the top level of the trusted context, beside the
|
|
428
|
+
* operation, exactly as a native executor reading the same profile states
|
|
429
|
+
* them. The body is read for facts whether or not it is embedded.
|
|
430
|
+
*/
|
|
431
|
+
private profileFacts;
|
|
432
|
+
private profile;
|
|
433
|
+
/** What the gateway's API profile says about a call, its JSON body read when there is one. */
|
|
434
|
+
private profileMatch;
|
|
315
435
|
private principalOf;
|
|
316
436
|
private observe;
|
|
317
437
|
private enforce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gateway.d.ts","sourceRoot":"","sources":["../../src/gateway/Gateway.ts"],"names":[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