@kya-os/checkpoint-shared 1.7.0 → 1.9.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/CHANGELOG.md +159 -9
- package/README.md +24 -7
- package/dist/agent-catalog.d.mts +12 -0
- package/dist/agent-catalog.d.mts.map +1 -0
- package/dist/agent-catalog.d.ts +12 -0
- package/dist/agent-catalog.d.ts.map +1 -0
- package/dist/agent-catalog.js +105 -0
- package/dist/agent-catalog.mjs +105 -0
- package/dist/agent-catalog.mjs.map +1 -0
- package/dist/beacon-nonce/index.d.mts +1 -0
- package/dist/beacon-nonce/index.d.mts.map +1 -1
- package/dist/beacon-nonce/index.d.ts +1 -0
- package/dist/beacon-nonce/index.d.ts.map +1 -1
- package/dist/beacon-nonce/index.js +9 -3
- package/dist/beacon-nonce/index.mjs +9 -4
- package/dist/beacon-nonce/index.mjs.map +1 -1
- package/dist/beacon-types/index.d.mts +41 -1
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +41 -1
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +153 -4
- package/dist/beacon-types/index.mjs +139 -4
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/{browser-posture-BLhw-MON.d.mts → browser-posture-5fPrsxx7.d.mts} +6 -6
- package/dist/{browser-posture-BLhw-MON.d.mts.map → browser-posture-5fPrsxx7.d.mts.map} +1 -1
- package/dist/{browser-posture-B8YiPa5c.d.ts → browser-posture-CCR1kh5e.d.ts} +6 -6
- package/dist/{browser-posture-B8YiPa5c.d.ts.map → browser-posture-CCR1kh5e.d.ts.map} +1 -1
- package/dist/browser-posture-cookie.js +1 -1
- package/dist/browser-posture-cookie.mjs +1 -1
- package/dist/browser-posture-cookie.mjs.map +1 -1
- package/dist/browser-posture-proof-verifier-DvsOmFrM.js +202 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs +180 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs.map +1 -0
- package/dist/browser-posture-proof-verifier.d.mts +25 -0
- package/dist/browser-posture-proof-verifier.d.mts.map +1 -0
- package/dist/browser-posture-proof-verifier.d.ts +25 -0
- package/dist/browser-posture-proof-verifier.d.ts.map +1 -0
- package/dist/browser-posture-proof-verifier.js +7 -0
- package/dist/browser-posture-proof-verifier.mjs +3 -0
- package/dist/browser-posture-proof.d.mts +4 -5
- package/dist/browser-posture-proof.d.mts.map +1 -1
- package/dist/browser-posture-proof.d.ts +4 -5
- package/dist/browser-posture-proof.d.ts.map +1 -1
- package/dist/browser-posture-proof.js +10 -79
- package/dist/browser-posture-proof.mjs +6 -77
- package/dist/browser-posture-proof.mjs.map +1 -1
- package/dist/browser-posture.d.mts +1 -1
- package/dist/browser-posture.d.ts +1 -1
- package/dist/browser-posture.js +6 -5
- package/dist/browser-posture.mjs +4 -3
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/browser.d.mts +25 -286
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +25 -286
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/canonical-signer/index.js +30 -28
- package/dist/canonical-signer/index.mjs +31 -1
- package/dist/canonical-signer/index.mjs.map +1 -1
- package/dist/clearance.d.mts +1 -1
- package/dist/clearance.d.ts +1 -1
- package/dist/clearance.js +2 -2
- package/dist/clearance.mjs +2 -2
- package/dist/client-ip-B7w-uHfS.d.mts +55 -0
- package/dist/client-ip-B7w-uHfS.d.mts.map +1 -0
- package/dist/client-ip-B7w-uHfS.d.ts +55 -0
- package/dist/client-ip-B7w-uHfS.d.ts.map +1 -0
- package/dist/{client-ip-CW6pRyLf.js → client-ip-B8wFzJ5f.js} +117 -7
- package/dist/{client-ip-B2Xeo-GK.mjs → client-ip-DIJyr6px.mjs} +113 -9
- package/dist/client-ip-DIJyr6px.mjs.map +1 -0
- package/dist/client-ip.d.mts +2 -2
- package/dist/client-ip.d.ts +2 -2
- package/dist/client-ip.js +3 -2
- package/dist/client-ip.mjs +2 -2
- package/dist/consent-handoff.d.mts +0 -3
- package/dist/consent-handoff.d.mts.map +1 -1
- package/dist/consent-handoff.d.ts +0 -3
- package/dist/consent-handoff.d.ts.map +1 -1
- package/dist/consent-handoff.mjs.map +1 -1
- package/dist/default-sign-in-host.d.mts +10 -0
- package/dist/default-sign-in-host.d.mts.map +1 -0
- package/dist/default-sign-in-host.d.ts +10 -0
- package/dist/default-sign-in-host.d.ts.map +1 -0
- package/dist/default-sign-in-host.js +72 -0
- package/dist/default-sign-in-host.mjs +66 -0
- package/dist/default-sign-in-host.mjs.map +1 -0
- package/dist/detection-reason-mapping-B9RSkOs8.js +277 -0
- package/dist/detection-reason-mapping-BGymWIPl.mjs +249 -0
- package/dist/detection-reason-mapping-BGymWIPl.mjs.map +1 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.mts +52 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.mts.map +1 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.ts +52 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.ts.map +1 -0
- package/dist/engine-enforcing-AYEcgNsb.js +39 -0
- package/dist/engine-enforcing-B5eNfCpG.mjs +29 -0
- package/dist/engine-enforcing-B5eNfCpG.mjs.map +1 -0
- package/dist/engine-enforcing-DiOclGqf.d.mts +11 -0
- package/dist/engine-enforcing-DiOclGqf.d.mts.map +1 -0
- package/dist/engine-enforcing-DiOclGqf.d.ts +11 -0
- package/dist/engine-enforcing-DiOclGqf.d.ts.map +1 -0
- package/dist/engine-info.d.mts +2 -0
- package/dist/engine-info.d.ts +2 -0
- package/dist/engine-info.js +4 -0
- package/dist/engine-info.mjs +3 -0
- package/dist/errors/index.d.mts +6 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +28 -6
- package/dist/errors/index.mjs +28 -6
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{external-B7WI9FyQ.d.ts → external-m3Kmafwj.d.mts} +2 -2
- package/dist/{external-B7WI9FyQ.d.mts.map → external-m3Kmafwj.d.mts.map} +1 -1
- package/dist/{external-B7WI9FyQ.d.mts → external-m3Kmafwj.d.ts} +2 -2
- package/dist/{external-B7WI9FyQ.d.ts.map → external-m3Kmafwj.d.ts.map} +1 -1
- package/dist/fetcher-C8qvwdnA.d.ts +44 -0
- package/dist/fetcher-C8qvwdnA.d.ts.map +1 -0
- package/dist/fetcher-D2vjr7jB.d.mts +44 -0
- package/dist/fetcher-D2vjr7jB.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.mts +1 -3
- package/dist/gateway-client-ip.d.mts.map +1 -1
- package/dist/gateway-client-ip.d.ts +1 -3
- package/dist/gateway-client-ip.d.ts.map +1 -1
- package/dist/gateway-client-ip.js +2 -2
- package/dist/gateway-client-ip.mjs +2 -2
- package/dist/gateway-client-ip.mjs.map +1 -1
- package/dist/host-adapter/index.d.mts +2 -2
- package/dist/host-adapter/index.d.ts +2 -2
- package/dist/host-adapter/index.js +2 -1
- package/dist/host-adapter/index.mjs +2 -2
- package/dist/{host-adapter-C-4IxmqM.mjs → host-adapter-BKdQHwbi.mjs} +56 -3
- package/dist/{host-adapter-C-4IxmqM.mjs.map → host-adapter-BKdQHwbi.mjs.map} +1 -1
- package/dist/{host-adapter-CwW9YB0U.js → host-adapter-bWftXA9T.js} +60 -1
- package/dist/index-DnFsmr_o.d.ts +156 -0
- package/dist/index-DnFsmr_o.d.ts.map +1 -0
- package/dist/index-rvw5Bz-r.d.mts +156 -0
- package/dist/index-rvw5Bz-r.d.mts.map +1 -0
- package/dist/index.d.mts +6681 -11335
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +6681 -11335
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2322 -6900
- package/dist/index.mjs +2236 -6574
- package/dist/index.mjs.map +1 -1
- package/dist/{kya-http-error-codes-UYb1zpGM.js → kya-http-error-codes-B4rUmUEI.js} +2 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.ts → kya-http-error-codes-C14E4gi3.d.mts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.mts.map +1 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.mts → kya-http-error-codes-C14E4gi3.d.ts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.ts.map +1 -0
- package/dist/{kya-http-error-codes-C2JiWPsi.mjs → kya-http-error-codes-DSBrxNry.mjs} +3 -1
- package/dist/kya-http-error-codes-DSBrxNry.mjs.map +1 -0
- package/dist/kya-http.d.mts +3 -3
- package/dist/kya-http.d.ts +3 -3
- package/dist/kya-http.js +10 -2
- package/dist/kya-http.mjs +4 -3
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -1
- package/dist/mcpi/status-list/index.d.mts +72 -0
- package/dist/mcpi/status-list/index.d.mts.map +1 -0
- package/dist/mcpi/status-list/index.d.ts +72 -0
- package/dist/mcpi/status-list/index.d.ts.map +1 -0
- package/dist/mcpi/status-list/index.js +703 -0
- package/dist/mcpi/status-list/index.mjs +684 -0
- package/dist/mcpi/status-list/index.mjs.map +1 -0
- package/dist/patterns-Bp40cwh2.d.mts +110 -0
- package/dist/patterns-Bp40cwh2.d.mts.map +1 -0
- package/dist/patterns-Bp40cwh2.d.ts +110 -0
- package/dist/patterns-Bp40cwh2.d.ts.map +1 -0
- package/dist/patterns-CiMpbdAF.js +243 -0
- package/dist/patterns-D4OAsNQY.mjs +173 -0
- package/dist/patterns-D4OAsNQY.mjs.map +1 -0
- package/dist/patterns.d.mts +2 -0
- package/dist/patterns.d.ts +2 -0
- package/dist/patterns.js +15 -0
- package/dist/patterns.mjs +3 -0
- package/dist/policy/enforcement.d.mts +3 -2
- package/dist/policy/enforcement.d.ts +3 -2
- package/dist/policy/enforcement.js +8 -2
- package/dist/policy/enforcement.mjs +3 -2
- package/dist/policy/fetcher.d.mts +2 -0
- package/dist/policy/fetcher.d.ts +2 -0
- package/dist/policy/fetcher.js +240 -0
- package/dist/policy/fetcher.mjs +238 -0
- package/dist/policy/fetcher.mjs.map +1 -0
- package/dist/policy/schemas.d.mts +3 -0
- package/dist/policy/schemas.d.ts +3 -0
- package/dist/policy/schemas.js +27 -0
- package/dist/policy/schemas.mjs +4 -0
- package/dist/{posture-origins-Ba83O0cD.mjs → posture-origins-Ci6k4Zh1.js} +24 -173
- package/dist/{posture-origins-CdVOdiMT.js → posture-origins-DGyS4Vuk.mjs} +2 -267
- package/dist/posture-origins-DGyS4Vuk.mjs.map +1 -0
- package/dist/{project-verification-key-BccT12tQ.js → project-verification-key-B-L3D2nC.js} +1 -1
- package/dist/{project-verification-key-66N4edKn.mjs → project-verification-key-CWXdu3-n.mjs} +2 -2
- package/dist/{project-verification-key-66N4edKn.mjs.map → project-verification-key-CWXdu3-n.mjs.map} +1 -1
- package/dist/provider-registry.d.mts +2 -0
- package/dist/provider-registry.d.ts +2 -0
- package/dist/provider-registry.js +51 -0
- package/dist/provider-registry.mjs +3 -0
- package/dist/reason-codes.d.mts +2 -0
- package/dist/reason-codes.d.ts +2 -0
- package/dist/reason-codes.js +8 -0
- package/dist/reason-codes.mjs +3 -0
- package/dist/{registered-sid-hUl-bvM5.mjs → registered-sid-26hNxp6t.mjs} +11 -2
- package/dist/registered-sid-26hNxp6t.mjs.map +1 -0
- package/dist/registered-sid-D6KCaT1E.d.mts +33 -0
- package/dist/registered-sid-D6KCaT1E.d.mts.map +1 -0
- package/dist/registered-sid-D6KCaT1E.d.ts +33 -0
- package/dist/registered-sid-D6KCaT1E.d.ts.map +1 -0
- package/dist/{registered-sid-eLCNZvIF.js → registered-sid-DVGTSH0L.js} +15 -0
- package/dist/ruleset-hash-Cmv8MSO5.js +34 -0
- package/dist/ruleset-hash-IRN5eI9H.d.mts +5 -0
- package/dist/ruleset-hash-IRN5eI9H.d.mts.map +1 -0
- package/dist/ruleset-hash-IRN5eI9H.d.ts +5 -0
- package/dist/ruleset-hash-IRN5eI9H.d.ts.map +1 -0
- package/dist/ruleset-hash-QQIaLuPi.mjs +30 -0
- package/dist/ruleset-hash-QQIaLuPi.mjs.map +1 -0
- package/dist/{schemas-YhagYDx_.js → schemas-BlScS1it.js} +0 -20
- package/dist/{index-HaqfPtaL.d.ts → schemas-CGKHzcMV.d.ts} +23 -195
- package/dist/schemas-CGKHzcMV.d.ts.map +1 -0
- package/dist/schemas-Cm4C4Z5G.js +703 -0
- package/dist/schemas-DPIT8usF.mjs +525 -0
- package/dist/schemas-DPIT8usF.mjs.map +1 -0
- package/dist/{schemas-7qodsG-Z.mjs → schemas-IHAhH3gV.mjs} +2 -16
- package/dist/schemas-IHAhH3gV.mjs.map +1 -0
- package/dist/{index-B7rTovHa.d.mts → schemas-m-GqyfyO.d.mts} +23 -195
- package/dist/schemas-m-GqyfyO.d.mts.map +1 -0
- package/dist/{step-up-COlmWJN8.mjs → step-up-BK0oBi11.mjs} +91 -41
- package/dist/step-up-BK0oBi11.mjs.map +1 -0
- package/dist/{step-up-C2d8C20x.js → step-up-Bp8RAQwv.js} +117 -55
- package/dist/{step-up-BjP--hG-.d.mts → step-up-Bz12gYKT.d.mts} +28 -12
- package/dist/step-up-Bz12gYKT.d.mts.map +1 -0
- package/dist/{step-up-BjP--hG-.d.ts → step-up-Bz12gYKT.d.ts} +28 -12
- package/dist/step-up-Bz12gYKT.d.ts.map +1 -0
- package/dist/test-fixtures/index.d.mts +4 -4
- package/dist/test-fixtures/index.d.mts.map +1 -1
- package/dist/test-fixtures/index.d.ts +4 -4
- package/dist/test-fixtures/index.d.ts.map +1 -1
- package/dist/test-fixtures/index.js +4 -4
- package/dist/test-fixtures/index.mjs +4 -4
- package/dist/test-fixtures/index.mjs.map +1 -1
- package/dist/tool-protection/index.d.mts +12 -0
- package/dist/tool-protection/index.d.mts.map +1 -1
- package/dist/tool-protection/index.d.ts +12 -0
- package/dist/tool-protection/index.d.ts.map +1 -1
- package/dist/tool-protection/index.js +46 -0
- package/dist/tool-protection/index.mjs +44 -1
- package/dist/tool-protection/index.mjs.map +1 -1
- package/dist/verification-BAw9N8Pt.js +181 -0
- package/dist/verification-Cvvv86TT.mjs +123 -0
- package/dist/verification-Cvvv86TT.mjs.map +1 -0
- package/fixtures/client-ip-resolution.n01.json +101 -0
- package/fixtures/kya-http/error-codes.json +2 -1
- package/fixtures/reviewer-grant-revocation.v1.json +53 -81
- package/package.json +55 -4
- package/dist/client-ip-B2Xeo-GK.mjs.map +0 -1
- package/dist/client-ip-DFamiNoz.d.mts +0 -34
- package/dist/client-ip-DFamiNoz.d.mts.map +0 -1
- package/dist/client-ip-DFamiNoz.d.ts +0 -34
- package/dist/client-ip-DFamiNoz.d.ts.map +0 -1
- package/dist/index-B7rTovHa.d.mts.map +0 -1
- package/dist/index-HaqfPtaL.d.ts.map +0 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.mts.map +0 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.ts.map +0 -1
- package/dist/kya-http-error-codes-C2JiWPsi.mjs.map +0 -1
- package/dist/posture-origins-Ba83O0cD.mjs.map +0 -1
- package/dist/registered-sid-D3g-gZQF.d.mts +0 -11
- package/dist/registered-sid-D3g-gZQF.d.mts.map +0 -1
- package/dist/registered-sid-D3g-gZQF.d.ts +0 -11
- package/dist/registered-sid-D3g-gZQF.d.ts.map +0 -1
- package/dist/registered-sid-hUl-bvM5.mjs.map +0 -1
- package/dist/schemas-7qodsG-Z.mjs.map +0 -1
- package/dist/step-up-BjP--hG-.d.mts.map +0 -1
- package/dist/step-up-BjP--hG-.d.ts.map +0 -1
- package/dist/step-up-COlmWJN8.mjs.map +0 -1
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as KYA_HTTP_ERROR } from "./kya-http-error-codes-7ewV5RuK.mjs";
|
|
3
|
-
//#region src/host-adapter/verdict-cookie.d.ts
|
|
4
|
-
interface RenderedResponseLike {
|
|
5
|
-
status: number | null;
|
|
6
|
-
headers: Record<string, string>;
|
|
7
|
-
}
|
|
8
|
-
declare const VERDICT_COOKIE_NAME = "__checkpoint_verdict";
|
|
9
|
-
type Verdict = 'allowed' | 'denied' | 'redirected';
|
|
10
|
-
declare function deriveVerdict(rendered: RenderedResponseLike): Verdict;
|
|
11
|
-
declare function encodeVerdictCookie(rendered: RenderedResponseLike): string;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/host-adapter/content-negotiation.d.ts
|
|
14
|
-
declare function acceptsHtml(input: Headers | Record<string, string | string[] | undefined> | string | undefined): boolean;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/host-adapter/decision-mapping.d.ts
|
|
17
|
-
declare const BLOCKED_PATH = "/blocked";
|
|
18
|
-
type ResponseShape = 'pass-through' | 'redirect' | 'html-block' | 'json-block';
|
|
19
|
-
declare function classifyResponseShape(rendered: RenderedResponseLike, clientAcceptsHtml: boolean): ResponseShape;
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/host-adapter/fetcher-envelope.d.ts
|
|
22
|
-
type FetcherHeaderInput = Headers | Record<string, string | string[] | undefined> | undefined;
|
|
23
|
-
declare const ACCEPT_CHALLENGE_HEADER = "kya-accept-challenge";
|
|
24
|
-
declare function serveBodyReadable200(headers: FetcherHeaderInput, detectionClass: unknown, isAgent: boolean): boolean;
|
|
25
|
-
type ChallengeEnvelopeMode = 'spec-401' | 'negotiated' | 'always-200';
|
|
26
|
-
declare function selectBodyReadable200(mode: ChallengeEnvelopeMode, headers: FetcherHeaderInput, detectionClass: unknown, isAgent: boolean): boolean;
|
|
27
|
-
//#endregion
|
|
1
|
+
import { A as ZodString, B as $strip, C as ZodNullable, E as ZodOptional, I as output, N as ZodUnion, O as ZodPrefault, T as ZodObject, g as ZodEnum, h as ZodDiscriminatedUnion, l as ZodArray, m as ZodDefault, t as external_d_exports, u as ZodBoolean, w as ZodNumber, x as ZodLiteral } from "./external-m3Kmafwj.mjs";
|
|
28
2
|
//#region src/policy/schemas.d.ts
|
|
29
3
|
declare const EnforcementActionSchema: ZodEnum<{
|
|
30
4
|
permit: "permit";
|
|
@@ -35,17 +9,11 @@ declare const EnforcementActionSchema: ZodEnum<{
|
|
|
35
9
|
log: "log";
|
|
36
10
|
instruct: "instruct";
|
|
37
11
|
}>;
|
|
38
|
-
declare const StrictEnforcementActionSchema: ZodEnum<{
|
|
39
|
-
permit: "permit";
|
|
40
|
-
block: "block";
|
|
41
|
-
redirect: "redirect";
|
|
42
|
-
challenge: "challenge";
|
|
43
|
-
instruct: "instruct";
|
|
44
|
-
}>;
|
|
45
12
|
declare const EnforcementModeSchema: ZodEnum<{
|
|
46
13
|
enforce: "enforce";
|
|
47
14
|
observe: "observe";
|
|
48
15
|
}>;
|
|
16
|
+
type EnforcementMode = output<typeof EnforcementModeSchema>;
|
|
49
17
|
declare const BlockReasonSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
50
18
|
kind: ZodLiteral<"Revoked">;
|
|
51
19
|
}, $strip>, ZodObject<{
|
|
@@ -105,7 +73,6 @@ declare const ChallengeParamsSchema: ZodObject<{
|
|
|
105
73
|
challengeType: ZodOptional<ZodString>;
|
|
106
74
|
}, $strip>;
|
|
107
75
|
type ChallengeParams = output<typeof ChallengeParamsSchema>;
|
|
108
|
-
declare function normalizeChallengeType(challengeType: string | undefined): 'delegation' | 'browser_integrity' | 'human_step_up';
|
|
109
76
|
declare const RedirectTargetSchema: ZodObject<{
|
|
110
77
|
url: ZodString;
|
|
111
78
|
reason: ZodString;
|
|
@@ -284,22 +251,22 @@ declare const AllowListEntrySchema: ZodObject<{
|
|
|
284
251
|
}, $strip>;
|
|
285
252
|
declare const ConditionOperatorSchema: ZodEnum<{
|
|
286
253
|
in: "in";
|
|
254
|
+
matches: "matches";
|
|
255
|
+
endsWith: "endsWith";
|
|
256
|
+
startsWith: "startsWith";
|
|
287
257
|
equals: "equals";
|
|
288
258
|
notEquals: "notEquals";
|
|
289
259
|
contains: "contains";
|
|
290
260
|
notContains: "notContains";
|
|
291
|
-
startsWith: "startsWith";
|
|
292
|
-
endsWith: "endsWith";
|
|
293
261
|
greaterThan: "greaterThan";
|
|
294
262
|
lessThan: "lessThan";
|
|
295
263
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
296
264
|
lessThanOrEquals: "lessThanOrEquals";
|
|
297
|
-
matches: "matches";
|
|
298
265
|
notIn: "notIn";
|
|
299
266
|
}>;
|
|
300
267
|
declare const ConditionFieldSchema: ZodEnum<{
|
|
301
|
-
path: "path";
|
|
302
268
|
origin: "origin";
|
|
269
|
+
path: "path";
|
|
303
270
|
confidence: "confidence";
|
|
304
271
|
clientDid: "clientDid";
|
|
305
272
|
agentDid: "agentDid";
|
|
@@ -317,8 +284,8 @@ declare const ConditionFieldSchema: ZodEnum<{
|
|
|
317
284
|
declare const ConditionValueSchema: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
318
285
|
declare const PolicyConditionSchema: ZodObject<{
|
|
319
286
|
field: ZodEnum<{
|
|
320
|
-
path: "path";
|
|
321
287
|
origin: "origin";
|
|
288
|
+
path: "path";
|
|
322
289
|
confidence: "confidence";
|
|
323
290
|
clientDid: "clientDid";
|
|
324
291
|
agentDid: "agentDid";
|
|
@@ -335,17 +302,17 @@ declare const PolicyConditionSchema: ZodObject<{
|
|
|
335
302
|
}>;
|
|
336
303
|
operator: ZodEnum<{
|
|
337
304
|
in: "in";
|
|
305
|
+
matches: "matches";
|
|
306
|
+
endsWith: "endsWith";
|
|
307
|
+
startsWith: "startsWith";
|
|
338
308
|
equals: "equals";
|
|
339
309
|
notEquals: "notEquals";
|
|
340
310
|
contains: "contains";
|
|
341
311
|
notContains: "notContains";
|
|
342
|
-
startsWith: "startsWith";
|
|
343
|
-
endsWith: "endsWith";
|
|
344
312
|
greaterThan: "greaterThan";
|
|
345
313
|
lessThan: "lessThan";
|
|
346
314
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
347
315
|
lessThanOrEquals: "lessThanOrEquals";
|
|
348
|
-
matches: "matches";
|
|
349
316
|
notIn: "notIn";
|
|
350
317
|
}>;
|
|
351
318
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -363,8 +330,8 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
363
330
|
priority: ZodDefault<ZodNumber>;
|
|
364
331
|
conditions: ZodArray<ZodObject<{
|
|
365
332
|
field: ZodEnum<{
|
|
366
|
-
path: "path";
|
|
367
333
|
origin: "origin";
|
|
334
|
+
path: "path";
|
|
368
335
|
confidence: "confidence";
|
|
369
336
|
clientDid: "clientDid";
|
|
370
337
|
agentDid: "agentDid";
|
|
@@ -381,17 +348,17 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
381
348
|
}>;
|
|
382
349
|
operator: ZodEnum<{
|
|
383
350
|
in: "in";
|
|
351
|
+
matches: "matches";
|
|
352
|
+
endsWith: "endsWith";
|
|
353
|
+
startsWith: "startsWith";
|
|
384
354
|
equals: "equals";
|
|
385
355
|
notEquals: "notEquals";
|
|
386
356
|
contains: "contains";
|
|
387
357
|
notContains: "notContains";
|
|
388
|
-
startsWith: "startsWith";
|
|
389
|
-
endsWith: "endsWith";
|
|
390
358
|
greaterThan: "greaterThan";
|
|
391
359
|
lessThan: "lessThan";
|
|
392
360
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
393
361
|
lessThanOrEquals: "lessThanOrEquals";
|
|
394
|
-
matches: "matches";
|
|
395
362
|
notIn: "notIn";
|
|
396
363
|
}>;
|
|
397
364
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -484,8 +451,8 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
484
451
|
priority: ZodDefault<ZodNumber>;
|
|
485
452
|
conditions: ZodArray<ZodObject<{
|
|
486
453
|
field: ZodEnum<{
|
|
487
|
-
path: "path";
|
|
488
454
|
origin: "origin";
|
|
455
|
+
path: "path";
|
|
489
456
|
confidence: "confidence";
|
|
490
457
|
clientDid: "clientDid";
|
|
491
458
|
agentDid: "agentDid";
|
|
@@ -502,17 +469,17 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
502
469
|
}>;
|
|
503
470
|
operator: ZodEnum<{
|
|
504
471
|
in: "in";
|
|
472
|
+
matches: "matches";
|
|
473
|
+
endsWith: "endsWith";
|
|
474
|
+
startsWith: "startsWith";
|
|
505
475
|
equals: "equals";
|
|
506
476
|
notEquals: "notEquals";
|
|
507
477
|
contains: "contains";
|
|
508
478
|
notContains: "notContains";
|
|
509
|
-
startsWith: "startsWith";
|
|
510
|
-
endsWith: "endsWith";
|
|
511
479
|
greaterThan: "greaterThan";
|
|
512
480
|
lessThan: "lessThan";
|
|
513
481
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
514
482
|
lessThanOrEquals: "lessThanOrEquals";
|
|
515
|
-
matches: "matches";
|
|
516
483
|
notIn: "notIn";
|
|
517
484
|
}>;
|
|
518
485
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -550,158 +517,19 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
550
517
|
trustedDelegationRoots: ZodOptional<ZodArray<ZodString>>;
|
|
551
518
|
authorizationServerIssuer: ZodOptional<ZodString>;
|
|
552
519
|
}, $strip>;
|
|
553
|
-
|
|
554
|
-
agentType: ZodOptional<ZodString>;
|
|
555
|
-
agentName: ZodOptional<ZodString>;
|
|
556
|
-
agentVendor: ZodOptional<ZodString>;
|
|
557
|
-
clientDid: ZodOptional<ZodString>;
|
|
558
|
-
agentDid: ZodOptional<ZodString>;
|
|
559
|
-
confidence: ZodOptional<ZodNumber>;
|
|
560
|
-
reputationScore: ZodOptional<ZodNumber>;
|
|
561
|
-
riskLevel: ZodOptional<ZodString>;
|
|
562
|
-
path: ZodOptional<ZodString>;
|
|
563
|
-
method: ZodOptional<ZodString>;
|
|
564
|
-
origin: ZodOptional<ZodString>;
|
|
565
|
-
userAgent: ZodOptional<ZodString>;
|
|
566
|
-
signatureVerified: ZodDefault<ZodBoolean>;
|
|
567
|
-
isAuthenticated: ZodDefault<ZodBoolean>;
|
|
568
|
-
hasValidDelegation: ZodDefault<ZodBoolean>;
|
|
569
|
-
}, $strip>;
|
|
570
|
-
declare const PolicyMatchTypeSchema: ZodEnum<{
|
|
571
|
-
default: "default";
|
|
572
|
-
threshold: "threshold";
|
|
573
|
-
"allow-list": "allow-list";
|
|
574
|
-
"deny-list": "deny-list";
|
|
575
|
-
rule: "rule";
|
|
576
|
-
}>;
|
|
577
|
-
declare const PolicyEvaluationResultSchema: ZodObject<{
|
|
578
|
-
action: ZodEnum<{
|
|
579
|
-
permit: "permit";
|
|
580
|
-
allow: "allow";
|
|
581
|
-
block: "block";
|
|
582
|
-
redirect: "redirect";
|
|
583
|
-
challenge: "challenge";
|
|
584
|
-
log: "log";
|
|
585
|
-
instruct: "instruct";
|
|
586
|
-
}>;
|
|
587
|
-
reason: ZodString;
|
|
588
|
-
ruleId: ZodOptional<ZodString>;
|
|
589
|
-
ruleName: ZodOptional<ZodString>;
|
|
590
|
-
redirectUrl: ZodOptional<ZodString>;
|
|
591
|
-
message: ZodOptional<ZodString>;
|
|
592
|
-
matchType: ZodEnum<{
|
|
593
|
-
default: "default";
|
|
594
|
-
threshold: "threshold";
|
|
595
|
-
"allow-list": "allow-list";
|
|
596
|
-
"deny-list": "deny-list";
|
|
597
|
-
rule: "rule";
|
|
598
|
-
}>;
|
|
599
|
-
}, $strip>;
|
|
520
|
+
type EnforcementAction = output<typeof EnforcementActionSchema>;
|
|
600
521
|
type ThresholdConfig = output<typeof ThresholdConfigSchema>;
|
|
601
522
|
type DenyListEntry = output<typeof DenyListEntrySchema>;
|
|
602
523
|
type AllowListEntry = output<typeof AllowListEntrySchema>;
|
|
524
|
+
type ConditionOperator = output<typeof ConditionOperatorSchema>;
|
|
525
|
+
type ConditionField = output<typeof ConditionFieldSchema>;
|
|
603
526
|
type ConditionValue = output<typeof ConditionValueSchema>;
|
|
604
527
|
type PolicyCondition = output<typeof PolicyConditionSchema>;
|
|
605
528
|
type RuleMetadata = output<typeof RuleMetadataSchema>;
|
|
606
529
|
type PolicyRule = output<typeof PolicyRuleSchema>;
|
|
607
530
|
type PolicyMetadata = output<typeof PolicyMetadataSchema>;
|
|
608
531
|
type PolicyConfig = output<typeof PolicyConfigSchema>;
|
|
609
|
-
type PolicyEvaluationContext = output<typeof PolicyEvaluationContextSchema>;
|
|
610
|
-
type PolicyEvaluationResult = output<typeof PolicyEvaluationResultSchema>;
|
|
611
|
-
declare function parsePolicyConfig(data: unknown): PolicyConfig;
|
|
612
532
|
declare function safeParsePolicyConfig(data: unknown): PolicyConfig | null;
|
|
613
|
-
declare function parseEvaluationContext(data: unknown): PolicyEvaluationContext;
|
|
614
|
-
//#endregion
|
|
615
|
-
//#region src/host-adapter/challenge-wire.d.ts
|
|
616
|
-
type HeaderEntry = readonly [name: string, value: string];
|
|
617
|
-
type ChallengeWireKind = 'delegation' | 'approval_quorum';
|
|
618
|
-
interface ChallengeWireInputBase {
|
|
619
|
-
realm: string;
|
|
620
|
-
sid: string;
|
|
621
|
-
consentUri: string;
|
|
622
|
-
pickupUri: string;
|
|
623
|
-
requiredScopes?: readonly string[];
|
|
624
|
-
pollIntervalS?: number;
|
|
625
|
-
challengeProof: unknown;
|
|
626
|
-
minAssurance?: AssuranceTier;
|
|
627
|
-
}
|
|
628
|
-
interface DelegationChallengeWireInput extends ChallengeWireInputBase {
|
|
629
|
-
kind?: 'delegation';
|
|
630
|
-
resourceMetadataUri: string;
|
|
631
|
-
}
|
|
632
|
-
interface ApprovalQuorumChallengeWireInput extends ChallengeWireInputBase {
|
|
633
|
-
kind: 'approval_quorum';
|
|
634
|
-
quorum: number;
|
|
635
|
-
actionNonce: string;
|
|
636
|
-
}
|
|
637
|
-
type ChallengeWireInput = DelegationChallengeWireInput | ApprovalQuorumChallengeWireInput;
|
|
638
|
-
interface CommonChallengeKyaos {
|
|
639
|
-
sid: string;
|
|
640
|
-
consent_uri: string;
|
|
641
|
-
pickup_uri: string;
|
|
642
|
-
required_scopes?: string[];
|
|
643
|
-
min_assurance?: AssuranceTier;
|
|
644
|
-
poll_interval_s: number;
|
|
645
|
-
challenge_proof: unknown;
|
|
646
|
-
}
|
|
647
|
-
interface DelegationChallengeKyaos extends CommonChallengeKyaos {
|
|
648
|
-
action: {
|
|
649
|
-
type: 'delegation';
|
|
650
|
-
consent_uri: string;
|
|
651
|
-
pickup_uri: string;
|
|
652
|
-
poll_interval_s: number;
|
|
653
|
-
pin: {
|
|
654
|
-
header: 'X-KYA-Pickup-Token';
|
|
655
|
-
};
|
|
656
|
-
retry: {
|
|
657
|
-
header: 'Authorization';
|
|
658
|
-
scheme: 'Bearer';
|
|
659
|
-
value_from: 'delegation';
|
|
660
|
-
};
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
interface ApprovalQuorumChallengeKyaos extends CommonChallengeKyaos {
|
|
664
|
-
kind: 'approval_quorum';
|
|
665
|
-
quorum: number;
|
|
666
|
-
action_nonce: string;
|
|
667
|
-
}
|
|
668
|
-
interface DelegationChallengeBody {
|
|
669
|
-
error: typeof KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED;
|
|
670
|
-
kyaos: DelegationChallengeKyaos | ApprovalQuorumChallengeKyaos;
|
|
671
|
-
instructions: string;
|
|
672
|
-
}
|
|
673
|
-
interface DelegationChallengeEnvelope {
|
|
674
|
-
status: 401 | 200;
|
|
675
|
-
headers: HeaderEntry[];
|
|
676
|
-
body: DelegationChallengeBody;
|
|
677
|
-
}
|
|
678
|
-
type DelegationChallengeEnvelopeMode = 'spec-401' | 'fetcher-200';
|
|
679
|
-
type ChallengeWireErrorCode = 'invalid-realm' | 'invalid-sid' | 'invalid-uri' | 'invalid-scope' | 'invalid-assurance' | 'invalid-interval' | 'invalid-proof' | 'invalid-kind' | 'invalid-quorum' | 'invalid-action-nonce' | 'unsupported-envelope';
|
|
680
|
-
declare class ChallengeWireError extends TypeError {
|
|
681
|
-
readonly code: ChallengeWireErrorCode;
|
|
682
|
-
constructor(code: ChallengeWireErrorCode, message: string);
|
|
683
|
-
}
|
|
684
|
-
declare function generateDelegationSid(): string;
|
|
685
|
-
declare function deriveDelegationPickupUri(consentUri: string, sid: string): string;
|
|
686
|
-
declare function buildDelegationChallengeHeader(input: ChallengeWireInput): string;
|
|
687
|
-
declare function buildDelegationBearerHeader(realm: string): string;
|
|
688
|
-
declare function buildDelegationInstructions(consentUri: string, pickupUri: string, pollIntervalS: number): string;
|
|
689
|
-
declare function buildDelegationChallengeBody(input: ChallengeWireInput): DelegationChallengeBody;
|
|
690
|
-
declare function buildDelegationChallengeEnvelope(input: ChallengeWireInput, mode?: DelegationChallengeEnvelopeMode): DelegationChallengeEnvelope;
|
|
691
|
-
declare const buildChallengeWire: typeof buildDelegationChallengeEnvelope;
|
|
692
|
-
//#endregion
|
|
693
|
-
//#region src/host-adapter/challenge-context.d.ts
|
|
694
|
-
declare const DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = 3000;
|
|
695
|
-
type ChallengeContextFailure = 'timeout' | 'resolver-error' | 'invalid-context';
|
|
696
|
-
interface ChallengeContextFailureEvent {
|
|
697
|
-
reason: ChallengeContextFailure;
|
|
698
|
-
message: string;
|
|
699
|
-
}
|
|
700
|
-
interface ResolveChallengeContextOptions {
|
|
701
|
-
timeoutMs?: number;
|
|
702
|
-
onFailure?: (event: ChallengeContextFailureEvent) => void;
|
|
703
|
-
}
|
|
704
|
-
declare function resolveChallengeContext<TContext>(resolver: ((context: TContext) => ChallengeWireInput | undefined | Promise<ChallengeWireInput | undefined>) | undefined, context: TContext, options?: ResolveChallengeContextOptions): Promise<ChallengeWireInput | undefined>;
|
|
705
533
|
//#endregion
|
|
706
|
-
export {
|
|
707
|
-
//# sourceMappingURL=
|
|
534
|
+
export { PolicyMetadataSchema as A, ThresholdConfigSchema as B, InstructPayload as C, PolicyConfig as D, PolicyConditionSchema as E, RuleMetadata as F, RuleMetadataSchema as I, SuggestedAction as L, PolicyRuleSchema as M, RedirectTarget as N, PolicyConfigSchema as O, RedirectTargetSchema as P, SuggestedActionSchema as R, EnforcementModeSchema as S, PolicyCondition as T, safeParsePolicyConfig as V, DenyListEntry as _, BlockReason as a, EnforcementActionSchema as b, ChallengeParamsSchema as c, ConditionOperator as d, ConditionOperatorSchema as f, DecisionSchema as g, Decision as h, AssuranceTierSchema as i, PolicyRule as j, PolicyMetadata as k, ConditionField as l, ConditionValueSchema as m, AllowListEntrySchema as n, BlockReasonSchema as o, ConditionValue as p, AssuranceTier as r, ChallengeParams as s, AllowListEntry as t, ConditionFieldSchema as u, DenyListEntrySchema as v, InstructPayloadSchema as w, EnforcementMode as x, EnforcementAction as y, ThresholdConfig as z };
|
|
535
|
+
//# sourceMappingURL=schemas-m-GqyfyO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas-m-GqyfyO.d.mts","names":[],"sources":["../src/policy/schemas.ts"],"mappings":";;cAiCa,yBAAuB;;;;;;;;;cAgBvB,uBAAqB;;;;KAEtB,kBAAkB,cAAe;cAoBhC,mBAAiB,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6C5B;KAEU,cAAc,cAAe;cAS5B,qBAAmB;;;;;;;KASpB,gBAAgB,cAAe;cAQ9B,uBAAqB;;;;;;;;;;;;;;GAsBhC;KAEU,kBAAkB,cAAe;cAIhC,sBAAoB;;;;;GAM/B;KAEU,iBAAiB,cAAe;cAE/B,uBAAqB,uBAAA;;;;;;;;;;;;;;GAShC;KAEU,kBAAkB,cAAe;cAEhC,uBAAqB;;;;;;;;;;;;;;;;;;;GAMhC;KAEU,kBAAkB,cAAe;cAUhC,gBAAc,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASzB;KAEU,WAAW,cAAe;cAMzB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;GAiBhC;cAMW,qBAAmB;;;;;;;;;;GAmB9B;cAEW,sBAAoB;;;;;;;;GAe/B;cAMW,yBAAuB;;;;;;;;;;;;;;;cAgBvB,sBAAoB;;;;;;;;;;;;;;;;;cAsBpB,sBAAoB,mBAAA,WAAA,WAAA,YAAA,SAAA;cAOpB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAShC;cAMW,oBAAkB;;;;GAI7B;cAEW,kBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqB3B;cAMW,sBAAoB;;;;GAI/B;cAEW,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF7B;KAMU,oBAAoB,cAAe;KACnC,kBAAkB,cAAe;KACjC,gBAAgB,cAAe;KAC/B,iBAAiB,cAAe;KAChC,oBAAoB,cAAe;KACnC,iBAAiB,cAAe;KAChC,iBAAiB,cAAe;KAChC,kBAAkB,cAAe;KACjC,eAAe,cAAe;KAC9B,aAAa,cAAe;KAC5B,iBAAiB,cAAe;KAChC,eAAe,cAAe;iBAW1B,sBAAsB,gBAAgB"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
//#region src/policy/engine-enforcing.ts
|
|
2
|
-
/**
|
|
3
|
-
* The act-gate for a composed policy: the engine acts on it only when engine
|
|
4
|
-
* enforcement is switched on and the policy is not disabled. Otherwise the
|
|
5
|
-
* composed policy is at most shadow-evaluated. Kept apart from `schemas.ts`,
|
|
6
|
-
* which builds Zod schemas when it loads, so request-time callers can use it
|
|
7
|
-
* without loading Zod.
|
|
8
|
-
*/
|
|
9
|
-
function isEngineEnforcing(flags) {
|
|
10
|
-
return flags.engineEnforcementEnabled === true && flags.enabled !== false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
1
|
//#region src/policy/fail-closed-response.ts
|
|
15
2
|
const FAIL_CLOSED_STATUS = 503;
|
|
16
3
|
const FAIL_CLOSED_RETRY_AFTER_SECONDS = 3;
|
|
@@ -24,6 +11,39 @@ const FAIL_CLOSED_HEADERS = {
|
|
|
24
11
|
"Retry-After": String(3)
|
|
25
12
|
};
|
|
26
13
|
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/policy/match-path.ts
|
|
16
|
+
/**
|
|
17
|
+
* Match a request path against a policy path pattern: an exact path, a glob
|
|
18
|
+
* (`*` within a segment, `**` across segments), a prefix ending in `/`, or a
|
|
19
|
+
* prefix that stops at a segment boundary (`/api` matches `/api/users`, not
|
|
20
|
+
* `/apiv2`). Kept out of the Zod modules so request-time callers can use it
|
|
21
|
+
* from `./policy/enforcement`.
|
|
22
|
+
*/
|
|
23
|
+
function matchPath(path, pattern) {
|
|
24
|
+
if (pattern === path) return true;
|
|
25
|
+
if (pattern.includes("*")) {
|
|
26
|
+
const regexPattern = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "<<GLOBSTAR>>").replace(/\*/g, "[^/]*").replace(/<<GLOBSTAR>>/g, ".*");
|
|
27
|
+
try {
|
|
28
|
+
return new RegExp(`^${regexPattern}$`).test(path);
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (pattern.endsWith("/")) return path.startsWith(pattern) || path === pattern.slice(0, -1);
|
|
34
|
+
if (!path.startsWith(pattern)) return false;
|
|
35
|
+
if (path === pattern) return true;
|
|
36
|
+
return path[pattern.length] === "/";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/policy/cedar-space.ts
|
|
41
|
+
const CEDAR_SPACE_CLASS = "[\\t-\\r \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]";
|
|
42
|
+
function isCedarSpace(char) {
|
|
43
|
+
const code = char.charCodeAt(0);
|
|
44
|
+
return code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
//#endregion
|
|
28
48
|
//#region src/policy/cedar-mask.ts
|
|
29
49
|
const blank = (char) => char === "\n" || char === "\r" ? char : " ";
|
|
@@ -54,14 +74,6 @@ function maskCedar(cedar) {
|
|
|
54
74
|
};
|
|
55
75
|
}
|
|
56
76
|
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/policy/cedar-space.ts
|
|
59
|
-
const CEDAR_SPACE_CLASS = "[\\t-\\r \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]";
|
|
60
|
-
function isCedarSpace(char) {
|
|
61
|
-
const code = char.charCodeAt(0);
|
|
62
|
-
return code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
77
|
//#endregion
|
|
66
78
|
//#region src/policy/cedar-string.ts
|
|
67
79
|
/**
|
|
@@ -1140,7 +1152,6 @@ function isBaselinePermit(statement) {
|
|
|
1140
1152
|
* narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows.
|
|
1141
1153
|
*/
|
|
1142
1154
|
const UNLESS_BRACE = new RegExp(`unless${CEDAR_SPACE_CLASS}*\\{`);
|
|
1143
|
-
const FORBID_HEAD = new RegExp(`\\bforbid${CEDAR_SPACE_CLASS}*\\(`, "g");
|
|
1144
1155
|
/**
|
|
1145
1156
|
* A block applies when its path AND principal conditions all match the KNOWN
|
|
1146
1157
|
* request facts. An unknown fact never narrows (so the no-`request` case unions
|
|
@@ -1283,17 +1294,6 @@ function blockMatchesEquality(block, attr, value) {
|
|
|
1283
1294
|
function pathLiteralMatches(literal, path) {
|
|
1284
1295
|
return globMatches(literal.split("*"), path);
|
|
1285
1296
|
}
|
|
1286
|
-
/**
|
|
1287
|
-
* True when the block contains a Cedar `forbid` statement (a deny rule). A bare
|
|
1288
|
-
* `forbid` defaults to BLOCK; a `@verdict(...)` annotation refines the kind.
|
|
1289
|
-
*/
|
|
1290
|
-
function isForbidBlock(block) {
|
|
1291
|
-
const { code } = maskCedar(block);
|
|
1292
|
-
return Array.from(code.matchAll(FORBID_HEAD)).some(({ index }) => !isAnnotationName(code, index));
|
|
1293
|
-
}
|
|
1294
|
-
function isUnnarrowedDenyBlock(block) {
|
|
1295
|
-
return unnarrowedDenyStatements(block).some(({ classes }) => classes.includes("human"));
|
|
1296
|
-
}
|
|
1297
1297
|
function analyzePolicySource(cedar) {
|
|
1298
1298
|
const scope = analyzePolicyScope(cedar);
|
|
1299
1299
|
const analysis = {
|
|
@@ -1308,12 +1308,6 @@ function analyzePolicySource(cedar) {
|
|
|
1308
1308
|
function pathHasUnnarrowedDenyRuleFor(cedar, path, probe) {
|
|
1309
1309
|
return analyzePolicySource(cedar).unnarrowedDenyFor(path, probe);
|
|
1310
1310
|
}
|
|
1311
|
-
function pathHasExplicitDenyRuleFor(cedar, path, probe) {
|
|
1312
|
-
return analyzePolicySource(cedar).explicitDenyFor(path, probe);
|
|
1313
|
-
}
|
|
1314
|
-
function pathHasUnnarrowedDenyRule(cedar, path) {
|
|
1315
|
-
return analyzePolicySource(cedar).humanHazard(path);
|
|
1316
|
-
}
|
|
1317
1311
|
|
|
1318
1312
|
//#endregion
|
|
1319
1313
|
//#region src/policy/byte-bounded-memo.ts
|
|
@@ -1408,6 +1402,62 @@ function decisionPolicyId(decision) {
|
|
|
1408
1402
|
}
|
|
1409
1403
|
}
|
|
1410
1404
|
|
|
1405
|
+
//#endregion
|
|
1406
|
+
//#region src/policy/bespoke-policy.ts
|
|
1407
|
+
/** Stable synthetic `@id` per explicit bespoke mechanism. */
|
|
1408
|
+
const BESPOKE_POLICY_IDS = {
|
|
1409
|
+
denyList: "bespoke-deny-list",
|
|
1410
|
+
allowList: "bespoke-allow-list",
|
|
1411
|
+
pathRule: "bespoke-path-rule",
|
|
1412
|
+
threshold: "bespoke-threshold"
|
|
1413
|
+
};
|
|
1414
|
+
const BESPOKE_POLICY_LABELS = {
|
|
1415
|
+
[BESPOKE_POLICY_IDS.denyList]: "Deny list",
|
|
1416
|
+
[BESPOKE_POLICY_IDS.allowList]: "Allow list",
|
|
1417
|
+
[BESPOKE_POLICY_IDS.pathRule]: "Path rule",
|
|
1418
|
+
[BESPOKE_POLICY_IDS.threshold]: "Confidence threshold"
|
|
1419
|
+
};
|
|
1420
|
+
const BESPOKE_POLICY_ID_SET = new Set(Object.values(BESPOKE_POLICY_IDS));
|
|
1421
|
+
/** True when `policyId` is one of our synthetic bespoke ids (vs. an authored Cedar `@id`). */
|
|
1422
|
+
function isBespokePolicyId(policyId) {
|
|
1423
|
+
return typeof policyId === "string" && BESPOKE_POLICY_ID_SET.has(policyId);
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Human-readable label for a bespoke `@id`; `null` for an unrecognized id so the
|
|
1427
|
+
* caller can fall back to showing the raw id.
|
|
1428
|
+
*/
|
|
1429
|
+
function bespokePolicyLabel(policyId) {
|
|
1430
|
+
return BESPOKE_POLICY_LABELS[policyId] ?? null;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* The compose engine's implicit default-allow baseline rule `@id`. The engine
|
|
1434
|
+
* emits it into every composed Cedar bundle (see
|
|
1435
|
+
* `apps/web/lib/compose/cedar.ts` `DEFAULT_ALLOW_BASELINE`), but the policy
|
|
1436
|
+
* list/detail derivation excludes it — "the implicit allow-all, not a user
|
|
1437
|
+
* rule" — so it has NO detail page. `/activity` attributes a row to it but must
|
|
1438
|
+
* never link it (a deep link 404s). Kept here so the activity reader recognizes
|
|
1439
|
+
* it without importing the compose engine into the client bundle; a test pins
|
|
1440
|
+
* that this string still matches the emitter's `@id`.
|
|
1441
|
+
*/
|
|
1442
|
+
const BASELINE_ALLOW_POLICY_ID = "baseline-allow";
|
|
1443
|
+
/**
|
|
1444
|
+
* `policyId`s that have NO policy-detail page: the synthetic bespoke mechanisms
|
|
1445
|
+
* AND the implicit `baseline-allow`. `/activity` attributes these but must not
|
|
1446
|
+
* deep-link them.
|
|
1447
|
+
*/
|
|
1448
|
+
function isNonNavigablePolicyId(policyId) {
|
|
1449
|
+
return isBespokePolicyId(policyId) || policyId === "baseline-allow";
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Friendly label for a non-navigable policy id (bespoke mechanism or
|
|
1453
|
+
* `baseline-allow`); `null` for a real authored policy id (caller resolves the
|
|
1454
|
+
* projection name / raw `@id` instead).
|
|
1455
|
+
*/
|
|
1456
|
+
function nonNavigablePolicyLabel(policyId) {
|
|
1457
|
+
if (policyId === "baseline-allow") return "Default allow";
|
|
1458
|
+
return typeof policyId === "string" ? bespokePolicyLabel(policyId) : null;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1411
1461
|
//#endregion
|
|
1412
1462
|
//#region src/policy/approval-quorum.ts
|
|
1413
1463
|
/**
|
|
@@ -1509,5 +1559,5 @@ function validateStepUpQuorum(quorum) {
|
|
|
1509
1559
|
}
|
|
1510
1560
|
|
|
1511
1561
|
//#endregion
|
|
1512
|
-
export {
|
|
1513
|
-
//# sourceMappingURL=step-up-
|
|
1562
|
+
export { matchPath as A, NO_EVIDENCE_CATEGORY as C, cedarQuotedValueRegExp as D, withNoEvidenceExclusion as E, FAIL_CLOSED_HEADERS as M, FAIL_CLOSED_STATUS as N, escapeCedarString as O, unnarrowedDenyStatements as S, NO_EVIDENCE_EXCLUSION_TERM as T, PROBE_CLASSES as _, bespokePolicyLabel as a, statementApplies as b, nonNavigablePolicyLabel as c, ByteBoundedMemo as d, analyzePolicySource as f, splitCedarBlocks as g, pathLiteralsInBlock as h, BESPOKE_POLICY_IDS as i, FAIL_CLOSED_BODY as j, unescapeCedarString as k, decisionPolicyId as l, pathHasUnnarrowedDenyRuleFor as m, approvalQuorumForRequest as n, isBespokePolicyId as o, blockEqualityLiterals as p, BASELINE_ALLOW_POLICY_ID as r, isNonNavigablePolicyId as s, validateStepUpQuorum as t, requiredScopesForRequest as u, lacksBaselinePermit as v, NO_EVIDENCE_EQUALITY_TERM as w, statementId as x, parseCedarStatements as y };
|
|
1563
|
+
//# sourceMappingURL=step-up-BK0oBi11.mjs.map
|