@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
|
@@ -18,6 +18,7 @@ const COLORS = {
|
|
|
18
18
|
EXECUTION_FAILED: `${ESC}[35m`,
|
|
19
19
|
EXECUTION_INDETERMINATE: `${ESC}[35m`,
|
|
20
20
|
ERROR: `${ESC}[35m`,
|
|
21
|
+
REFUSED: `${ESC}[31m`,
|
|
21
22
|
};
|
|
22
23
|
/** The label a state prints under, spaced for reading. */
|
|
23
24
|
export function stateLabel(state) {
|
|
@@ -39,6 +40,8 @@ export function executionLabel(execution) {
|
|
|
39
40
|
return "FAILED";
|
|
40
41
|
case "INDETERMINATE":
|
|
41
42
|
return "INDETERMINATE";
|
|
43
|
+
case "WITHHELD":
|
|
44
|
+
return "WITHHELD (answer refused)";
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GatewayReport.js","sourceRoot":"","sources":["../../src/gateway/GatewayReport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"GatewayReport.js","sourceRoot":"","sources":["../../src/gateway/GatewayReport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AA0H1E,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;AAC1B,MAAM,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC;AACzB,MAAM,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,GAA2C;IACrD,KAAK,EAAE,GAAG,GAAG,MAAM;IACnB,KAAK,EAAE,GAAG,GAAG,MAAM;IACnB,QAAQ,EAAE,GAAG,GAAG,MAAM;IACtB,MAAM,EAAE,GAAG,GAAG,MAAM;IACpB,qBAAqB,EAAE,GAAG,GAAG,MAAM;IACnC,gBAAgB,EAAE,GAAG,GAAG,MAAM;IAC9B,uBAAuB,EAAE,GAAG,GAAG,MAAM;IACrC,KAAK,EAAE,GAAG,GAAG,MAAM;IACnB,OAAO,EAAE,GAAG,GAAG,MAAM;CACtB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,UAAU,UAAU,CAAC,KAAmB;IAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC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,YAAY,KAAK,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;YAC3F,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YAChE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -12,7 +12,7 @@ export interface InterceptedRequest {
|
|
|
12
12
|
readonly remoteAddress: string | null;
|
|
13
13
|
readonly encrypted: boolean;
|
|
14
14
|
}
|
|
15
|
-
/** The HTTP
|
|
15
|
+
/** The held HTTP request and operator policy selectors, bound together for the authority. */
|
|
16
16
|
export interface HttpActionParameters extends JsonObject {
|
|
17
17
|
method: ConsequentialMethod;
|
|
18
18
|
path: string;
|
|
@@ -20,6 +20,18 @@ export interface HttpActionParameters extends JsonObject {
|
|
|
20
20
|
[key: string]: string | string[];
|
|
21
21
|
};
|
|
22
22
|
body?: JsonValue;
|
|
23
|
+
policy_id?: string;
|
|
24
|
+
policy_version?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A facts-only HTTP action's parameters: the profile operation and its path
|
|
28
|
+
* template, never the path, query or body the request carried. The handler
|
|
29
|
+
* forwards the held request, bound by the keyed digest in the context.
|
|
30
|
+
*/
|
|
31
|
+
export interface HttpFactsParameters extends JsonObject {
|
|
32
|
+
method: ConsequentialMethod;
|
|
33
|
+
operation: string;
|
|
34
|
+
path_template: string;
|
|
23
35
|
}
|
|
24
36
|
/** What the intent's context carries about the body: its digest, size and kind, never its bytes. */
|
|
25
37
|
export interface HttpActionContext extends JsonObject {
|
|
@@ -44,6 +56,14 @@ export declare function bodyDigest(body: Uint8Array): `sha256:${string}`;
|
|
|
44
56
|
* precedes the bytes; sorting header names makes object insertion order immaterial.
|
|
45
57
|
*/
|
|
46
58
|
export declare function requestDigest(request: InterceptedRequest): `sha256:${string}`;
|
|
59
|
+
/**
|
|
60
|
+
* The same binding as `requestDigest`, keyed: an HMAC-SHA-256 under a key
|
|
61
|
+
* that never leaves the gateway process. Facts-only privacy sends this in
|
|
62
|
+
* place of the plain digests, which a reader holding a guess of a small body
|
|
63
|
+
* or a path could confirm; the keyed one confirms nothing to anyone without
|
|
64
|
+
* the key, and still binds the held request to the grant byte for byte.
|
|
65
|
+
*/
|
|
66
|
+
export declare function keyedRequestDigest(request: InterceptedRequest, key: Uint8Array): `hmac-sha256:${string}`;
|
|
47
67
|
/**
|
|
48
68
|
* Turns an intercepted request into the agent's part of an intent. The
|
|
49
69
|
* proposal is method, path, query and, when the body is JSON within the
|
|
@@ -52,9 +72,33 @@ export declare function requestDigest(request: InterceptedRequest): `sha256:${st
|
|
|
52
72
|
* embedded, which is what the forwarding handler checks before dispatch.
|
|
53
73
|
* Raw request headers never reach the authority. Their digest binds their
|
|
54
74
|
* meaning along with the exact query and bytes for the final dispatch check.
|
|
75
|
+
* Policy selectors come only from the matched operator route, never from
|
|
76
|
+
* the caller's body, query or headers. They are bound before intent hashing
|
|
77
|
+
* and do not change the request forwarded to the upstream.
|
|
55
78
|
*/
|
|
56
79
|
export declare function normalizeRequest(request: InterceptedRequest, action: string, options: {
|
|
57
80
|
readonly maxEmbeddedBodyBytes: number;
|
|
58
81
|
readonly principalHeader: string | null;
|
|
82
|
+
readonly policyId?: string;
|
|
83
|
+
readonly policyVersion?: string;
|
|
59
84
|
}): NormalizedAction;
|
|
85
|
+
/**
|
|
86
|
+
* The agent's part of an intent in facts-only privacy: the profile operation
|
|
87
|
+
* that names the call, its path template, and nothing the request carried.
|
|
88
|
+
* The context binds the held request by its keyed digest. The client's
|
|
89
|
+
* idempotency key is a header value, so it is keyed too: a retry through the
|
|
90
|
+
* same gateway process states the same key, and the value never leaves. A
|
|
91
|
+
* correlation id and a principal header are not carried at all.
|
|
92
|
+
*/
|
|
93
|
+
export declare function normalizeFacts(request: InterceptedRequest, action: string, operation: {
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly path: string;
|
|
96
|
+
}, key: Uint8Array): NormalizedFacts;
|
|
97
|
+
export interface NormalizedFacts {
|
|
98
|
+
readonly proposal: AgentProposal;
|
|
99
|
+
readonly context: {
|
|
100
|
+
readonly request_hmac_sha256: string;
|
|
101
|
+
};
|
|
102
|
+
readonly idempotencyKey: string | null;
|
|
103
|
+
}
|
|
60
104
|
//# sourceMappingURL=InterceptedRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterceptedRequest.d.ts","sourceRoot":"","sources":["../../src/gateway/InterceptedRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,iGAAiG;AACjG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,
|
|
1
|
+
{"version":3,"file":"InterceptedRequest.d.ts","sourceRoot":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Q,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACzD,GAAG,EAAE,UAAU,GACd,eAAe,CAkBjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
1
|
+
import { createHash, createHmac } from "node:crypto";
|
|
2
2
|
const MAX_TARGET_LENGTH = 500;
|
|
3
3
|
const MAX_IDEMPOTENCY_KEY_LENGTH = 180;
|
|
4
4
|
const MAX_CORRELATION_LENGTH = 200;
|
|
@@ -32,6 +32,16 @@ export function requestDigest(request) {
|
|
|
32
32
|
]);
|
|
33
33
|
return `sha256:${createHash("sha256").update(metadata, "utf8").update(request.body).digest("hex")}`;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The same binding as `requestDigest`, keyed: an HMAC-SHA-256 under a key
|
|
37
|
+
* that never leaves the gateway process. Facts-only privacy sends this in
|
|
38
|
+
* place of the plain digests, which a reader holding a guess of a small body
|
|
39
|
+
* or a path could confirm; the keyed one confirms nothing to anyone without
|
|
40
|
+
* the key, and still binds the held request to the grant byte for byte.
|
|
41
|
+
*/
|
|
42
|
+
export function keyedRequestDigest(request, key) {
|
|
43
|
+
return `hmac-sha256:${createHmac("sha256", key).update(requestDigest(request), "utf8").digest("hex")}`;
|
|
44
|
+
}
|
|
35
45
|
/** Query pairs as an object: one value, or a list where a key repeats; keys sorted for stable hashing. */
|
|
36
46
|
function queryObject(search) {
|
|
37
47
|
const grouped = new Map();
|
|
@@ -66,6 +76,9 @@ function header(headers, name, maxLength) {
|
|
|
66
76
|
* embedded, which is what the forwarding handler checks before dispatch.
|
|
67
77
|
* Raw request headers never reach the authority. Their digest binds their
|
|
68
78
|
* meaning along with the exact query and bytes for the final dispatch check.
|
|
79
|
+
* Policy selectors come only from the matched operator route, never from
|
|
80
|
+
* the caller's body, query or headers. They are bound before intent hashing
|
|
81
|
+
* and do not change the request forwarded to the upstream.
|
|
69
82
|
*/
|
|
70
83
|
export function normalizeRequest(request, action, options) {
|
|
71
84
|
const method = request.method.toUpperCase();
|
|
@@ -91,6 +104,8 @@ export function normalizeRequest(request, action, options) {
|
|
|
91
104
|
path: request.path,
|
|
92
105
|
query: queryObject(request.search),
|
|
93
106
|
...(body === undefined ? {} : { body }),
|
|
107
|
+
...(options.policyId === undefined ? {} : { policy_id: options.policyId }),
|
|
108
|
+
...(options.policyVersion === undefined ? {} : { policy_version: options.policyVersion }),
|
|
94
109
|
};
|
|
95
110
|
return {
|
|
96
111
|
proposal: { action, target, parameters },
|
|
@@ -109,4 +124,31 @@ export function normalizeRequest(request, action, options) {
|
|
|
109
124
|
: header(request.headers, options.principalHeader, MAX_PRINCIPAL_LENGTH),
|
|
110
125
|
};
|
|
111
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The agent's part of an intent in facts-only privacy: the profile operation
|
|
129
|
+
* that names the call, its path template, and nothing the request carried.
|
|
130
|
+
* The context binds the held request by its keyed digest. The client's
|
|
131
|
+
* idempotency key is a header value, so it is keyed too: a retry through the
|
|
132
|
+
* same gateway process states the same key, and the value never leaves. A
|
|
133
|
+
* correlation id and a principal header are not carried at all.
|
|
134
|
+
*/
|
|
135
|
+
export function normalizeFacts(request, action, operation, key) {
|
|
136
|
+
const method = request.method.toUpperCase();
|
|
137
|
+
const target = `${method} ${operation.path}`;
|
|
138
|
+
if (target.length > MAX_TARGET_LENGTH)
|
|
139
|
+
throw new Error("TARGET_TOO_LONG");
|
|
140
|
+
const parameters = {
|
|
141
|
+
method,
|
|
142
|
+
operation: operation.id,
|
|
143
|
+
path_template: operation.path,
|
|
144
|
+
};
|
|
145
|
+
const idempotency = header(request.headers, "idempotency-key", MAX_IDEMPOTENCY_KEY_LENGTH);
|
|
146
|
+
return {
|
|
147
|
+
proposal: { action, target, parameters },
|
|
148
|
+
context: { request_hmac_sha256: keyedRequestDigest(request, key) },
|
|
149
|
+
idempotencyKey: idempotency === null
|
|
150
|
+
? null
|
|
151
|
+
: `hmac-sha256:${createHmac("sha256", key).update(idempotency, "utf8").digest("hex")}`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
112
154
|
//# sourceMappingURL=InterceptedRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterceptedRequest.js","sourceRoot":"","sources":["../../src/gateway/InterceptedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"InterceptedRequest.js","sourceRoot":"","sources":["../../src/gateway/InterceptedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuDrD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,8EAA8E;AAC9E,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,UAAU,GAAG,gDAAgD,CAAC;AACpE,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,WAAW;IACX,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B;IACvD,MAAM,QAAQ,GAAG,IAAI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,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;KAC3F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Published bundle selectors understood by Decionis, shared by config and dispatch validation. */
|
|
3
|
+
export declare const PolicyIdSchema: z.ZodString;
|
|
4
|
+
export declare const PolicyVersionSchema: z.ZodString;
|
|
5
|
+
//# sourceMappingURL=PolicySelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolicySelector.d.ts","sourceRoot":"","sources":["../../src/gateway/PolicySelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mGAAmG;AACnG,eAAO,MAAM,cAAc,aAAoB,CAAC;AAChD,eAAO,MAAM,mBAAmB,aAIV,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Published bundle selectors understood by Decionis, shared by config and dispatch validation. */
|
|
3
|
+
export const PolicyIdSchema = z.string().uuid();
|
|
4
|
+
export const PolicyVersionSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.max(100)
|
|
8
|
+
.regex(/^\P{Cc}+$/u);
|
|
9
|
+
//# sourceMappingURL=PolicySelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolicySelector.js","sourceRoot":"","sources":["../../src/gateway/PolicySelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mGAAmG;AACnG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,31 +1,68 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ApiProfile } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { type ConsequentialMethod, type PrivacyMode, type RouteConfig, type UnmatchedPolicy } from "./GatewayConfig.js";
|
|
3
|
+
/**
|
|
4
|
+
* What the gateway does with a read. `PASSTHROUGH` is today's: never
|
|
5
|
+
* evaluated. `CHECK` checks a read a profile operation names against the
|
|
6
|
+
* session's subject and passes the rest. `REFUSE_UNKNOWN` also refuses a
|
|
7
|
+
* read no profile operation names.
|
|
8
|
+
*/
|
|
9
|
+
export type ReadPolicy = "PASSTHROUGH" | "CHECK" | "REFUSE_UNKNOWN";
|
|
2
10
|
/** What the gateway decided about one request before reading its body. */
|
|
3
11
|
export type RoutePlan = {
|
|
4
12
|
readonly kind: "PASSTHROUGH";
|
|
5
13
|
readonly reason: "SAFE_METHOD" | "UNMATCHED" | "DISABLED";
|
|
6
14
|
} | {
|
|
7
15
|
readonly kind: "REFUSE";
|
|
8
|
-
readonly code: "HTTP_METHOD_UNSUPPORTED" | "HTTP_PATH_AMBIGUOUS";
|
|
16
|
+
readonly code: "HTTP_METHOD_UNSUPPORTED" | "HTTP_PATH_AMBIGUOUS" | "PROFILE_OPERATION_UNMATCHED" | "READ_OPERATION_UNMATCHED";
|
|
17
|
+
} | {
|
|
18
|
+
/** A read a profile operation names: checked against the session's subject, never decided. */
|
|
19
|
+
readonly kind: "CHECK";
|
|
20
|
+
readonly action: string;
|
|
21
|
+
readonly operation: string;
|
|
9
22
|
} | {
|
|
10
23
|
readonly kind: "GOVERN";
|
|
11
24
|
readonly action: string;
|
|
12
25
|
readonly route: RouteConfig | null;
|
|
26
|
+
/** The API profile operation that named the action, when a profile did. */
|
|
27
|
+
readonly operation?: string;
|
|
28
|
+
};
|
|
29
|
+
/** A request's query, as the gateway reads it for planning: each name to one value or a list. */
|
|
30
|
+
export type PlanQuery = {
|
|
31
|
+
readonly [key: string]: string | readonly string[];
|
|
13
32
|
};
|
|
14
33
|
/** The derived action for an unsafe request no route names. */
|
|
15
34
|
export declare function derivedAction(method: ConsequentialMethod): string;
|
|
16
35
|
/**
|
|
17
36
|
* The route table: which requests are consequential, and what each is
|
|
18
|
-
* called. A safe method is never consequential. An
|
|
19
|
-
*
|
|
20
|
-
*
|
|
37
|
+
* called. A safe method is never consequential. An explicit route is tried
|
|
38
|
+
* first, then the API profile's operations, when the gateway governs by one
|
|
39
|
+
* (`agent-safe.profile.api/1`). An unsafe request neither names is governed
|
|
40
|
+
* under a derived name unless the configuration chose passthrough, so
|
|
41
|
+
* narrowing what is governed is an explicit act. In facts-only privacy the
|
|
42
|
+
* profile alone names a call: what it does not name is refused, because
|
|
43
|
+
* governing it would send the authority its raw path.
|
|
21
44
|
*/
|
|
22
45
|
export declare class RouteTable {
|
|
23
46
|
private readonly unmatched;
|
|
24
47
|
private readonly enabled;
|
|
48
|
+
private readonly profile;
|
|
49
|
+
private readonly privacy;
|
|
50
|
+
private readonly reads;
|
|
25
51
|
private readonly routes;
|
|
26
|
-
constructor(routes: readonly RouteConfig[], unmatched: UnmatchedPolicy, enabled?: boolean);
|
|
52
|
+
constructor(routes: readonly RouteConfig[], unmatched: UnmatchedPolicy, enabled?: boolean, profile?: ApiProfile | null, privacy?: PrivacyMode, reads?: ReadPolicy);
|
|
27
53
|
/** Every action name this table can produce, for the registry to be sealed over. */
|
|
28
54
|
actions(): readonly string[];
|
|
29
|
-
|
|
55
|
+
/**
|
|
56
|
+
* A read, when reads are checked. A `GET` a profile operation names is
|
|
57
|
+
* checked. One that only resembles an operation (another letter case, an
|
|
58
|
+
* encoded literal) is refused as ambiguous, since the upstream may serve
|
|
59
|
+
* it as that operation. A path beneath a checked read (`/$count`, a
|
|
60
|
+
* navigation, a media stream) answers what the read's subject rule does
|
|
61
|
+
* not check, and a `HEAD` or `OPTIONS` on a checked read's path has no
|
|
62
|
+
* answer to check while its status says whether a record exists: both are
|
|
63
|
+
* refused. Anything else passes, or is refused when unknown reads are.
|
|
64
|
+
*/
|
|
65
|
+
private planRead;
|
|
66
|
+
plan(method: string, pathname: string, query?: PlanQuery): RoutePlan;
|
|
30
67
|
}
|
|
31
68
|
//# sourceMappingURL=RouteTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteTable.d.ts","sourceRoot":"","sources":["../../src/gateway/RouteTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;CAAE,GAC3F;
|
|
1
|
+
{"version":3,"file":"RouteTable.d.ts","sourceRoot":"","sources":["../../src/gateway/RouteTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAEpE,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;CAAE,GAC3F;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EACT,yBAAyB,GACzB,qBAAqB,GACrB,6BAA6B,GA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,EAAE,KAAK,GAAE,SAAc,GAAG,SAAS;CA8BhF"}
|
|
@@ -53,17 +53,27 @@ export function derivedAction(method) {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* The route table: which requests are consequential, and what each is
|
|
56
|
-
* called. A safe method is never consequential. An
|
|
57
|
-
*
|
|
58
|
-
*
|
|
56
|
+
* called. A safe method is never consequential. An explicit route is tried
|
|
57
|
+
* first, then the API profile's operations, when the gateway governs by one
|
|
58
|
+
* (`agent-safe.profile.api/1`). An unsafe request neither names is governed
|
|
59
|
+
* under a derived name unless the configuration chose passthrough, so
|
|
60
|
+
* narrowing what is governed is an explicit act. In facts-only privacy the
|
|
61
|
+
* profile alone names a call: what it does not name is refused, because
|
|
62
|
+
* governing it would send the authority its raw path.
|
|
59
63
|
*/
|
|
60
64
|
export class RouteTable {
|
|
61
65
|
unmatched;
|
|
62
66
|
enabled;
|
|
67
|
+
profile;
|
|
68
|
+
privacy;
|
|
69
|
+
reads;
|
|
63
70
|
routes;
|
|
64
|
-
constructor(routes, unmatched, enabled = true) {
|
|
71
|
+
constructor(routes, unmatched, enabled = true, profile = null, privacy = "FULL", reads = "PASSTHROUGH") {
|
|
65
72
|
this.unmatched = unmatched;
|
|
66
73
|
this.enabled = enabled;
|
|
74
|
+
this.profile = profile;
|
|
75
|
+
this.privacy = privacy;
|
|
76
|
+
this.reads = reads;
|
|
67
77
|
this.routes = routes.map((config) => {
|
|
68
78
|
const segments = routingSegments(config.path);
|
|
69
79
|
// Pattern syntax is literal configuration. Encoded wildcards must not
|
|
@@ -78,15 +88,44 @@ export class RouteTable {
|
|
|
78
88
|
const names = new Set(CONSEQUENTIAL_METHODS.map((method) => derivedAction(method)));
|
|
79
89
|
for (const route of this.routes)
|
|
80
90
|
names.add(route.config.action);
|
|
91
|
+
for (const action of this.profile?.actions() ?? [])
|
|
92
|
+
names.add(action);
|
|
81
93
|
return [...names];
|
|
82
94
|
}
|
|
83
|
-
|
|
95
|
+
/**
|
|
96
|
+
* A read, when reads are checked. A `GET` a profile operation names is
|
|
97
|
+
* checked. One that only resembles an operation (another letter case, an
|
|
98
|
+
* encoded literal) is refused as ambiguous, since the upstream may serve
|
|
99
|
+
* it as that operation. A path beneath a checked read (`/$count`, a
|
|
100
|
+
* navigation, a media stream) answers what the read's subject rule does
|
|
101
|
+
* not check, and a `HEAD` or `OPTIONS` on a checked read's path has no
|
|
102
|
+
* answer to check while its status says whether a record exists: both are
|
|
103
|
+
* refused. Anything else passes, or is refused when unknown reads are.
|
|
104
|
+
*/
|
|
105
|
+
planRead(method, pathname, query) {
|
|
106
|
+
if (this.reads === "PASSTHROUGH" || this.profile === null) {
|
|
107
|
+
return { kind: "PASSTHROUGH", reason: "SAFE_METHOD" };
|
|
108
|
+
}
|
|
109
|
+
const operation = method === "GET" ? this.profile.operationFor("GET", pathname, query) : null;
|
|
110
|
+
if (operation !== null) {
|
|
111
|
+
return { kind: "CHECK", action: operation.action, operation: operation.id };
|
|
112
|
+
}
|
|
113
|
+
const resembles = this.profile.resembles("GET", pathname);
|
|
114
|
+
if (this.reads === "REFUSE_UNKNOWN" ||
|
|
115
|
+
(resembles && method !== "GET") ||
|
|
116
|
+
this.profile.beneath("GET", pathname)) {
|
|
117
|
+
return { kind: "REFUSE", code: "READ_OPERATION_UNMATCHED" };
|
|
118
|
+
}
|
|
119
|
+
if (resembles)
|
|
120
|
+
return { kind: "REFUSE", code: "HTTP_PATH_AMBIGUOUS" };
|
|
121
|
+
return { kind: "PASSTHROUGH", reason: "SAFE_METHOD" };
|
|
122
|
+
}
|
|
123
|
+
plan(method, pathname, query = {}) {
|
|
84
124
|
if (!this.enabled)
|
|
85
125
|
return { kind: "PASSTHROUGH", reason: "DISABLED" };
|
|
86
126
|
const upper = method.toUpperCase();
|
|
87
|
-
if (SAFE_METHODS.has(upper))
|
|
88
|
-
return
|
|
89
|
-
}
|
|
127
|
+
if (SAFE_METHODS.has(upper))
|
|
128
|
+
return this.planRead(upper, pathname, query);
|
|
90
129
|
// WebDAV and extension methods can mutate state too. A method outside
|
|
91
130
|
// this execution contract cannot inherit the privilege of a safe read.
|
|
92
131
|
if (!CONSEQUENTIAL_METHODS.includes(upper)) {
|
|
@@ -96,11 +135,21 @@ export class RouteTable {
|
|
|
96
135
|
const path = routingSegments(pathname);
|
|
97
136
|
if (path === null)
|
|
98
137
|
return { kind: "REFUSE", code: "HTTP_PATH_AMBIGUOUS" };
|
|
99
|
-
|
|
138
|
+
const factsOnly = this.privacy === "FACTS";
|
|
139
|
+
for (const route of factsOnly ? [] : this.routes) {
|
|
100
140
|
if (route.methods.has(consequential) && matches(route.segments, path)) {
|
|
101
141
|
return { kind: "GOVERN", action: route.config.action, route: route.config };
|
|
102
142
|
}
|
|
103
143
|
}
|
|
144
|
+
const operation = this.profile?.operationFor(consequential, pathname, query) ?? null;
|
|
145
|
+
if (operation !== null) {
|
|
146
|
+
return { kind: "GOVERN", action: operation.action, route: null, operation: operation.id };
|
|
147
|
+
}
|
|
148
|
+
// Facts-only privacy would send the raw path; refusing unknown calls
|
|
149
|
+
// would relay an answer, a batch's included, that no subject rule checks.
|
|
150
|
+
if (factsOnly || this.reads === "REFUSE_UNKNOWN") {
|
|
151
|
+
return { kind: "REFUSE", code: "PROFILE_OPERATION_UNMATCHED" };
|
|
152
|
+
}
|
|
104
153
|
if (this.unmatched === "PASSTHROUGH")
|
|
105
154
|
return { kind: "PASSTHROUGH", reason: "UNMATCHED" };
|
|
106
155
|
return { kind: "GOVERN", action: derivedAction(consequential), route: null };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteTable.js","sourceRoot":"","sources":["../../src/gateway/RouteTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RouteTable.js","sourceRoot":"","sources":["../../src/gateway/RouteTable.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAKtB,MAAM,oBAAoB,CAAC;AAsC5B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,M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AAE,CAAC;QAC1F,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/E,CAAC;CACF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type WorkloadJwtVerifier } from "../identity/WorkloadJwtVerifier.js";
|
|
2
|
+
/** RFC 8693's grant type, and the token types a subject token may be stated as. */
|
|
3
|
+
export declare const TOKEN_EXCHANGE_GRANT = "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
4
|
+
/** What the exchange issues: an opaque token for this gateway, never a bearer anywhere else. */
|
|
5
|
+
export declare const ISSUED_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token";
|
|
6
|
+
/** The most sessions held at once; beyond it a new one is refused rather than an old one dropped. */
|
|
7
|
+
export declare const MAX_SESSIONS = 10000;
|
|
8
|
+
/** How old a subject token may be: a short-lived token, minted for the conversation at hand. */
|
|
9
|
+
export declare const MAX_SUBJECT_TOKEN_AGE_SECONDS = 3600;
|
|
10
|
+
/** A subject the gateway has pinned: who, until when, and a short digest that names the session in evidence. */
|
|
11
|
+
export interface SubjectSession {
|
|
12
|
+
readonly subject: string;
|
|
13
|
+
readonly expiresAt: number;
|
|
14
|
+
/** `sha256:` and 12 hex characters of the token's digest; never the token. */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
}
|
|
17
|
+
/** Why a request's session does not stand: the code a caller sees and the evidence records. */
|
|
18
|
+
export type SessionRefusal = "SUBJECT_SESSION_INVALID" | "SUBJECT_TOKEN_INVALID" | "SUBJECT_TOKEN_AMBIGUOUS";
|
|
19
|
+
/** A verified subject token: the subject it names and when it expires, in epoch milliseconds. */
|
|
20
|
+
export interface VerifiedSubject {
|
|
21
|
+
readonly subject: string;
|
|
22
|
+
readonly expiresAt: number;
|
|
23
|
+
}
|
|
24
|
+
/** Turns a subject token into the subject it names, or throws `JwtError`. */
|
|
25
|
+
export interface SubjectTokenVerifier {
|
|
26
|
+
verify(token: string): Promise<VerifiedSubject>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The operator's identity provider: a signature from its key set, its issuer
|
|
30
|
+
* exactly, the gateway's audience, a token at most an hour old, and the
|
|
31
|
+
* subject in the configured claim, a string or a number of at most 200
|
|
32
|
+
* characters. Who the customer is, is the provider's statement; the gateway
|
|
33
|
+
* only pins it.
|
|
34
|
+
*/
|
|
35
|
+
export declare class IssuerSubjectVerifier implements SubjectTokenVerifier {
|
|
36
|
+
private readonly jwt;
|
|
37
|
+
private readonly issuer;
|
|
38
|
+
private readonly claim;
|
|
39
|
+
constructor(jwt: WorkloadJwtVerifier, issuer: string, claim: string);
|
|
40
|
+
verify(token: string): Promise<VerifiedSubject>;
|
|
41
|
+
}
|
|
42
|
+
/** The token exchange's answer: RFC 8693 §2.2, or an RFC 6749 §5.2 error. */
|
|
43
|
+
export type ExchangeAnswer = {
|
|
44
|
+
readonly status: 200;
|
|
45
|
+
readonly body: {
|
|
46
|
+
readonly access_token: string;
|
|
47
|
+
readonly issued_token_type: typeof ISSUED_TOKEN_TYPE;
|
|
48
|
+
readonly token_type: "N_A";
|
|
49
|
+
readonly expires_in: number;
|
|
50
|
+
};
|
|
51
|
+
/** The session, for the evidence line; its token is in the body only. */
|
|
52
|
+
readonly session: SubjectSession;
|
|
53
|
+
} | {
|
|
54
|
+
readonly status: 400 | 503;
|
|
55
|
+
readonly body: {
|
|
56
|
+
readonly error: string;
|
|
57
|
+
readonly error_description: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Subject-bound sessions. The app that starts an agent (a contact centre, a
|
|
62
|
+
* CRM, a customer's own portal) holds a short-lived token from its identity
|
|
63
|
+
* provider naming the customer in context. It gives the gateway that token,
|
|
64
|
+
* and the gateway pins the subject for the session:
|
|
65
|
+
*
|
|
66
|
+
* - by RFC 8693 token exchange: `POST /_agentsafe/v1/sessions` returns an
|
|
67
|
+
* opaque session token, which the agent presents in `AgentSafe-Session`;
|
|
68
|
+
* the gateway keeps only the token's digest, beside the subject;
|
|
69
|
+
* - or per request, the provider's token itself in `AgentSafe-Subject-Token`.
|
|
70
|
+
*
|
|
71
|
+
* Either way the subject comes from the provider's signature and nothing the
|
|
72
|
+
* agent sends can change it: the session token maps to a subject held here,
|
|
73
|
+
* and the provider's token is verified on every request. Both headers end at
|
|
74
|
+
* the gateway. A session lasts as long as this gateway process: it is held in
|
|
75
|
+
* memory, so behind several replicas present the provider's token per
|
|
76
|
+
* request, or keep a caller on one replica.
|
|
77
|
+
*/
|
|
78
|
+
export declare class SubjectSessions {
|
|
79
|
+
private readonly verifier;
|
|
80
|
+
private readonly options;
|
|
81
|
+
private readonly sessions;
|
|
82
|
+
/**
|
|
83
|
+
* The session each subject token was last exchanged for, by the token's
|
|
84
|
+
* digest: exchanging a token again replaces its session rather than add
|
|
85
|
+
* one, so one token cannot fill the gateway's sessions.
|
|
86
|
+
*/
|
|
87
|
+
private readonly byToken;
|
|
88
|
+
constructor(verifier: SubjectTokenVerifier, options: {
|
|
89
|
+
readonly ttlSeconds: number;
|
|
90
|
+
readonly clock: () => number;
|
|
91
|
+
readonly maxSessions?: number;
|
|
92
|
+
});
|
|
93
|
+
/** The sessions held now, expired ones dropped first. */
|
|
94
|
+
get size(): number;
|
|
95
|
+
/**
|
|
96
|
+
* RFC 8693 token exchange: a subject token in, a session token out. The
|
|
97
|
+
* request is the form the RFC defines; an actor token (delegation) is not
|
|
98
|
+
* accepted, and the only token issued is this gateway's session token. A
|
|
99
|
+
* token that does not verify is `invalid_request`, as the RFC says, with
|
|
100
|
+
* the stable code as its description and nothing from the token.
|
|
101
|
+
*/
|
|
102
|
+
exchange(form: URLSearchParams): Promise<ExchangeAnswer>;
|
|
103
|
+
/**
|
|
104
|
+
* The session a request presents: null when it presents none, the session
|
|
105
|
+
* when it stands, and the refusal otherwise. A request may present one of
|
|
106
|
+
* the two headers, never both, since two would be two answers to whose
|
|
107
|
+
* session it is.
|
|
108
|
+
*/
|
|
109
|
+
resolve(headers: Readonly<Record<string, string>>): Promise<SubjectSession | SessionRefusal | null>;
|
|
110
|
+
private expire;
|
|
111
|
+
private static digest;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=SubjectSessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubjectSessions.d.ts","sourceRoot":"","sources":["../../src/gateway/SubjectSessions.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGxF,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,oDAAoD,CAAC;AAMtF,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AACjF,qGAAqG;AACrG,eAAO,MAAM,YAAY,QAAS,CAAC;AAGnC,gGAAgG;AAChG,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD,gHAAgH;AAChH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,+FAA+F;AAC/F,MAAM,MAAM,cAAc,GACxB,yBAAyB,GAAG,uBAAuB,GAAG,yBAAyB,CAAC;AAElF,iGAAiG;AACjG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACjD;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,YAAW,oBAAoB;IAE9D,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,C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