@kya-os/checkpoint-shared 1.5.2 → 1.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/CHANGELOG.md +98 -1
- package/dist/beacon-types/index.d.mts +12 -1
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +12 -1
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +18 -1
- package/dist/beacon-types/index.mjs +18 -2
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/{browser-posture-D4j2a5gi.d.ts → browser-posture-B8YiPa5c.d.ts} +6 -6
- package/dist/{browser-posture-D4j2a5gi.d.ts.map → browser-posture-B8YiPa5c.d.ts.map} +1 -1
- package/dist/{browser-posture-DVoHMHjY.d.mts → browser-posture-BLhw-MON.d.mts} +6 -6
- package/dist/{browser-posture-DVoHMHjY.d.mts.map → browser-posture-BLhw-MON.d.mts.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.d.mts +2 -2
- package/dist/browser-posture-proof.d.mts.map +1 -1
- package/dist/browser-posture-proof.d.ts +2 -2
- package/dist/browser-posture-proof.d.ts.map +1 -1
- package/dist/browser-posture-proof.js +43 -2
- package/dist/browser-posture-proof.mjs +43 -2
- 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 +3 -3
- package/dist/browser-posture.mjs +3 -3
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/canonical-signer/index.d.mts.map +1 -1
- package/dist/canonical-signer/index.d.ts.map +1 -1
- package/dist/canonical-signer/index.js +86 -51
- package/dist/canonical-signer/index.mjs +86 -51
- 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-DFamiNoz.d.mts +34 -0
- package/dist/client-ip-DFamiNoz.d.mts.map +1 -0
- package/dist/client-ip-DFamiNoz.d.ts +34 -0
- package/dist/client-ip-DFamiNoz.d.ts.map +1 -0
- package/dist/client-ip.d.mts +2 -0
- package/dist/client-ip.d.ts +2 -0
- package/dist/client-ip.js +7 -0
- package/dist/client-ip.mjs +3 -0
- package/dist/errors/index.d.mts +17 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +17 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +75 -3
- package/dist/errors/index.mjs +75 -3
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{external-Ct8j_hto.d.ts → external-B7WI9FyQ.d.mts} +2 -2
- package/dist/{external-Ct8j_hto.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
- package/dist/{external-Ct8j_hto.d.mts → external-B7WI9FyQ.d.ts} +2 -2
- package/dist/{external-Ct8j_hto.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
- package/dist/gateway-client-ip.d.mts +1 -1
- package/dist/gateway-client-ip.d.ts +1 -1
- package/dist/gateway-client-ip.js +1 -1
- package/dist/gateway-client-ip.mjs +1 -1
- package/dist/host-adapter/index.d.mts +2 -0
- package/dist/host-adapter/index.d.ts +2 -0
- package/dist/host-adapter/index.js +23 -0
- package/dist/host-adapter/index.mjs +3 -0
- package/dist/host-adapter-C-4IxmqM.mjs +540 -0
- package/dist/host-adapter-C-4IxmqM.mjs.map +1 -0
- package/dist/host-adapter-CwW9YB0U.js +694 -0
- package/dist/index-B7rTovHa.d.mts +707 -0
- package/dist/index-B7rTovHa.d.mts.map +1 -0
- package/dist/index-HaqfPtaL.d.ts +707 -0
- package/dist/index-HaqfPtaL.d.ts.map +1 -0
- package/dist/index.d.mts +742 -937
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +742 -937
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +758 -1193
- package/dist/index.mjs +659 -1148
- package/dist/index.mjs.map +1 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.mts +29 -0
- package/dist/kya-http-error-codes-7ewV5RuK.d.mts.map +1 -0
- package/dist/kya-http-error-codes-7ewV5RuK.d.ts +29 -0
- package/dist/kya-http-error-codes-7ewV5RuK.d.ts.map +1 -0
- package/dist/kya-http-error-codes-C2JiWPsi.mjs +73 -0
- package/dist/kya-http-error-codes-C2JiWPsi.mjs.map +1 -0
- package/dist/kya-http-error-codes-UYb1zpGM.js +83 -0
- package/dist/kya-http.d.mts +3 -0
- package/dist/kya-http.d.ts +3 -0
- package/dist/kya-http.js +11 -0
- package/dist/kya-http.mjs +4 -0
- package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
- package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
- package/dist/mcpi/approval-grant/index.js +10 -1
- package/dist/mcpi/approval-grant/index.mjs +10 -1
- package/dist/mcpi/approval-grant/index.mjs.map +1 -1
- package/dist/mcpi/dashboard-config/index.d.mts +3 -2
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
- package/dist/mcpi/dashboard-config/index.d.ts +3 -2
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
- package/dist/policy/enforcement.d.mts +2 -0
- package/dist/policy/enforcement.d.ts +2 -0
- package/dist/policy/enforcement.js +15 -0
- package/dist/policy/enforcement.mjs +3 -0
- package/dist/{posture-origins-Dl7i8j93.mjs → posture-origins-Ba83O0cD.mjs} +3 -3
- package/dist/posture-origins-Ba83O0cD.mjs.map +1 -0
- package/dist/{posture-origins-CEm83u4D.js → posture-origins-CdVOdiMT.js} +7 -1
- package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
- package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
- package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
- package/dist/registered-sid-D3g-gZQF.d.mts +11 -0
- package/dist/registered-sid-D3g-gZQF.d.mts.map +1 -0
- package/dist/registered-sid-D3g-gZQF.d.ts +11 -0
- package/dist/registered-sid-D3g-gZQF.d.ts.map +1 -0
- package/dist/registered-sid-eLCNZvIF.js +170 -0
- package/dist/registered-sid-hUl-bvM5.mjs +142 -0
- package/dist/registered-sid-hUl-bvM5.mjs.map +1 -0
- package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
- package/dist/schemas-7qodsG-Z.mjs.map +1 -0
- package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
- package/dist/step-up-BjP--hG-.d.mts +114 -0
- package/dist/step-up-BjP--hG-.d.mts.map +1 -0
- package/dist/step-up-BjP--hG-.d.ts +114 -0
- package/dist/step-up-BjP--hG-.d.ts.map +1 -0
- package/dist/step-up-C2d8C20x.js +1697 -0
- package/dist/step-up-COlmWJN8.mjs +1513 -0
- package/dist/step-up-COlmWJN8.mjs.map +1 -0
- package/fixtures/cli-registration.v2.json +115 -0
- package/fixtures/detection/reason-codes.json +1 -1
- package/fixtures/kya-http/README.md +34 -26
- package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
- package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
- package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
- package/fixtures/reviewer-grant-revocation.v1.json +285 -0
- package/package.json +26 -4
- package/dist/posture-origins-Dl7i8j93.mjs.map +0 -1
- package/dist/schemas-DxY-dk9y.mjs.map +0 -1
- package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { t as __commonJSMin } from "./rolldown-runtime-iY2fYEqi.mjs";
|
|
2
|
-
import { C as
|
|
3
|
-
import { a as
|
|
2
|
+
import { A as NEVER, C as string, D as _coercedBoolean, E as ZodError, O as _coercedDate, S as strictObject, T as unknown, _ as never, a as _instanceof, b as partialRecord, c as array, d as date$1, f as discriminatedUnion, g as literal, h as ipv6, i as _enum, k as _coercedNumber, l as boolean$1, m as ipv4, n as ZodDate, o as _null, r as ZodNumber, s as any, t as ZodBoolean, u as custom, v as number$1, w as union, x as record, y as object } from "./schemas-7qodsG-Z.mjs";
|
|
3
|
+
import { a as BROWSER_PATTERNS, c as OS_PATTERNS, d as UUID_PATTERN, f as VALIDATION_PATTERNS, g as testPatterns, h as testPattern, i as validatePostureOrigins, l as SUSPICIOUS_PATTERNS, m as findMatchingPattern, o as HEADER_PATTERNS, p as extractMatch, s as MOBILE_PATTERNS, t as isPublicSuffixLike, u as USER_AGENT_PATTERNS } from "./posture-origins-Ba83O0cD.mjs";
|
|
4
|
+
import { C as isLegacyDetectionClass, E as normalizeDetectionClassEnum, S as enumToDetectionClass, T as normalizeDetectionClass, _ as acceptsHtml, a as buildDelegationBearerHeader, b as encodeVerdictCookie, c as buildDelegationChallengeHeader, d as generateDelegationSid, f as ACCEPT_CHALLENGE_HEADER, g as classifyResponseShape, h as BLOCKED_PATH, i as buildChallengeWire, l as buildDelegationInstructions, m as serveBodyReadable200, n as resolveChallengeContext, o as buildDelegationChallengeBody, p as selectBodyReadable200, r as ChallengeWireError, s as buildDelegationChallengeEnvelope, t as DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, u as deriveDelegationPickupUri, v as VERDICT_COOKIE_NAME, w as migrateLegacyDetectionClass, x as detectionClassToEnum, y as deriveVerdict } from "./host-adapter-C-4IxmqM.mjs";
|
|
4
5
|
import { i as resolveClientIp, n as normalizeClientIp, r as parseIpv6, t as compressIpv6 } from "./client-ip-B2Xeo-GK.mjs";
|
|
6
|
+
import { A as FAIL_CLOSED_STATUS, C as NO_EVIDENCE_EXCLUSION_TERM, D as unescapeCedarString, E as escapeCedarString, O as FAIL_CLOSED_BODY, S as NO_EVIDENCE_EQUALITY_TERM, T as cedarQuotedValueRegExp, _ as parseCedarStatements, a as ByteBoundedMemo, b as unnarrowedDenyStatements, c as isForbidBlock, d as pathHasUnnarrowedDenyRule, f as pathHasUnnarrowedDenyRuleFor, g as lacksBaselinePermit, h as PROBE_CLASSES, i as requiredScopesForRequest, j as isEngineEnforcing, k as FAIL_CLOSED_HEADERS, l as isUnnarrowedDenyBlock, m as splitCedarBlocks, n as approvalQuorumForRequest, o as analyzePolicySource, p as pathLiteralsInBlock, r as decisionPolicyId, s as blockEqualityLiterals, t as validateStepUpQuorum, u as pathHasExplicitDenyRuleFor, v as statementApplies, w as withNoEvidenceExclusion, x as NO_EVIDENCE_CATEGORY, y as statementId } from "./step-up-COlmWJN8.mjs";
|
|
7
|
+
import { n as KYA_HTTP_ERROR_STATUS, t as KYA_HTTP_ERROR } from "./kya-http-error-codes-C2JiWPsi.mjs";
|
|
8
|
+
import { a as requestPresentedCredential, i as requestCarriesDelegationProof, n as SID_ATTRIBUTABLE_RESULT, r as DELEGATION_PROOF_HEADERS, t as REGISTERED_SID_MAX_LENGTH } from "./registered-sid-hUl-bvM5.mjs";
|
|
5
9
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
6
10
|
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
7
11
|
import { AUTH_MODES, CredentialProviderConfigSchema, OAuthProviderConfigSchema, PROVIDER_AUTH_TYPES, ProviderConfigSchema, ProviderDefinitionSchema as ProviderRegistryDefinitionSchema, validateProviderConfig, validateProviderDefinition } from "@kya-os/provider-registry";
|
|
@@ -38,6 +42,112 @@ function date(params) {
|
|
|
38
42
|
return _coercedDate(ZodDate, params);
|
|
39
43
|
}
|
|
40
44
|
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/core/network-assertions.ts
|
|
47
|
+
const ProxyCollectionStateSchema = _enum([
|
|
48
|
+
"current",
|
|
49
|
+
"unavailable",
|
|
50
|
+
"stale",
|
|
51
|
+
"unsupported",
|
|
52
|
+
"conflicting",
|
|
53
|
+
"insufficient_support"
|
|
54
|
+
]);
|
|
55
|
+
const epochSeconds = number$1().int().min(0).max(253402300799);
|
|
56
|
+
const percentage = number$1().int().min(0).max(100);
|
|
57
|
+
/** Source assertions describe request egress membership, never a visitor identity or fraud verdict. */
|
|
58
|
+
const ProxyAssertionSchema = object({
|
|
59
|
+
kind: string().min(1),
|
|
60
|
+
source: string().min(1),
|
|
61
|
+
subjectScope: literal("request_egress"),
|
|
62
|
+
membership: _enum([
|
|
63
|
+
"present",
|
|
64
|
+
"absent",
|
|
65
|
+
"unknown"
|
|
66
|
+
]),
|
|
67
|
+
evidenceGrade: _enum(["confirmed", "vendor_reported"]),
|
|
68
|
+
collectionState: ProxyCollectionStateSchema,
|
|
69
|
+
/** Unix seconds supplied by the source. Reader fetch time is not source observation time. */
|
|
70
|
+
observedAt: epochSeconds.nullable(),
|
|
71
|
+
expiresAt: epochSeconds.nullable(),
|
|
72
|
+
membershipConfidence: percentage.nullable(),
|
|
73
|
+
sourceReliability: percentage.nullable(),
|
|
74
|
+
fraudProbability: number$1().min(0).max(1).nullable(),
|
|
75
|
+
proxyClass: _enum(["datacenter", "unknown"]).optional()
|
|
76
|
+
}).strict();
|
|
77
|
+
const knownKinds = /* @__PURE__ */ new Set([
|
|
78
|
+
"tor_exit",
|
|
79
|
+
"published_vpn_exit",
|
|
80
|
+
"observed_proxy",
|
|
81
|
+
"suspected_residential_proxy",
|
|
82
|
+
"privacy_relay",
|
|
83
|
+
"local_tunnel",
|
|
84
|
+
"hosting"
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* The default admits only confirmed, current assertions. maxmind_legacy preserves
|
|
88
|
+
* existing vendor positives without claiming that its undated optional file is fresh.
|
|
89
|
+
* Uncertain evidence never produces a confirmed-clean false Boolean.
|
|
90
|
+
*/
|
|
91
|
+
function mapProxyAssertions(proxyAssertions, nowSeconds, collectionState, compatibility = "confirmed_current") {
|
|
92
|
+
const states = [collectionState];
|
|
93
|
+
const eligible = [];
|
|
94
|
+
for (const assertion of proxyAssertions) {
|
|
95
|
+
if (!knownKinds.has(assertion.kind)) {
|
|
96
|
+
states.push("unsupported");
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
states.push(assertion.collectionState);
|
|
100
|
+
if (assertion.collectionState !== "current" && assertion.collectionState !== "insufficient_support") {
|
|
101
|
+
states.push(assertion.collectionState);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const dated = assertion.observedAt !== null && assertion.expiresAt !== null;
|
|
105
|
+
const current = dated && assertion.observedAt <= nowSeconds && assertion.expiresAt > nowSeconds;
|
|
106
|
+
if (dated && !current) {
|
|
107
|
+
states.push("stale");
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const confirmed = assertion.evidenceGrade === "confirmed" && assertion.collectionState === "current" && current;
|
|
111
|
+
const legacy = compatibility === "maxmind_legacy" && assertion.source === "maxmind-anonymous-ip" && assertion.evidenceGrade === "vendor_reported" && assertion.collectionState === "insufficient_support" && assertion.observedAt === null && assertion.expiresAt === null;
|
|
112
|
+
if (confirmed || legacy) eligible.push(assertion);
|
|
113
|
+
else states.push("insufficient_support");
|
|
114
|
+
}
|
|
115
|
+
for (const assertion of eligible) if (assertion.membership === "present" && eligible.some((other) => other.kind === assertion.kind && other.membership === "absent")) states.push("conflicting");
|
|
116
|
+
if (proxyAssertions.length === 0) states.push("insufficient_support");
|
|
117
|
+
const proxyCollectionState = [
|
|
118
|
+
"conflicting",
|
|
119
|
+
"unsupported",
|
|
120
|
+
"unavailable",
|
|
121
|
+
"stale",
|
|
122
|
+
"insufficient_support",
|
|
123
|
+
"current"
|
|
124
|
+
].find((state) => states.includes(state));
|
|
125
|
+
const blocked = proxyCollectionState !== "current" && proxyCollectionState !== "insufficient_support";
|
|
126
|
+
const positive = eligible.filter((assertion) => assertion.membership === "present");
|
|
127
|
+
const preferred = [
|
|
128
|
+
positive.find((assertion) => assertion.kind === "tor_exit"),
|
|
129
|
+
positive.find((assertion) => assertion.kind === "published_vpn_exit"),
|
|
130
|
+
positive.find((assertion) => assertion.kind === "suspected_residential_proxy"),
|
|
131
|
+
positive.find((assertion) => assertion.kind === "observed_proxy" && assertion.proxyClass === "datacenter"),
|
|
132
|
+
positive.find((assertion) => assertion.kind === "observed_proxy")
|
|
133
|
+
].find(Boolean);
|
|
134
|
+
const types = {
|
|
135
|
+
tor_exit: "tor",
|
|
136
|
+
published_vpn_exit: "vpn",
|
|
137
|
+
suspected_residential_proxy: "residential_proxy",
|
|
138
|
+
observed_proxy: preferred?.proxyClass === "datacenter" ? "datacenter" : "unknown"
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
proxy: !blocked && preferred ? {
|
|
142
|
+
isProxy: true,
|
|
143
|
+
proxyType: types[preferred.kind],
|
|
144
|
+
confidence: preferred.membershipConfidence ?? (preferred.evidenceGrade === "vendor_reported" ? 90 : 0)
|
|
145
|
+
} : void 0,
|
|
146
|
+
proxyAssertions,
|
|
147
|
+
proxyCollectionState
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
41
151
|
//#endregion
|
|
42
152
|
//#region src/core/risk-score.ts
|
|
43
153
|
/**
|
|
@@ -485,8 +595,8 @@ const ProxyInfoSchema = object({
|
|
|
485
595
|
});
|
|
486
596
|
/**
|
|
487
597
|
* Host-supplied network / IP-intelligence context for a request's
|
|
488
|
-
* `trueIp`.
|
|
489
|
-
* engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
|
|
598
|
+
* `trueIp`. Legacy fields mirror the Rust `NetworkContext` and appear on
|
|
599
|
+
* the engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
|
|
490
600
|
* `EngineInfo` above — there is no wrapping `VerifyResultSchema`) when the
|
|
491
601
|
* host supplied one, and exposed to Cedar as `context.ip_routing_type` /
|
|
492
602
|
* `context.is_proxy`. Absent-safe: a request with no network context is
|
|
@@ -497,7 +607,13 @@ const NetworkContextSchema = object({
|
|
|
497
607
|
asn: number$1().int().nonnegative().optional(),
|
|
498
608
|
isp: string().optional(),
|
|
499
609
|
routingType: RoutingTypeSchema,
|
|
500
|
-
proxy: ProxyInfoSchema.optional()
|
|
610
|
+
proxy: ProxyInfoSchema.optional(),
|
|
611
|
+
/**
|
|
612
|
+
* TypeScript-host evidence, retained in detection rows and extended API read-back.
|
|
613
|
+
* Older Rust readers do not echo these additive fields.
|
|
614
|
+
*/
|
|
615
|
+
proxyAssertions: array(ProxyAssertionSchema).optional(),
|
|
616
|
+
proxyCollectionState: ProxyCollectionStateSchema.optional()
|
|
501
617
|
});
|
|
502
618
|
/**
|
|
503
619
|
* Descriptive detection detail from the engine.
|
|
@@ -606,7 +722,7 @@ const DetectionDetailSchema = object({
|
|
|
606
722
|
* `DetectionDetail.granted_scopes` (additive, omitted when empty). */
|
|
607
723
|
grantedScopes: array(string()).optional(),
|
|
608
724
|
/**
|
|
609
|
-
*
|
|
725
|
+
* Detection reason codes (#4874): namespaced detection/* codes, most-
|
|
610
726
|
* significant-evidence first, derived via mapDetectionToReasonCodes.
|
|
611
727
|
* Optional: only producers that opt into signal exposure (currently
|
|
612
728
|
* /api/v1/detect via buildDetectionSignalExposure) populate this.
|
|
@@ -1282,7 +1398,7 @@ function getVerificationRiskLevel(method, confidence) {
|
|
|
1282
1398
|
/**
|
|
1283
1399
|
* Detection reason-code mapping: the single pure projection of a
|
|
1284
1400
|
* detection's structured facts onto the `DETECTION_REASON_CODES` registry
|
|
1285
|
-
* (
|
|
1401
|
+
* (#4874).
|
|
1286
1402
|
*
|
|
1287
1403
|
* The engine already emits structured evidence (`signals[]` with a typed
|
|
1288
1404
|
* `source`, `verificationMethod`, `detectionClass`, `isAiCrawler`) but the
|
|
@@ -2533,7 +2649,6 @@ const DEFAULT_ENV_VARS = {
|
|
|
2533
2649
|
AGENTSHIELD_SECRET_KEY: "",
|
|
2534
2650
|
AGENTSHIELD_PIXEL_ID: "",
|
|
2535
2651
|
AGENTSHIELD_API_ENDPOINT: "https://api.agentshield.ai",
|
|
2536
|
-
AGENTSHIELD_WASM_PATH: "/wasm/agentshield_wasm_bg.wasm",
|
|
2537
2652
|
AGENTSHIELD_CACHE_TTL: "3600",
|
|
2538
2653
|
AGENTSHIELD_DEBUG: "false",
|
|
2539
2654
|
AGENTSHIELD_LOG_LEVEL: "info"
|
|
@@ -2797,7 +2912,9 @@ const BARE_ERRORS = {
|
|
|
2797
2912
|
BARE_INVALID_END_DATE: "INVALID_END_DATE",
|
|
2798
2913
|
BARE_INVALID_DATE_RANGE: "INVALID_DATE_RANGE",
|
|
2799
2914
|
BARE_INVALID_DATE: "INVALID_DATE",
|
|
2800
|
-
BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
2915
|
+
BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
2916
|
+
BARE_NOT_FOUND: "NOT_FOUND",
|
|
2917
|
+
BARE_FORBIDDEN: "FORBIDDEN"
|
|
2801
2918
|
};
|
|
2802
2919
|
/**
|
|
2803
2920
|
* Lowercase Error Codes
|
|
@@ -2967,6 +3084,40 @@ const KYAOS_PROTOCOL_ERRORS = {
|
|
|
2967
3084
|
KYAOS_SLASH_POLICY_UNAVAILABLE: "kyaos/policy-unavailable"
|
|
2968
3085
|
};
|
|
2969
3086
|
/**
|
|
3087
|
+
* Gateway Vault Resolve Error Codes
|
|
3088
|
+
*
|
|
3089
|
+
* Emitted by POST /api/v1/gateway/vault/{projectId}/resolve, and five of them
|
|
3090
|
+
* (INVALID_ASSERTION, INVALID_SIGNATURE, ASSERTION_EXPIRED, ASSERTION_REPLAYED,
|
|
3091
|
+
* PROJECT_MISMATCH) also by POST /api/v1/vault/{projectId}/resolve, which
|
|
3092
|
+
* verifies through the same shared verifier and nonce store
|
|
3093
|
+
* (apps/web/lib/vault/). Every emission site passes an explicit message and
|
|
3094
|
+
* status, so registering them changes no wire behaviour.
|
|
3095
|
+
*/
|
|
3096
|
+
const GATEWAY_VAULT_ERRORS = {
|
|
3097
|
+
MALFORMED_REQUEST_BODY: "MALFORMED_REQUEST_BODY",
|
|
3098
|
+
GATEWAY_NOT_CONFIGURED: "GATEWAY_NOT_CONFIGURED",
|
|
3099
|
+
INVALID_ASSERTION: "INVALID_ASSERTION",
|
|
3100
|
+
INVALID_SIGNATURE: "INVALID_SIGNATURE",
|
|
3101
|
+
ASSERTION_EXPIRED: "ASSERTION_EXPIRED",
|
|
3102
|
+
ASSERTION_REPLAYED: "ASSERTION_REPLAYED",
|
|
3103
|
+
PROJECT_MISMATCH: "PROJECT_MISMATCH",
|
|
3104
|
+
ISSUER_MISMATCH: "ISSUER_MISMATCH",
|
|
3105
|
+
USER_DID_MISMATCH: "USER_DID_MISMATCH",
|
|
3106
|
+
TOOL_NAME_MISMATCH: "TOOL_NAME_MISMATCH",
|
|
3107
|
+
SESSION_ID_MISMATCH: "SESSION_ID_MISMATCH",
|
|
3108
|
+
NOT_AUTHORIZED: "NOT_AUTHORIZED",
|
|
3109
|
+
CREDENTIALS_NOT_CONFIGURED: "CREDENTIALS_NOT_CONFIGURED",
|
|
3110
|
+
OAUTH_EXPIRED: "OAUTH_EXPIRED"
|
|
3111
|
+
};
|
|
3112
|
+
/**
|
|
3113
|
+
* Vault Resolve Error Codes
|
|
3114
|
+
*
|
|
3115
|
+
* The one code unique to POST /api/v1/vault/{projectId}/resolve. The rest of
|
|
3116
|
+
* its surface reuses GATEWAY_VAULT_ERRORS, BARE_ERRORS and INTERNAL_ERRORS by
|
|
3117
|
+
* key.
|
|
3118
|
+
*/
|
|
3119
|
+
const VAULT_ERRORS = { NO_AGENT_KEY: "NO_AGENT_KEY" };
|
|
3120
|
+
/**
|
|
2970
3121
|
* All Error Codes
|
|
2971
3122
|
*/
|
|
2972
3123
|
const ERROR_CODES = {
|
|
@@ -2992,7 +3143,9 @@ const ERROR_CODES = {
|
|
|
2992
3143
|
...BOUNCER_UPPERCASE_ERRORS,
|
|
2993
3144
|
...AUDIT_ERRORS,
|
|
2994
3145
|
...AUDIT_PROTOCOL_ERRORS,
|
|
2995
|
-
...KYAOS_PROTOCOL_ERRORS
|
|
3146
|
+
...KYAOS_PROTOCOL_ERRORS,
|
|
3147
|
+
...GATEWAY_VAULT_ERRORS,
|
|
3148
|
+
...VAULT_ERRORS
|
|
2996
3149
|
};
|
|
2997
3150
|
/**
|
|
2998
3151
|
* Error Messages
|
|
@@ -3110,6 +3263,8 @@ const ERROR_MESSAGES = {
|
|
|
3110
3263
|
[BARE_ERRORS.BARE_INVALID_DATE_RANGE]: "startDate must be before endDate",
|
|
3111
3264
|
[BARE_ERRORS.BARE_INVALID_DATE]: "Invalid date format. Use ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.sssZ)",
|
|
3112
3265
|
[BARE_ERRORS.BARE_UNKNOWN_ERROR]: "Failed to delete project",
|
|
3266
|
+
[BARE_ERRORS.BARE_NOT_FOUND]: "Not found",
|
|
3267
|
+
[BARE_ERRORS.BARE_FORBIDDEN]: "Forbidden",
|
|
3113
3268
|
[LOWERCASE_ERRORS.LOWERCASE_INVALID_JSON]: "Request body must be valid JSON",
|
|
3114
3269
|
[LOWERCASE_ERRORS.LOWERCASE_VALIDATION_ERROR]: "Invalid request body",
|
|
3115
3270
|
[BOUNCER_LOWERCASE_ERRORS.LOWERCASE_NO_PROJECT]: "API key is not associated with a project",
|
|
@@ -3203,7 +3358,22 @@ const ERROR_MESSAGES = {
|
|
|
3203
3358
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: "The holder does not match the delegation or grant",
|
|
3204
3359
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: "The signature could not be verified",
|
|
3205
3360
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_SESSION_MISMATCH]: "The session does not match the delegation or proof",
|
|
3206
|
-
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable"
|
|
3361
|
+
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable",
|
|
3362
|
+
[GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: "Malformed JSON body",
|
|
3363
|
+
[GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: "Gateway public key or trusted DID not configured for this project",
|
|
3364
|
+
[GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: "Assertion JWT must have 3 parts",
|
|
3365
|
+
[GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: "Assertion signature verification failed",
|
|
3366
|
+
[GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: "Assertion is expired or outside the allowed window",
|
|
3367
|
+
[GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: "Assertion nonce has already been used",
|
|
3368
|
+
[GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: "Assertion projectId does not match route",
|
|
3369
|
+
[GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: "Assertion issuer does not match trusted gateway DID",
|
|
3370
|
+
[GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: "Assertion userDid does not match request body userDid",
|
|
3371
|
+
[GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: "Assertion toolName does not match request body toolName",
|
|
3372
|
+
[GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: "Assertion sessionId does not match request body sessionId",
|
|
3373
|
+
[GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: "User is not a member of this organization",
|
|
3374
|
+
[GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: "Connect your credentials in Checkpoint",
|
|
3375
|
+
[GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: "Provider token expired; user must reconnect",
|
|
3376
|
+
[VAULT_ERRORS.NO_AGENT_KEY]: "No agent deployment found for this project"
|
|
3207
3377
|
};
|
|
3208
3378
|
/**
|
|
3209
3379
|
* HTTP Status Codes for Errors
|
|
@@ -3255,6 +3425,8 @@ const ERROR_STATUS_CODES = {
|
|
|
3255
3425
|
[BOUNCER_UPPERCASE_ERRORS.INVALID_REQUEST_ID]: 400,
|
|
3256
3426
|
[AUDIT_ERRORS.AUDIT_INVALID_JSON]: 400,
|
|
3257
3427
|
[AUDIT_ERRORS.AUDIT_INVALID_SUBMISSION]: 400,
|
|
3428
|
+
[GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: 400,
|
|
3429
|
+
[GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: 400,
|
|
3258
3430
|
[AUTH_ERRORS.INVALID_API_KEY]: 401,
|
|
3259
3431
|
[AUTH_ERRORS.EXPIRED_API_KEY]: 401,
|
|
3260
3432
|
[AUTH_ERRORS.INVALID_TOKEN]: 401,
|
|
@@ -3266,6 +3438,7 @@ const ERROR_STATUS_CODES = {
|
|
|
3266
3438
|
[BOUNCER_LOWERCASE_ERRORS.LOWERCASE_UNAUTHORIZED]: 401,
|
|
3267
3439
|
[AUDIT_ERRORS.AUDIT_CREDENTIAL_REQUIRED]: 401,
|
|
3268
3440
|
[AUDIT_ERRORS.AUDIT_INVALID_CREDENTIAL]: 401,
|
|
3441
|
+
[GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: 401,
|
|
3269
3442
|
[BILLING_ERRORS.LIMIT_EXCEEDED]: 402,
|
|
3270
3443
|
[BILLING_ERRORS.BILLING_SUSPENDED]: 402,
|
|
3271
3444
|
[PERMISSION_ERRORS.INSUFFICIENT_PERMISSIONS]: 403,
|
|
@@ -3287,6 +3460,16 @@ const ERROR_STATUS_CODES = {
|
|
|
3287
3460
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_DELEGATION_REVOKED]: 403,
|
|
3288
3461
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: 403,
|
|
3289
3462
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: 403,
|
|
3463
|
+
[BARE_ERRORS.BARE_FORBIDDEN]: 403,
|
|
3464
|
+
[GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: 403,
|
|
3465
|
+
[GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: 403,
|
|
3466
|
+
[GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: 403,
|
|
3467
|
+
[GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: 403,
|
|
3468
|
+
[GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: 403,
|
|
3469
|
+
[GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: 403,
|
|
3470
|
+
[GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: 403,
|
|
3471
|
+
[GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: 403,
|
|
3472
|
+
[GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: 403,
|
|
3290
3473
|
[PERMISSION_ERRORS.RESOURCE_NOT_FOUND]: 404,
|
|
3291
3474
|
[API_ERRORS.ENDPOINT_NOT_FOUND]: 404,
|
|
3292
3475
|
[PIXEL_ERRORS.PIXEL_NOT_FOUND]: 404,
|
|
@@ -3304,6 +3487,9 @@ const ERROR_STATUS_CODES = {
|
|
|
3304
3487
|
[BOUNCER_UPPERCASE_ERRORS.DEPLOYMENT_NOT_FOUND]: 404,
|
|
3305
3488
|
[BOUNCER_UPPERCASE_ERRORS.DELEGATION_REQUEST_NOT_FOUND]: 404,
|
|
3306
3489
|
[KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SESSION]: 404,
|
|
3490
|
+
[BARE_ERRORS.BARE_NOT_FOUND]: 404,
|
|
3491
|
+
[GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: 404,
|
|
3492
|
+
[VAULT_ERRORS.NO_AGENT_KEY]: 404,
|
|
3307
3493
|
[API_ERRORS.METHOD_NOT_ALLOWED]: 405,
|
|
3308
3494
|
[RESOURCE_ERRORS.CONFLICT]: 409,
|
|
3309
3495
|
[AUDIT_PROTOCOL_ERRORS.AUDIT_LEDGER_MISMATCH]: 409,
|
|
@@ -3355,6 +3541,7 @@ const ERROR_STATUS_CODES = {
|
|
|
3355
3541
|
[AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_VERIFICATION_FAILED]: 500,
|
|
3356
3542
|
[AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_CONTINUITY_FAILED]: 500,
|
|
3357
3543
|
[AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_OUT_OF_ORDER]: 500,
|
|
3544
|
+
[GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: 500,
|
|
3358
3545
|
[NETWORK_ERRORS.UPSTREAM_ERROR]: 502,
|
|
3359
3546
|
[INTERNAL_ERRORS.INITIALIZATION_ERROR]: 503,
|
|
3360
3547
|
[INTERNAL_ERRORS.SERVICE_UNAVAILABLE_TRANSIENT]: 503,
|
|
@@ -5566,6 +5753,191 @@ const VerificationCacheEntrySchema = object({
|
|
|
5566
5753
|
expiresAt: number$1()
|
|
5567
5754
|
});
|
|
5568
5755
|
|
|
5756
|
+
//#endregion
|
|
5757
|
+
//#region src/utils/allowed-domains.ts
|
|
5758
|
+
/**
|
|
5759
|
+
* A pixel's `configuration.allowedDomains`: the page hosts a pixel accepts
|
|
5760
|
+
* events from (`/api/v1/event` compares them to the event URL's hostname).
|
|
5761
|
+
*
|
|
5762
|
+
* Stored form is a bare, lowercase, punycoded host (`shop.example.com`) or a
|
|
5763
|
+
* leftmost wildcard (`*.example.com`, which covers `example.com` itself and
|
|
5764
|
+
* every subdomain, never a look-alike such as `evilexample.com`).
|
|
5765
|
+
*
|
|
5766
|
+
* The comparison side, `URL.hostname`, is always lowercase with no scheme,
|
|
5767
|
+
* port or path, so an entry stored as `*.Example.com`, `https://example.com`
|
|
5768
|
+
* or `example.com:443` never matched and 403'd every event. Entries are now
|
|
5769
|
+
* normalized on write, and legacy rows are normalized again on read so they
|
|
5770
|
+
* stop failing without a backfill.
|
|
5771
|
+
*/
|
|
5772
|
+
const WILDCARD_PROBE_LABEL = "allowed-domain-wildcard-probe";
|
|
5773
|
+
const MAX_ALLOWED_DOMAIN_LENGTH = 300;
|
|
5774
|
+
/**
|
|
5775
|
+
* Most entries one pixel may list. Generous on purpose: each event checks
|
|
5776
|
+
* its host against every entry, and the list was uncapped before, so a
|
|
5777
|
+
* smaller cap could refuse an existing pixel's next save.
|
|
5778
|
+
*/
|
|
5779
|
+
const MAX_ALLOWED_DOMAINS = 1e3;
|
|
5780
|
+
/** One DNS label after URL's lowercasing and punycoding. `_` occurs in real subdomains. */
|
|
5781
|
+
const HOST_LABEL = /^[a-z0-9_-]{1,63}$/;
|
|
5782
|
+
const DEFAULT_PORTS = /* @__PURE__ */ new Set(["80", "443"]);
|
|
5783
|
+
/** URL accepts empty labels and characters such as `;` or `,`, which no page host has. */
|
|
5784
|
+
function isHostName(host) {
|
|
5785
|
+
if (host.startsWith("[") && host.endsWith("]")) return true;
|
|
5786
|
+
return host.split(".").every((label) => HOST_LABEL.test(label));
|
|
5787
|
+
}
|
|
5788
|
+
function parseAllowedDomain(entry) {
|
|
5789
|
+
const trimmed = typeof entry === "string" ? entry.trim() : "";
|
|
5790
|
+
if (!trimmed) return { error: "Enter a domain such as shop.example.com" };
|
|
5791
|
+
if (trimmed.length > 300) return { error: `Must be at most ${300} characters` };
|
|
5792
|
+
const schemeMatch = /^([a-z][a-z0-9+.-]*):\/\//i.exec(trimmed);
|
|
5793
|
+
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : "https";
|
|
5794
|
+
if (scheme !== "https" && scheme !== "http") return { error: "Use a domain name, e.g. shop.example.com" };
|
|
5795
|
+
const rest = schemeMatch ? trimmed.slice(schemeMatch[0].length) : trimmed;
|
|
5796
|
+
const wildcard = rest.startsWith("*.");
|
|
5797
|
+
const withoutWildcard = wildcard ? rest.slice(2) : rest;
|
|
5798
|
+
if (!withoutWildcard || withoutWildcard.includes("*")) return { error: "A wildcard is only allowed as the first label, e.g. *.example.com" };
|
|
5799
|
+
let url;
|
|
5800
|
+
try {
|
|
5801
|
+
url = new URL(`${scheme}://${wildcard ? `${WILDCARD_PROBE_LABEL}.` : ""}${withoutWildcard}`);
|
|
5802
|
+
} catch {
|
|
5803
|
+
return { error: "Not a valid domain" };
|
|
5804
|
+
}
|
|
5805
|
+
if (url.username || url.password) return { error: "Domains cannot contain a username" };
|
|
5806
|
+
let host = url.hostname.replace(/\.$/, "");
|
|
5807
|
+
if (wildcard) {
|
|
5808
|
+
if (!host.startsWith(`${WILDCARD_PROBE_LABEL}.`)) return { error: "Not a valid domain" };
|
|
5809
|
+
host = host.slice(30);
|
|
5810
|
+
}
|
|
5811
|
+
if (!isHostName(host)) return { error: "Not a valid domain" };
|
|
5812
|
+
return {
|
|
5813
|
+
host,
|
|
5814
|
+
wildcard,
|
|
5815
|
+
port: DEFAULT_PORTS.has(url.port) ? "" : url.port
|
|
5816
|
+
};
|
|
5817
|
+
}
|
|
5818
|
+
function format(parsed) {
|
|
5819
|
+
return `${parsed.wildcard ? "*." : ""}${parsed.host}`;
|
|
5820
|
+
}
|
|
5821
|
+
/**
|
|
5822
|
+
* `*.com`, `*.co.uk`, `*.myshopify.com`: a wildcard that admits sites the
|
|
5823
|
+
* customer does not control. Same rule as posture origins, so the two
|
|
5824
|
+
* allowlists refuse the same entries.
|
|
5825
|
+
*/
|
|
5826
|
+
function isPublicSuffixWildcard(parsed) {
|
|
5827
|
+
return parsed.wildcard && isPublicSuffixLike(parsed.host);
|
|
5828
|
+
}
|
|
5829
|
+
/**
|
|
5830
|
+
* Strict write-time normalization. Returns the stored form, or an error for
|
|
5831
|
+
* junk: another scheme, userinfo, a misplaced wildcard, a host with an empty
|
|
5832
|
+
* label or a character no host has, a non-default port (the check compares
|
|
5833
|
+
* host names only, so a port would suggest a restriction that is never
|
|
5834
|
+
* enforced), or a wildcard over a public suffix.
|
|
5835
|
+
*
|
|
5836
|
+
* @example
|
|
5837
|
+
* normalizeAllowedDomainForWrite('HTTPS://Shop.Example.com:443/cart') // { ok: true, value: 'shop.example.com' }
|
|
5838
|
+
* normalizeAllowedDomainForWrite('*.Example.com.') // { ok: true, value: '*.example.com' }
|
|
5839
|
+
*/
|
|
5840
|
+
function normalizeAllowedDomainForWrite(entry) {
|
|
5841
|
+
const parsed = parseAllowedDomain(entry);
|
|
5842
|
+
if ("error" in parsed) return {
|
|
5843
|
+
ok: false,
|
|
5844
|
+
error: parsed.error
|
|
5845
|
+
};
|
|
5846
|
+
if (parsed.port) return {
|
|
5847
|
+
ok: false,
|
|
5848
|
+
error: "Ports are not supported; the check matches the host name only"
|
|
5849
|
+
};
|
|
5850
|
+
if (isPublicSuffixWildcard(parsed)) return {
|
|
5851
|
+
ok: false,
|
|
5852
|
+
error: `*.${parsed.host} would include sites you do not control; list your own hosts instead`
|
|
5853
|
+
};
|
|
5854
|
+
return {
|
|
5855
|
+
ok: true,
|
|
5856
|
+
value: format(parsed)
|
|
5857
|
+
};
|
|
5858
|
+
}
|
|
5859
|
+
/**
|
|
5860
|
+
* Lenient read-time normalization for entries already stored: strips a
|
|
5861
|
+
* scheme, path, port and trailing dot and lowercases, so a legacy entry
|
|
5862
|
+
* such as `https://Example.com:443/` still matches. Undefined for entries
|
|
5863
|
+
* that cannot be a host at all (they then match nothing, as before).
|
|
5864
|
+
*
|
|
5865
|
+
* It never widens what a pixel accepts to a public suffix. A malformed
|
|
5866
|
+
* wildcard over one (`*.COM`, `https://*.co.uk`) matched nothing before, and
|
|
5867
|
+
* cleaning it up would admit every site under it, which writes now refuse.
|
|
5868
|
+
* So it stays undefined. One already stored in exact form (`*.com`) matched
|
|
5869
|
+
* before this normalization existed and is returned unchanged.
|
|
5870
|
+
*/
|
|
5871
|
+
function normalizeStoredAllowedDomain(entry) {
|
|
5872
|
+
if (typeof entry !== "string") return void 0;
|
|
5873
|
+
const parsed = parseAllowedDomain(entry);
|
|
5874
|
+
if ("error" in parsed) return void 0;
|
|
5875
|
+
const normalized = format(parsed);
|
|
5876
|
+
if (isPublicSuffixWildcard(parsed) && entry !== normalized) return void 0;
|
|
5877
|
+
return normalized;
|
|
5878
|
+
}
|
|
5879
|
+
/**
|
|
5880
|
+
* Whether a page host is admitted by a pixel's allowed domains. Exact
|
|
5881
|
+
* entries match the host exactly; `*.example.com` matches `example.com`
|
|
5882
|
+
* and any subdomain, on a label boundary.
|
|
5883
|
+
*
|
|
5884
|
+
* @example
|
|
5885
|
+
* hostMatchesAllowedDomains('shop.example.com', ['*.Example.com']) // true
|
|
5886
|
+
* hostMatchesAllowedDomains('evilexample.com', ['*.example.com']) // false
|
|
5887
|
+
*/
|
|
5888
|
+
function hostMatchesAllowedDomains(hostname, allowedDomains) {
|
|
5889
|
+
const host = hostname.toLowerCase().replace(/\.$/, "");
|
|
5890
|
+
if (!host) return false;
|
|
5891
|
+
return allowedDomains.some((raw) => {
|
|
5892
|
+
const entry = normalizeStoredAllowedDomain(raw);
|
|
5893
|
+
if (!entry) return false;
|
|
5894
|
+
if (!entry.startsWith("*.")) return host === entry;
|
|
5895
|
+
const base = entry.slice(2);
|
|
5896
|
+
return host === base || host.endsWith(`.${base}`);
|
|
5897
|
+
});
|
|
5898
|
+
}
|
|
5899
|
+
/**
|
|
5900
|
+
* Normalizes a whole list for a write: stored forms in first-seen order with
|
|
5901
|
+
* duplicates removed, plus each junk entry's index and reason. Linear in the
|
|
5902
|
+
* list's length.
|
|
5903
|
+
*
|
|
5904
|
+
* @example
|
|
5905
|
+
* normalizeAllowedDomainList(['Example.com', 'a..b', 'example.com'])
|
|
5906
|
+
* // { values: ['example.com'], errors: [{ index: 1, message: 'Not a valid domain' }] }
|
|
5907
|
+
*/
|
|
5908
|
+
function normalizeAllowedDomainList(entries) {
|
|
5909
|
+
const values = /* @__PURE__ */ new Set();
|
|
5910
|
+
const errors = [];
|
|
5911
|
+
entries.forEach((entry, index) => {
|
|
5912
|
+
const result = normalizeAllowedDomainForWrite(entry);
|
|
5913
|
+
if (result.ok) values.add(result.value);
|
|
5914
|
+
else errors.push({
|
|
5915
|
+
index,
|
|
5916
|
+
message: result.error
|
|
5917
|
+
});
|
|
5918
|
+
});
|
|
5919
|
+
return {
|
|
5920
|
+
values: [...values],
|
|
5921
|
+
errors
|
|
5922
|
+
};
|
|
5923
|
+
}
|
|
5924
|
+
/**
|
|
5925
|
+
* `allowedDomains` on a pixel write: at most {@link MAX_ALLOWED_DOMAINS}
|
|
5926
|
+
* entries, each normalized to its stored form (duplicates removed), and each
|
|
5927
|
+
* junk entry reported at its index so the route's 400 says which one and
|
|
5928
|
+
* why. The cap is checked first, so an oversized list is refused without
|
|
5929
|
+
* normalizing any entry.
|
|
5930
|
+
*/
|
|
5931
|
+
const AllowedDomainsSchema = array(string()).max(MAX_ALLOWED_DOMAINS, `At most ${MAX_ALLOWED_DOMAINS} allowed domains`).transform((entries, ctx) => {
|
|
5932
|
+
const { values, errors } = normalizeAllowedDomainList(entries);
|
|
5933
|
+
errors.forEach(({ index, message }) => ctx.addIssue({
|
|
5934
|
+
code: "custom",
|
|
5935
|
+
message,
|
|
5936
|
+
path: [index]
|
|
5937
|
+
}));
|
|
5938
|
+
return values;
|
|
5939
|
+
});
|
|
5940
|
+
|
|
5569
5941
|
//#endregion
|
|
5570
5942
|
//#region src/api/bulk.ts
|
|
5571
5943
|
/**
|
|
@@ -5722,7 +6094,7 @@ const PixelsBulkCreateItemSchema = object({
|
|
|
5722
6094
|
domain: string().url().optional(),
|
|
5723
6095
|
isActive: boolean$1().default(true),
|
|
5724
6096
|
configuration: object({
|
|
5725
|
-
allowedDomains:
|
|
6097
|
+
allowedDomains: AllowedDomainsSchema.default([]),
|
|
5726
6098
|
collectBehavioral: boolean$1().default(true),
|
|
5727
6099
|
enableFingerprinting: boolean$1().default(true),
|
|
5728
6100
|
enableSessionTracking: boolean$1().default(true),
|
|
@@ -5735,7 +6107,7 @@ const PixelsBulkUpdateItemSchema = object({
|
|
|
5735
6107
|
domain: string().url().optional(),
|
|
5736
6108
|
isActive: boolean$1().optional(),
|
|
5737
6109
|
configuration: object({
|
|
5738
|
-
allowedDomains:
|
|
6110
|
+
allowedDomains: AllowedDomainsSchema.optional(),
|
|
5739
6111
|
collectBehavioral: boolean$1().optional(),
|
|
5740
6112
|
enableFingerprinting: boolean$1().optional(),
|
|
5741
6113
|
enableSessionTracking: boolean$1().optional(),
|
|
@@ -5992,7 +6364,7 @@ const ProjectSchema = object({
|
|
|
5992
6364
|
const PixelConfigurationSchema = object({
|
|
5993
6365
|
enabled: boolean$1().default(true),
|
|
5994
6366
|
skipPaths: array(string()).default([]),
|
|
5995
|
-
allowedDomains:
|
|
6367
|
+
allowedDomains: AllowedDomainsSchema.default([]),
|
|
5996
6368
|
blockedAgents: array(string()).default([]),
|
|
5997
6369
|
batchSize: number$1().min(1).max(100).default(10),
|
|
5998
6370
|
flushInterval: number$1().min(100).max(6e4).default(5e3),
|
|
@@ -6554,6 +6926,31 @@ const ConsentAgentMetadataSchema = object({
|
|
|
6554
6926
|
connectedAt: string().datetime().optional()
|
|
6555
6927
|
});
|
|
6556
6928
|
/**
|
|
6929
|
+
* Brand copy for one input the consent page asks a person to fill in. Copy
|
|
6930
|
+
* only: which inputs appear is the project's consent policy's call (its
|
|
6931
|
+
* sign-in methods and assurance providers), never this config's.
|
|
6932
|
+
*/
|
|
6933
|
+
const ConsentInputCopySchema = object({
|
|
6934
|
+
label: string().max(80).optional(),
|
|
6935
|
+
/** A typed field's placeholder, or the hint line under it where the step has one. */
|
|
6936
|
+
hint: string().max(200).optional()
|
|
6937
|
+
});
|
|
6938
|
+
const ConsentSignInCopySchema = object({
|
|
6939
|
+
/** The address field of the email-code and email-and-password sign-ins. */
|
|
6940
|
+
email: ConsentInputCopySchema.optional(),
|
|
6941
|
+
password: ConsentInputCopySchema.optional(),
|
|
6942
|
+
/** The RPPS number step (`registry:fr-rpps`); `prompt` is its heading. */
|
|
6943
|
+
rpps: ConsentInputCopySchema.extend({ prompt: string().max(120).optional() }).optional()
|
|
6944
|
+
});
|
|
6945
|
+
/** A consent policy names a handful of scopes; this only bounds the stored map. */
|
|
6946
|
+
const MAX_SCOPE_LABELS = 50;
|
|
6947
|
+
/**
|
|
6948
|
+
* The brand's name for a scope no authored capability covers, keyed by the
|
|
6949
|
+
* literal scope. Copy only: unlike a capability, a label here never makes a
|
|
6950
|
+
* scope grantable (`allowedScopesFor` does not read it) and carries no Cedar.
|
|
6951
|
+
*/
|
|
6952
|
+
const ConsentScopeLabelsSchema = record(string().min(1).max(120), string().min(1).max(80)).refine((labels) => Object.keys(labels).length <= MAX_SCOPE_LABELS, `At most ${MAX_SCOPE_LABELS} scope labels`);
|
|
6953
|
+
/**
|
|
6557
6954
|
* Full Consent Configuration
|
|
6558
6955
|
*/
|
|
6559
6956
|
const ConsentConfigSchema = object({
|
|
@@ -6570,7 +6967,9 @@ const ConsentConfigSchema = object({
|
|
|
6570
6967
|
headlineVerb: string().min(1).max(40).optional(),
|
|
6571
6968
|
revocationPath: string().min(1).max(120).optional(),
|
|
6572
6969
|
inactivityDays: number$1().int().min(1).max(3650).optional(),
|
|
6573
|
-
authorizationHost: string().min(1).max(255).optional()
|
|
6970
|
+
authorizationHost: string().min(1).max(255).optional(),
|
|
6971
|
+
signInCopy: ConsentSignInCopySchema.optional(),
|
|
6972
|
+
scopeLabels: ConsentScopeLabelsSchema.optional()
|
|
6574
6973
|
});
|
|
6575
6974
|
/**
|
|
6576
6975
|
* Tool Consent Overrides (CRED-002)
|
|
@@ -7348,7 +7747,36 @@ const MarketplaceSourceSchema = _enum([
|
|
|
7348
7747
|
]);
|
|
7349
7748
|
/** Enforcement posture — mirrors the SDK's `enforcementMode` ('observe' = detect-only). */
|
|
7350
7749
|
const ProvisioningModeSchema = _enum(["observe", "enforce"]);
|
|
7750
|
+
/** Backend-verifiable installer identity. Caller-supplied verification flags confer no authority. */
|
|
7751
|
+
const ProvisioningIdentityProofSchema = discriminatedUnion("type", [
|
|
7752
|
+
object({
|
|
7753
|
+
type: literal("vercel-oidc"),
|
|
7754
|
+
token: string().min(1).max(16384)
|
|
7755
|
+
}),
|
|
7756
|
+
object({
|
|
7757
|
+
type: literal("railway-oauth"),
|
|
7758
|
+
accessToken: string().min(1).max(16384)
|
|
7759
|
+
}),
|
|
7760
|
+
object({
|
|
7761
|
+
type: literal("checkpoint-account-link"),
|
|
7762
|
+
token: string().min(1).max(16384)
|
|
7763
|
+
})
|
|
7764
|
+
]);
|
|
7765
|
+
/** A signed account-link capability issued only from the installer's authenticated session. */
|
|
7766
|
+
const ProvisioningAccountLinkRequestSchema = object({
|
|
7767
|
+
source: MarketplaceSourceSchema,
|
|
7768
|
+
externalId: string().min(1).max(255),
|
|
7769
|
+
resourceId: string().min(1).max(255).optional()
|
|
7770
|
+
});
|
|
7771
|
+
const ProvisioningAccountLinkResponseSchema = object({
|
|
7772
|
+
identityProof: object({
|
|
7773
|
+
type: literal("checkpoint-account-link"),
|
|
7774
|
+
token: string().min(1)
|
|
7775
|
+
}),
|
|
7776
|
+
expiresIn: literal(600)
|
|
7777
|
+
});
|
|
7351
7778
|
const ProvisionKeyRequestSchema = object({
|
|
7779
|
+
identityProof: ProvisioningIdentityProofSchema.optional(),
|
|
7352
7780
|
source: MarketplaceSourceSchema,
|
|
7353
7781
|
/** Provider installation/configuration id (e.g. Vercel configurationId). */
|
|
7354
7782
|
externalId: string().min(1).max(255),
|
|
@@ -7361,12 +7789,7 @@ const ProvisionKeyRequestSchema = object({
|
|
|
7361
7789
|
resourceId: string().min(1).max(255),
|
|
7362
7790
|
/** Human-readable label for the dashboard (e.g. "Vercel / team_xxx / my-project"). */
|
|
7363
7791
|
label: string().min(1).max(200),
|
|
7364
|
-
/**
|
|
7365
|
-
* Owner of the provisioned project. `email` is the account-linking key: we find-or-create
|
|
7366
|
-
* the KYA-OS user + personal org from it (Shopify-parity), so an address matching an
|
|
7367
|
-
* existing account provisions INTO that account — including the org it lands in.
|
|
7368
|
-
*
|
|
7369
|
-
*/
|
|
7792
|
+
/** Installer email must match the identity established by identityProof. */
|
|
7370
7793
|
owner: object({
|
|
7371
7794
|
email: string().email(),
|
|
7372
7795
|
name: string().min(1).max(255).optional()
|
|
@@ -7400,15 +7823,16 @@ const ProvisionKeyResponseSchema = object({
|
|
|
7400
7823
|
});
|
|
7401
7824
|
/**
|
|
7402
7825
|
* Request for `POST /api/provisioning/sso-link` — the "Open in Provider" handoff.
|
|
7403
|
-
* The
|
|
7826
|
+
* The backend verifies `ownerEmail` using provider evidence or an authenticated account-link ticket.
|
|
7404
7827
|
*/
|
|
7405
7828
|
const SsoLinkRequestSchema = object({
|
|
7829
|
+
identityProof: ProvisioningIdentityProofSchema.optional(),
|
|
7406
7830
|
source: MarketplaceSourceSchema,
|
|
7407
7831
|
/** Provider installation/configuration id (e.g. Vercel configurationId). */
|
|
7408
7832
|
externalId: string().min(1).max(255),
|
|
7409
7833
|
/** Optional provider resource id — present → deep-link to that project; absent → org landing. */
|
|
7410
7834
|
resourceId: string().min(1).max(255).optional(),
|
|
7411
|
-
/**
|
|
7835
|
+
/** Installer email must match the identity established by identityProof. */
|
|
7412
7836
|
ownerEmail: string().email()
|
|
7413
7837
|
});
|
|
7414
7838
|
const SsoLinkResponseSchema = object({
|
|
@@ -7448,7 +7872,13 @@ const ProvisioningOrganizationSummarySchema = object({
|
|
|
7448
7872
|
role: ProvisioningOrganizationRoleSchema
|
|
7449
7873
|
});
|
|
7450
7874
|
/** List a user's administrable orgs by verified email. No user match ⇒ `{ organizations: [] }`. */
|
|
7451
|
-
const ListProvisioningOrganizationsRequestSchema = object({
|
|
7875
|
+
const ListProvisioningOrganizationsRequestSchema = object({
|
|
7876
|
+
source: MarketplaceSourceSchema.optional(),
|
|
7877
|
+
externalId: string().min(1).max(255).optional(),
|
|
7878
|
+
resourceId: string().min(1).max(255).optional(),
|
|
7879
|
+
identityProof: ProvisioningIdentityProofSchema.optional(),
|
|
7880
|
+
email: string().email()
|
|
7881
|
+
});
|
|
7452
7882
|
const ListProvisioningOrganizationsResponseSchema = object({ organizations: array(ProvisioningOrganizationSummarySchema) });
|
|
7453
7883
|
/**
|
|
7454
7884
|
* Create an org for a (found-or-created) user by verified email. `name`/`slug` reuse the
|
|
@@ -7456,6 +7886,10 @@ const ListProvisioningOrganizationsResponseSchema = object({ organizations: arra
|
|
|
7456
7886
|
* accept exactly the same input.
|
|
7457
7887
|
*/
|
|
7458
7888
|
const CreateProvisioningOrganizationRequestSchema = object({
|
|
7889
|
+
source: MarketplaceSourceSchema.optional(),
|
|
7890
|
+
externalId: string().min(1).max(255).optional(),
|
|
7891
|
+
resourceId: string().min(1).max(255).optional(),
|
|
7892
|
+
identityProof: ProvisioningIdentityProofSchema.optional(),
|
|
7459
7893
|
email: string().email(),
|
|
7460
7894
|
name: CreateOrganizationInputSchema.shape.name,
|
|
7461
7895
|
slug: CreateOrganizationInputSchema.shape.slug
|
|
@@ -8043,30 +8477,13 @@ const ShopifySessionsPaginationSchema = object({
|
|
|
8043
8477
|
totalPages: number$1().int().nonnegative().describe("`min(ceil(total / limit), 200)`: the last page `sessionsPage` accepts."),
|
|
8044
8478
|
hasMore: boolean$1().describe("True when `page < totalPages`.")
|
|
8045
8479
|
});
|
|
8046
|
-
/**
|
|
8047
|
-
* Shopify Stats Response
|
|
8048
|
-
*
|
|
8049
|
-
* Every counter is a SESSION count, not an event count. `totalRequests` is
|
|
8050
|
-
* the number of sessions in the window and `blockedBots` the AI-agent
|
|
8051
|
-
* sessions among them.
|
|
8052
|
-
*
|
|
8053
|
-
* `crawlerSessions` and `humanSessions` complete the four-way split
|
|
8054
|
-
* (AI agent / crawler / human / unclassified). Both are optional in both
|
|
8055
|
-
* directions: an older Checkpoint does not send them, and an older Shopify
|
|
8056
|
-
* app ignores them. When present they come from the same per-session
|
|
8057
|
-
* classification as `blockedBots` (ai_agent > bot > human priority), so
|
|
8058
|
-
* `blockedBots + crawlerSessions + humanSessions <= totalRequests`; the
|
|
8059
|
-
* remainder is sessions that belong to no class.
|
|
8060
|
-
*
|
|
8061
|
-
* `sessions` and `sessionsPagination` are present only when the request
|
|
8062
|
-
* asks for them (`include=sessions`); an older Checkpoint never sends them.
|
|
8063
|
-
*/
|
|
8064
8480
|
const ShopifyStatsResponseSchema = object({
|
|
8065
8481
|
totalRequests: number$1().int().nonnegative(),
|
|
8066
8482
|
blockedBots: number$1().int().nonnegative(),
|
|
8067
8483
|
allowedRequests: number$1().int().nonnegative(),
|
|
8068
8484
|
crawlerSessions: number$1().int().nonnegative().optional(),
|
|
8069
8485
|
humanSessions: number$1().int().nonnegative().optional(),
|
|
8486
|
+
unidentifiedSessions: number$1().int().nonnegative().optional().describe("Sessions in the window with no ai_agent, bot or human detection and at least one incomplete-data detection that carries the no_evidence basis: an idle visitor the engine had nothing to weigh. They are counted in `totalRequests` and `humanSessions`, so this says how many of the human sessions the engine could not classify. Sessions whose incomplete-data detections all have another reason, such as suspicious headers, are in no counter. A window over 31 days is counted the same way, one UTC day at a time, from the daily rollups. Omitted when the session split is unavailable: a window over 31 days served from a cached result that predates the split, and older deployments."),
|
|
8070
8487
|
threatLevel: _enum([
|
|
8071
8488
|
"low",
|
|
8072
8489
|
"medium",
|
|
@@ -10289,6 +10706,14 @@ const FingerprintSearchQuerySchema = object({
|
|
|
10289
10706
|
]).default("timestamp"),
|
|
10290
10707
|
sortOrder: _enum(["asc", "desc"]).default("desc")
|
|
10291
10708
|
});
|
|
10709
|
+
/**
|
|
10710
|
+
* Test result when running detection on a fingerprint.
|
|
10711
|
+
*
|
|
10712
|
+
* @deprecated Nothing in this repository builds or parses it; the
|
|
10713
|
+
* `/fingerprint/test` route returns its own shape. Kept because this file is
|
|
10714
|
+
* the package's public type surface and a shipped CHANGELOG entry names it.
|
|
10715
|
+
* Remove in the next major.
|
|
10716
|
+
*/
|
|
10292
10717
|
const DetectionTestResultSchema = object({
|
|
10293
10718
|
fingerprintId: string(),
|
|
10294
10719
|
timestamp: date$1(),
|
|
@@ -10343,8 +10768,8 @@ const PublishProfileRequestSchema = object({
|
|
|
10343
10768
|
version: string().optional()
|
|
10344
10769
|
});
|
|
10345
10770
|
const TestDetectionRequestSchema = object({
|
|
10346
|
-
fingerprintId: string(),
|
|
10347
|
-
integrationTypes: array(IntegrationTypeSchema).optional()
|
|
10771
|
+
fingerprintId: string().uuid(),
|
|
10772
|
+
integrationTypes: array(IntegrationTypeSchema).min(1, "integrationTypes must list at least one integration type, or be omitted entirely").optional()
|
|
10348
10773
|
});
|
|
10349
10774
|
function generateTestId() {
|
|
10350
10775
|
return `test-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 8)}`;
|
|
@@ -10833,7 +11258,8 @@ const ADMIN_OVERVIEW_SECTIONS = [
|
|
|
10833
11258
|
"installations",
|
|
10834
11259
|
"traffic",
|
|
10835
11260
|
"lists",
|
|
10836
|
-
"hiAi"
|
|
11261
|
+
"hiAi",
|
|
11262
|
+
"accounts"
|
|
10837
11263
|
];
|
|
10838
11264
|
/** Cache states a section can report in `meta.cache.status`. */
|
|
10839
11265
|
const ADMIN_OVERVIEW_CACHE_STATUSES = [
|
|
@@ -10854,6 +11280,51 @@ const SERVICE_TRAFFIC_KEYS = [
|
|
|
10854
11280
|
"mixed",
|
|
10855
11281
|
"none"
|
|
10856
11282
|
];
|
|
11283
|
+
/**
|
|
11284
|
+
* Headline numbers that show "N counted · M excluded" and open a drill-down
|
|
11285
|
+
* of every account behind them. The first five mirror the ladder steps
|
|
11286
|
+
* (signedIn is the ladder's signedInProxy); the last three are the KYA-1147
|
|
11287
|
+
* people numbers.
|
|
11288
|
+
*/
|
|
11289
|
+
const ADMIN_TRUSTED_METRICS = [
|
|
11290
|
+
"emailsCollected",
|
|
11291
|
+
"users",
|
|
11292
|
+
"signedIn",
|
|
11293
|
+
"onboarded",
|
|
11294
|
+
"activated",
|
|
11295
|
+
"activeUsers",
|
|
11296
|
+
"peopleInOrgs",
|
|
11297
|
+
"installedOrgs"
|
|
11298
|
+
];
|
|
11299
|
+
/**
|
|
11300
|
+
* Why an account a user-level exclusion did not catch is still left out:
|
|
11301
|
+
* every org that would count it is test-named (`test_org`), or, for an org
|
|
11302
|
+
* row, none of its members is a counted person (`no_counted_members`).
|
|
11303
|
+
*/
|
|
11304
|
+
const ADMIN_ORG_EXCLUSION_REASONS = ["test_org", "no_counted_members"];
|
|
11305
|
+
/** `counted`, or the first rule that left the account out (user buckets take precedence). */
|
|
11306
|
+
const ADMIN_ACCOUNT_STATUSES = [
|
|
11307
|
+
"counted",
|
|
11308
|
+
...EXCLUSION_BUCKETS,
|
|
11309
|
+
...ADMIN_ORG_EXCLUSION_REASONS
|
|
11310
|
+
];
|
|
11311
|
+
/** GET /api/admin/overview/accounts query. */
|
|
11312
|
+
/** Drill-down status filter: everyone, any exclusion, or one status. */
|
|
11313
|
+
const ADMIN_ACCOUNTS_STATUS_FILTERS = [
|
|
11314
|
+
"all",
|
|
11315
|
+
"excluded",
|
|
11316
|
+
...ADMIN_ACCOUNT_STATUSES
|
|
11317
|
+
];
|
|
11318
|
+
/**
|
|
11319
|
+
* GET /api/admin/overview/accounts query. `status` filters on the server,
|
|
11320
|
+
* so the row cap applies to the filtered list and an exclusion is never cut
|
|
11321
|
+
* off by counted rows.
|
|
11322
|
+
*/
|
|
11323
|
+
const adminAccountsQuerySchema = object({
|
|
11324
|
+
metric: _enum(ADMIN_TRUSTED_METRICS),
|
|
11325
|
+
window: _enum(ADMIN_OVERVIEW_WINDOWS).default("30d"),
|
|
11326
|
+
status: _enum(ADMIN_ACCOUNTS_STATUS_FILTERS).default("all")
|
|
11327
|
+
});
|
|
10857
11328
|
|
|
10858
11329
|
//#endregion
|
|
10859
11330
|
//#region src/types/api.ts
|
|
@@ -11047,74 +11518,6 @@ function createValidationErrorResponse(message, details, meta) {
|
|
|
11047
11518
|
};
|
|
11048
11519
|
}
|
|
11049
11520
|
|
|
11050
|
-
//#endregion
|
|
11051
|
-
//#region src/utils/detection-class.ts
|
|
11052
|
-
/**
|
|
11053
|
-
* Convert DetectionClass discriminated union to database enum string
|
|
11054
|
-
* Note: Automation and Unknown are legacy types, converted to Bot and IncompleteData respectively
|
|
11055
|
-
*/
|
|
11056
|
-
function detectionClassToEnum(detectionClass) {
|
|
11057
|
-
switch (detectionClass.type) {
|
|
11058
|
-
case "Human": return "human";
|
|
11059
|
-
case "AiAgent": return "ai_agent";
|
|
11060
|
-
case "Automation": return "bot";
|
|
11061
|
-
case "Bot": return "bot";
|
|
11062
|
-
case "IncompleteData": return "incomplete_data";
|
|
11063
|
-
default: return "incomplete_data";
|
|
11064
|
-
}
|
|
11065
|
-
}
|
|
11066
|
-
/**
|
|
11067
|
-
* Convert database enum string to DetectionClass discriminated union
|
|
11068
|
-
* Handles both current and legacy enum values for backwards compatibility
|
|
11069
|
-
*/
|
|
11070
|
-
function enumToDetectionClass(enumValue) {
|
|
11071
|
-
switch (enumValue) {
|
|
11072
|
-
case "human": return { type: "Human" };
|
|
11073
|
-
case "ai_agent": return { type: "AiAgent" };
|
|
11074
|
-
case "automation": return { type: "Bot" };
|
|
11075
|
-
case "bot": return { type: "Bot" };
|
|
11076
|
-
case "incomplete_data": return { type: "IncompleteData" };
|
|
11077
|
-
case "unknown": return { type: "IncompleteData" };
|
|
11078
|
-
default: return { type: "IncompleteData" };
|
|
11079
|
-
}
|
|
11080
|
-
}
|
|
11081
|
-
/**
|
|
11082
|
-
* Check if a value is a valid string-based detection class (current or legacy)
|
|
11083
|
-
*/
|
|
11084
|
-
function isLegacyDetectionClass(value) {
|
|
11085
|
-
return typeof value === "string" && [
|
|
11086
|
-
"human",
|
|
11087
|
-
"ai_agent",
|
|
11088
|
-
"bot",
|
|
11089
|
-
"incomplete_data",
|
|
11090
|
-
"automation",
|
|
11091
|
-
"unknown"
|
|
11092
|
-
].includes(value);
|
|
11093
|
-
}
|
|
11094
|
-
/**
|
|
11095
|
-
* Migrate legacy string detection class to new discriminated union
|
|
11096
|
-
* @deprecated Use enumToDetectionClass instead
|
|
11097
|
-
*/
|
|
11098
|
-
function migrateLegacyDetectionClass(value) {
|
|
11099
|
-
return enumToDetectionClass(value);
|
|
11100
|
-
}
|
|
11101
|
-
/**
|
|
11102
|
-
* Safely convert any detection class value to the discriminated union format
|
|
11103
|
-
*/
|
|
11104
|
-
function normalizeDetectionClass(value) {
|
|
11105
|
-
if (value && typeof value === "object" && "type" in value) return value;
|
|
11106
|
-
if (isLegacyDetectionClass(value)) return enumToDetectionClass(value);
|
|
11107
|
-
return { type: "IncompleteData" };
|
|
11108
|
-
}
|
|
11109
|
-
/**
|
|
11110
|
-
* Safely convert any detection class value to database enum format
|
|
11111
|
-
*/
|
|
11112
|
-
function normalizeDetectionClassEnum(value) {
|
|
11113
|
-
if (value && typeof value === "object" && "type" in value) return detectionClassToEnum(value);
|
|
11114
|
-
if (isLegacyDetectionClass(value)) return detectionClassToEnum(enumToDetectionClass(value));
|
|
11115
|
-
return "incomplete_data";
|
|
11116
|
-
}
|
|
11117
|
-
|
|
11118
11521
|
//#endregion
|
|
11119
11522
|
//#region src/utils/agent-runtime-label.ts
|
|
11120
11523
|
/**
|
|
@@ -11652,6 +12055,35 @@ const RecommendationGenerationSchema = object({
|
|
|
11652
12055
|
forceRefresh: boolean$1().optional().default(false)
|
|
11653
12056
|
});
|
|
11654
12057
|
|
|
12058
|
+
//#endregion
|
|
12059
|
+
//#region src/schemas/consent-policy-endpoint.ts
|
|
12060
|
+
/**
|
|
12061
|
+
* Wire shape of `GET /api/v1/kya-os/consent-policy`, defined once here. The
|
|
12062
|
+
* response is the project's consent policy as a client needs to render and
|
|
12063
|
+
* pre-check it; it is authenticated with the project API key.
|
|
12064
|
+
*
|
|
12065
|
+
* `etag` is the BARE hash (lowercase hex). The HTTP `ETag` header carries the
|
|
12066
|
+
* same value as a quoted strong validator, `"<etag>"`, on 200 and 304.
|
|
12067
|
+
* `riskLevel` is ConsentConfig's capability risk set, unchanged.
|
|
12068
|
+
*/
|
|
12069
|
+
const ConsentPolicyRiskLevelSchema = _enum([
|
|
12070
|
+
"low",
|
|
12071
|
+
"medium",
|
|
12072
|
+
"high",
|
|
12073
|
+
"critical"
|
|
12074
|
+
]);
|
|
12075
|
+
const ConsentPolicyCapabilitySchema = strictObject({
|
|
12076
|
+
scope: string().min(1),
|
|
12077
|
+
defaultOn: boolean$1(),
|
|
12078
|
+
riskLevel: ConsentPolicyRiskLevelSchema
|
|
12079
|
+
});
|
|
12080
|
+
const ConsentPolicyResponseSchema = strictObject({
|
|
12081
|
+
allowedScopes: array(string().min(1)).optional(),
|
|
12082
|
+
maxGrantSeconds: number$1().int().positive().optional(),
|
|
12083
|
+
capabilities: array(ConsentPolicyCapabilitySchema).optional(),
|
|
12084
|
+
etag: string().regex(/^[0-9a-f]{64}$/)
|
|
12085
|
+
});
|
|
12086
|
+
|
|
11655
12087
|
//#endregion
|
|
11656
12088
|
//#region src/wire/gateway-internal-tools.ts
|
|
11657
12089
|
/**
|
|
@@ -11804,20 +12236,14 @@ function isPrivateOrReservedHost(hostname) {
|
|
|
11804
12236
|
* octal/hex-encoded SSRF bypasses like `0177.0.0.01` → `127.0.0.1`.
|
|
11805
12237
|
*/
|
|
11806
12238
|
function parseIPv4Octet(part) {
|
|
11807
|
-
if (/^0x[0-9a-f]+$/i.test(part))
|
|
11808
|
-
|
|
11809
|
-
return Number.isNaN(n) ? null : n;
|
|
11810
|
-
}
|
|
11811
|
-
if (/^0[0-7]+$/.test(part)) {
|
|
11812
|
-
const n = parseInt(part, 8);
|
|
11813
|
-
return Number.isNaN(n) ? null : n;
|
|
11814
|
-
}
|
|
12239
|
+
if (/^0x[0-9a-f]+$/i.test(part)) return parseInt(part, 16);
|
|
12240
|
+
if (/^0[0-7]+$/.test(part)) return parseInt(part, 8);
|
|
11815
12241
|
if (/^(0|[1-9]\d*)$/.test(part)) return parseInt(part, 10);
|
|
11816
12242
|
return null;
|
|
11817
12243
|
}
|
|
11818
12244
|
function isPrivateIPv4(ip) {
|
|
11819
12245
|
const parts = ip.split(".").map(Number);
|
|
11820
|
-
if (parts.
|
|
12246
|
+
if (parts.some((p) => p > 255)) return false;
|
|
11821
12247
|
const [a, b] = parts;
|
|
11822
12248
|
if (a === 0) return true;
|
|
11823
12249
|
if (a === 127) return true;
|
|
@@ -11926,7 +12352,8 @@ const upstreamServerSchema = object({
|
|
|
11926
12352
|
});
|
|
11927
12353
|
/**
|
|
11928
12354
|
* Input variant — id/slug optional for new upstreams (auto-generated by PUT
|
|
11929
|
-
* handler). Also omits
|
|
12355
|
+
* handler). Also omits server-managed project ownership and the two
|
|
12356
|
+
* server-managed static-headers fields:
|
|
11930
12357
|
* `staticHeadersEncrypted` (ciphertext — clients never author this
|
|
11931
12358
|
* directly) and `staticHeaderKeys` (a read-only projection echoed back on
|
|
11932
12359
|
* GET/PUT responses). The plaintext `staticHeaders` field is intentionally
|
|
@@ -11934,6 +12361,7 @@ const upstreamServerSchema = object({
|
|
|
11934
12361
|
* values; the PUT handler encrypts it before persisting.
|
|
11935
12362
|
*/
|
|
11936
12363
|
const upstreamServerInputSchema = upstreamServerSchema.omit({
|
|
12364
|
+
projectId: true,
|
|
11937
12365
|
staticHeadersEncrypted: true,
|
|
11938
12366
|
staticHeaderKeys: true
|
|
11939
12367
|
}).extend({
|
|
@@ -14337,13 +14765,21 @@ const PolicyConfigSchema = object({
|
|
|
14337
14765
|
* Trusted Layer-2 delegation root DIDs for the project's org (P2 / DR-1),
|
|
14338
14766
|
* server-resolved by the policy API. A consuming middleware forwards these
|
|
14339
14767
|
* into the engine's `ContextSpec.trustedDelegationRoots` so L2 delegation
|
|
14340
|
-
* chains are pinned to the org DID. Absent ⇒ omitted
|
|
14341
|
-
*
|
|
14768
|
+
* chains are pinned to the org DID. Absent ⇒ omitted, and the engine rejects
|
|
14769
|
+
* delegation. Optional (no default)
|
|
14342
14770
|
* so a policy without the field round-trips as `undefined`, matching the
|
|
14343
14771
|
* policy API's `PolicyResponse` shape and the orchestrator's omit-when-unset
|
|
14344
14772
|
* contract.
|
|
14345
14773
|
*/
|
|
14346
|
-
trustedDelegationRoots: array(string()).optional()
|
|
14774
|
+
trustedDelegationRoots: array(string()).optional(),
|
|
14775
|
+
/**
|
|
14776
|
+
* The org's one OAuth authorization server issuer (RFC 8414 `issuer`), as the
|
|
14777
|
+
* platform's IssuerContext computes it (`https://<branded host or platform>/oauth/<slug>`).
|
|
14778
|
+
* A middleware that serves protected resource metadata advertises exactly
|
|
14779
|
+
* this in `authorization_servers` and never builds an issuer URL itself.
|
|
14780
|
+
* Absent ⇒ the platform could not resolve the org; serve no metadata.
|
|
14781
|
+
*/
|
|
14782
|
+
authorizationServerIssuer: string().url().optional()
|
|
14347
14783
|
});
|
|
14348
14784
|
const PolicyEvaluationContextSchema = object({
|
|
14349
14785
|
agentType: string().optional(),
|
|
@@ -14649,296 +15085,6 @@ function createResult(action, reason, matchType, extras) {
|
|
|
14649
15085
|
};
|
|
14650
15086
|
}
|
|
14651
15087
|
|
|
14652
|
-
//#endregion
|
|
14653
|
-
//#region src/policy/cedar-string.ts
|
|
14654
|
-
/**
|
|
14655
|
-
* The Cedar double-quoted string grammar shared by the compose engine's emitter/
|
|
14656
|
-
* parser and every enforcement-path TEXT reader (required-scopes, cedar-rule-match).
|
|
14657
|
-
* Keeping the escape codec AND the capture pattern in one place means a value the
|
|
14658
|
-
* emitter escapes is decoded identically wherever a reader parses it back — they
|
|
14659
|
-
* can never drift. (Rust/.NET parse Cedar with a real parser and are unaffected.)
|
|
14660
|
-
*/
|
|
14661
|
-
/** Escape a value for embedding inside a Cedar double-quoted string literal. */
|
|
14662
|
-
function escapeCedarString(value) {
|
|
14663
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
14664
|
-
}
|
|
14665
|
-
/** Inverse of {@link escapeCedarString} — decode Cedar string escapes to raw text. */
|
|
14666
|
-
function unescapeCedarString(value) {
|
|
14667
|
-
return value.replace(/\\([\\"nrt])/g, (_m, ch) => ch === "n" ? "\n" : ch === "r" ? "\r" : ch === "t" ? " " : ch);
|
|
14668
|
-
}
|
|
14669
|
-
/**
|
|
14670
|
-
* Build a RegExp matching `<prefixSource>"<body>"`, where <body> is an escape-aware
|
|
14671
|
-
* Cedar string. Capture group 1 is the RAW (still-escaped) body — pass it through
|
|
14672
|
-
* {@link unescapeCedarString} before use. `prefixSource` is a regex-source fragment
|
|
14673
|
-
* (escape its own metacharacters). This is the single source of the quoted-string
|
|
14674
|
-
* capture pattern.
|
|
14675
|
-
*/
|
|
14676
|
-
function cedarQuotedValueRegExp(prefixSource, flags = "") {
|
|
14677
|
-
return new RegExp(`${prefixSource}"((?:\\\\.|[^"\\\\])*)"`, flags);
|
|
14678
|
-
}
|
|
14679
|
-
|
|
14680
|
-
//#endregion
|
|
14681
|
-
//#region src/policy/cedar-rule-match.ts
|
|
14682
|
-
/**
|
|
14683
|
-
* Shared best-effort matchers for reading a composed Cedar policy's per-rule
|
|
14684
|
-
* annotations (`@scopes`, `@approvers`, …) WITHOUT a Cedar AST. Both
|
|
14685
|
-
* `requiredScopesForRequest` (consent scopes) and `approvalQuorumForRequest`
|
|
14686
|
-
* (step-up quorum) narrow a rule's annotation to a request the same way the
|
|
14687
|
-
* compose engine's own `parseExistingCedar` does: blocks split on blank lines,
|
|
14688
|
-
* a rule contributes only when EVERY request fact it constrains matches.
|
|
14689
|
-
*
|
|
14690
|
-
* A fact is matched against the SAME projection the gateway/edge feeds the
|
|
14691
|
-
* engine (`name = agentName`, `category = scraper|detectionClass`), so the
|
|
14692
|
-
* narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows.
|
|
14693
|
-
*/
|
|
14694
|
-
/**
|
|
14695
|
-
* A block applies when its path AND principal conditions all match the KNOWN
|
|
14696
|
-
* request facts. An unknown fact never narrows (so the no-`request` case unions
|
|
14697
|
-
* every matching rule's annotation).
|
|
14698
|
-
*/
|
|
14699
|
-
function blockApplies(block, request) {
|
|
14700
|
-
if (request?.path !== void 0 && !blockMatchesPath(block, request.path)) return false;
|
|
14701
|
-
if (request?.name !== void 0 && !blockMatchesEquality(block, "principal.name", request.name)) return false;
|
|
14702
|
-
if (request?.category !== void 0 && !blockMatchesEquality(block, "principal.category", request.category)) return false;
|
|
14703
|
-
return true;
|
|
14704
|
-
}
|
|
14705
|
-
/** The `resource.path` literals appearing anywhere in `text` (no `when`/
|
|
14706
|
-
* `unless` scoping — callers that care about scope use `splitWhenUnless`
|
|
14707
|
-
* first). Shared regex extraction for `pathLiteralsInBlock` and the
|
|
14708
|
-
* scope-aware helpers below. */
|
|
14709
|
-
function pathLiteralsInText(text) {
|
|
14710
|
-
return Array.from(text.matchAll(cedarQuotedValueRegExp("resource\\.path (?:like|==) ", "g")), (m) => unescapeCedarString(m[1]));
|
|
14711
|
-
}
|
|
14712
|
-
/**
|
|
14713
|
-
* The `resource.path` literals a block MENTIONS anywhere — `when` or
|
|
14714
|
-
* `unless` alike (empty = the block never mentions a path). Used for
|
|
14715
|
-
* enumeration (which concrete paths does this bundle reference at all),
|
|
14716
|
-
* NOT for "does this block's condition match path" — that's
|
|
14717
|
-
* `blockMatchesPath`, which is `unless`-aware. Mixing the two up is exactly
|
|
14718
|
-
* the bug Bugbot caught (2026-09-10): a literal that appears ONLY inside
|
|
14719
|
-
* `unless { … }` names a path this block does NOT apply to, not one it
|
|
14720
|
-
* targets.
|
|
14721
|
-
*/
|
|
14722
|
-
function pathLiteralsInBlock(block) {
|
|
14723
|
-
return pathLiteralsInText(block);
|
|
14724
|
-
}
|
|
14725
|
-
/**
|
|
14726
|
-
* Split `block` into its `when`-scoped text and its `unless`-scoped inner
|
|
14727
|
-
* text, mirroring the compose engine's own excision order
|
|
14728
|
-
* (`apps/web/lib/compose/cedar.ts`'s `unless` handling): `unless { … }` is
|
|
14729
|
-
* located first and excised, so its own literals never leak into what
|
|
14730
|
-
* counts as the block's `when` (narrowing) scope.
|
|
14731
|
-
*
|
|
14732
|
-
* CodeQL js/polynomial-redos: a single `/unless\s*\{([\s\S]*?)\}\s*;?/`
|
|
14733
|
-
* regex is quadratic on a policy blob containing many "unless{"
|
|
14734
|
-
* substrings with no closing brace (composed policy text is untrusted,
|
|
14735
|
-
* customer-authored input evaluated on the request hot path) — an
|
|
14736
|
-
* unanchored match retries the unbounded `[\s\S]*?` scan-to-end at every
|
|
14737
|
-
* failed start position. `search()` for the fixed-length "unless\s*{"
|
|
14738
|
-
* prefix has no such ambiguity (each position fails fast), and the
|
|
14739
|
-
* closing brace is then found with a single linear `indexOf`, so the
|
|
14740
|
-
* whole split stays O(n) regardless of how many false "unless{" starts
|
|
14741
|
-
* the text contains.
|
|
14742
|
-
*/
|
|
14743
|
-
function splitWhenUnless(block) {
|
|
14744
|
-
const unlessIndex = block.search(/unless\s*\{/);
|
|
14745
|
-
if (unlessIndex === -1) return {
|
|
14746
|
-
whenText: block,
|
|
14747
|
-
unlessText: ""
|
|
14748
|
-
};
|
|
14749
|
-
const openBraceIndex = block.indexOf("{", unlessIndex);
|
|
14750
|
-
const closeBraceIndex = block.indexOf("}", openBraceIndex + 1);
|
|
14751
|
-
if (closeBraceIndex === -1) return {
|
|
14752
|
-
whenText: block,
|
|
14753
|
-
unlessText: ""
|
|
14754
|
-
};
|
|
14755
|
-
return {
|
|
14756
|
-
whenText: block.slice(0, unlessIndex),
|
|
14757
|
-
unlessText: block.slice(openBraceIndex + 1, closeBraceIndex)
|
|
14758
|
-
};
|
|
14759
|
-
}
|
|
14760
|
-
/**
|
|
14761
|
-
* A block applies to `path` when: no `unless` literal excludes it, AND
|
|
14762
|
-
* either the `when` scope has no path constraint at all (unconstrained →
|
|
14763
|
-
* matches every path except what `unless` just excluded), or one of the
|
|
14764
|
-
* `when` scope's path literals matches (exact, or a `*`-prefix glob).
|
|
14765
|
-
*
|
|
14766
|
-
* Bugbot (2026-09-10): the previous version read path literals from the
|
|
14767
|
-
* WHOLE block regardless of `when` vs `unless`, so a site-wide forbid whose
|
|
14768
|
-
* only path mention was an `unless { resource.path == "/checkout" }`
|
|
14769
|
-
* exemption got scored as "targets only /checkout" — backwards. It applies
|
|
14770
|
-
* to every path EXCEPT the excepted one, not ONLY the excepted one.
|
|
14771
|
-
*/
|
|
14772
|
-
function blockMatchesPath(block, path) {
|
|
14773
|
-
const { whenText, unlessText } = splitWhenUnless(block);
|
|
14774
|
-
if (pathLiteralsInText(unlessText).some((literal) => pathLiteralMatches(literal, path))) return false;
|
|
14775
|
-
const whenLiterals = pathLiteralsInText(whenText);
|
|
14776
|
-
if (whenLiterals.length === 0) return true;
|
|
14777
|
-
return whenLiterals.some((literal) => pathLiteralMatches(literal, path));
|
|
14778
|
-
}
|
|
14779
|
-
/** Escape every regex metacharacter in `s` (so it matches literally). */
|
|
14780
|
-
function escapeRegExp(s) {
|
|
14781
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14782
|
-
}
|
|
14783
|
-
/**
|
|
14784
|
-
* Split a composed Cedar bundle into per-rule blocks (blank-line separated),
|
|
14785
|
-
* trimmed and with empties dropped. Mirrors the compose engine's own block
|
|
14786
|
-
* split (`apps/web/lib/compose/cedar.ts` `parseCedarBlocks`).
|
|
14787
|
-
*/
|
|
14788
|
-
function splitCedarBlocks(cedar) {
|
|
14789
|
-
return cedar.split(/\n\s*\n/).map((b) => b.trim()).filter((b) => b.length > 0);
|
|
14790
|
-
}
|
|
14791
|
-
/**
|
|
14792
|
-
* The set of values a block positively constrains `attr` to via `== ` literals.
|
|
14793
|
-
* Empty = the block places no `==` constraint on `attr` (unconstrained).
|
|
14794
|
-
*/
|
|
14795
|
-
function blockEqualityLiterals(block, attr) {
|
|
14796
|
-
const a = escapeRegExp(attr);
|
|
14797
|
-
return Array.from(block.matchAll(cedarQuotedValueRegExp(`${a} == `, "g")), (m) => unescapeCedarString(m[1]));
|
|
14798
|
-
}
|
|
14799
|
-
/**
|
|
14800
|
-
* The set of values a block EXCLUDES `attr` from via `!= ` literals.
|
|
14801
|
-
* Empty = the block places no `!=` constraint on `attr`.
|
|
14802
|
-
*/
|
|
14803
|
-
function blockExclusionLiterals(block, attr) {
|
|
14804
|
-
const a = escapeRegExp(attr);
|
|
14805
|
-
return Array.from(block.matchAll(cedarQuotedValueRegExp(`${a} != `, "g")), (m) => unescapeCedarString(m[1]));
|
|
14806
|
-
}
|
|
14807
|
-
/** A block applies to `value` when it is NOT excluded by a `!=` literal AND
|
|
14808
|
-
* (it declares no `==` literal — unconstrained → applies to all — or `value` is
|
|
14809
|
-
* one of them; compose emits an OR-disjunction for a name set). Without the `!=`
|
|
14810
|
-
* arm a rule that challenges everyone EXCEPT X (`principal.name != "X"`) would
|
|
14811
|
-
* over-advertise its annotation to X — a broader grant than the rule meant. */
|
|
14812
|
-
function blockMatchesEquality(block, attr, value) {
|
|
14813
|
-
const eq = blockEqualityLiterals(block, attr);
|
|
14814
|
-
if (blockExclusionLiterals(block, attr).includes(value)) return false;
|
|
14815
|
-
if (eq.length > 0) return eq.includes(value);
|
|
14816
|
-
return true;
|
|
14817
|
-
}
|
|
14818
|
-
/**
|
|
14819
|
-
* Match a `resource.path` literal against the request path with CEDAR `like`
|
|
14820
|
-
* semantics — NOT the package's `matchPath`. Cedar `*` matches any sequence
|
|
14821
|
-
* INCLUDING `/` (regex `.*`), whereas `matchPath` treats a single `*` as
|
|
14822
|
-
* `[^/]*` (no slash); using it here would disagree with what the engine
|
|
14823
|
-
* actually matched. A `==`/non-wildcard literal is an exact match; a `like`
|
|
14824
|
-
* literal maps each `*` (and `**`) to `.*`, anchored.
|
|
14825
|
-
*/
|
|
14826
|
-
function pathLiteralMatches(literal, path) {
|
|
14827
|
-
if (!literal.includes("*")) return path === literal;
|
|
14828
|
-
const pattern = escapeRegExp(literal).replace(/\\\*/g, ".*");
|
|
14829
|
-
try {
|
|
14830
|
-
return new RegExp(`^${pattern}$`).test(path);
|
|
14831
|
-
} catch {
|
|
14832
|
-
return false;
|
|
14833
|
-
}
|
|
14834
|
-
}
|
|
14835
|
-
/**
|
|
14836
|
-
* True when the block contains a Cedar `forbid` statement (a deny rule). A bare
|
|
14837
|
-
* `forbid` defaults to BLOCK; a `@verdict(...)` annotation refines the kind.
|
|
14838
|
-
*/
|
|
14839
|
-
function isForbidBlock(block) {
|
|
14840
|
-
return /\bforbid\s*\(/.test(block);
|
|
14841
|
-
}
|
|
14842
|
-
/** True when the block narrows the principal — by category/name equality, a
|
|
14843
|
-
* Cedar entity-type test (`principal is X`), or a scope-position binding
|
|
14844
|
-
* (`forbid(principal == X::"…"`). An un-narrowed deny matches every principal.
|
|
14845
|
-
*
|
|
14846
|
-
* Cursor Bugbot (2026-09-11, High): this used to scan the WHOLE block for
|
|
14847
|
-
* a principal literal, `when`/`unless` alike — the exact same class of bug
|
|
14848
|
-
* `blockMatchesPath` above was already fixed for on the path dimension
|
|
14849
|
-
* (see that function's doc comment). `unless { principal.category ==
|
|
14850
|
-
* "search_engine" }` on an otherwise site-wide `forbid` only exempts
|
|
14851
|
-
* search engines from the deny — the rule still denies every OTHER
|
|
14852
|
-
* principal, humans included — but scanning the whole block found the
|
|
14853
|
-
* `==` literal and called the rule "narrowed," so `pathHasUnnarrowedDenyRule`
|
|
14854
|
-
* missed it and a real browser hitting that path reached Cedar only to be
|
|
14855
|
-
* denied by the very rule this check exists to catch. Split `when`/`unless`
|
|
14856
|
-
* first: a WHEN-scope (or scope-position) literal genuinely targets the
|
|
14857
|
-
* deny, narrowing it away from every principal not named — whatever value
|
|
14858
|
-
* it names, since an un-narrowed literal search wouldn't have found one at
|
|
14859
|
-
* all. An UNLESS-scope literal does the opposite: it exempts ONLY that
|
|
14860
|
-
* specific principal, so it narrows the rule away from humans only when
|
|
14861
|
-
* the exempted value is literally `"human"` (the #3297 carve-out idiom) —
|
|
14862
|
-
* exempting anyone else leaves the deny fully un-narrowed with respect to
|
|
14863
|
-
* humans. */
|
|
14864
|
-
function narrowsPrincipal(block) {
|
|
14865
|
-
const { whenText, unlessText } = splitWhenUnless(block);
|
|
14866
|
-
if (blockEqualityLiterals(whenText, "principal.category").length > 0) return true;
|
|
14867
|
-
if (blockExclusionLiterals(whenText, "principal.category").includes("human")) return true;
|
|
14868
|
-
if (blockEqualityLiterals(whenText, "principal.name").length > 0) return true;
|
|
14869
|
-
if (/principal\s+is\s+\w/.test(whenText)) return true;
|
|
14870
|
-
if (/forbid\s*\(\s*principal\s*==/.test(whenText)) return true;
|
|
14871
|
-
if (blockEqualityLiterals(unlessText, "principal.category").includes("human")) return true;
|
|
14872
|
-
return false;
|
|
14873
|
-
}
|
|
14874
|
-
/** A deny rule that targets EVERY principal — the silent-human-impact footgun. */
|
|
14875
|
-
function isUnnarrowedDenyBlock(block) {
|
|
14876
|
-
return isForbidBlock(block) && !narrowsPrincipal(block);
|
|
14877
|
-
}
|
|
14878
|
-
/**
|
|
14879
|
-
* True when some un-narrowed deny rule in the bundle matches `path` — i.e. a
|
|
14880
|
-
* human hitting `path` is denied by a rule that never narrowed the principal.
|
|
14881
|
-
* The single shared definition of "this path catches humans by accident,"
|
|
14882
|
-
* used by the deploy gate AND the preview banner.
|
|
14883
|
-
*/
|
|
14884
|
-
function pathHasUnnarrowedDenyRule(cedar, path) {
|
|
14885
|
-
return splitCedarBlocks(cedar).some((block) => isUnnarrowedDenyBlock(block) && blockMatchesPath(block, path));
|
|
14886
|
-
}
|
|
14887
|
-
|
|
14888
|
-
//#endregion
|
|
14889
|
-
//#region src/policy/required-scopes.ts
|
|
14890
|
-
/**
|
|
14891
|
-
* Consent scopes a composed Cedar policy REQUIRES for a request — the
|
|
14892
|
-
* `@scopes(...)` annotations the compose engine writes on CHALLENGE-verdict
|
|
14893
|
-
* rules (alongside `unless { context.granted_scopes.contains("S") }`).
|
|
14894
|
-
*
|
|
14895
|
-
* WHY: when a scope-gated rule challenges a request, the step-up must request
|
|
14896
|
-
* EXACTLY the scopes the policy demands, so the consent flow mints a delegation
|
|
14897
|
-
* carrying them (and the agent's retry then satisfies the carve-out). The
|
|
14898
|
-
* policy is the source of truth for "what this route requires", so reading its
|
|
14899
|
-
* `@scopes` is reading the SSOT — not re-deriving an engine-computed value.
|
|
14900
|
-
*
|
|
14901
|
-
* Best-effort TEXT parse (no Cedar AST), mirroring the compose engine's own
|
|
14902
|
-
* `parseExistingCedar`: blocks are split on blank lines. A CHALLENGE block
|
|
14903
|
-
* contributes its scopes only when EVERY request fact it constrains matches —
|
|
14904
|
-
* `resource.path`, `principal.name`, and `principal.category` — so on a shared
|
|
14905
|
-
* path the scopes of ANOTHER agent's CHALLENGE rule are not advertised (the
|
|
14906
|
-
* engine challenged on the rule whose `when` matched, not merely the path).
|
|
14907
|
-
*
|
|
14908
|
-
* A fact is matched against the SAME projection the gateway feeds the engine
|
|
14909
|
-
* (`name = detection.agentName`, `category = scraper|detectionClass`), so the
|
|
14910
|
-
* narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows:
|
|
14911
|
-
* with no `request` (the consent allow-list case) this returns the union of
|
|
14912
|
-
* every CHALLENGE rule's scopes — exactly what consent must be able to grant.
|
|
14913
|
-
*/
|
|
14914
|
-
function requiredScopesForRequest(policySource, request) {
|
|
14915
|
-
if (!policySource || !policySource.trim()) return [];
|
|
14916
|
-
const out = /* @__PURE__ */ new Set();
|
|
14917
|
-
for (const block of policySource.split(/\n\s*\n/)) {
|
|
14918
|
-
if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
|
|
14919
|
-
const scopesMatch = block.match(cedarQuotedValueRegExp("@scopes\\("));
|
|
14920
|
-
if (!scopesMatch) continue;
|
|
14921
|
-
const scopes = scopesMatch[1].split(/\s+/).filter(Boolean).map(unescapeCedarString);
|
|
14922
|
-
if (scopes.length === 0) continue;
|
|
14923
|
-
if (!blockApplies(block, request)) continue;
|
|
14924
|
-
for (const scope of scopes) out.add(scope);
|
|
14925
|
-
}
|
|
14926
|
-
return [...out];
|
|
14927
|
-
}
|
|
14928
|
-
|
|
14929
|
-
//#endregion
|
|
14930
|
-
//#region src/policy/decision-policy-id.ts
|
|
14931
|
-
function decisionPolicyId(decision) {
|
|
14932
|
-
switch (decision.kind) {
|
|
14933
|
-
case "Permit": return decision.policyId;
|
|
14934
|
-
case "Block": return decision.reason?.kind === "PolicyDenied" ? decision.reason.policyId : void 0;
|
|
14935
|
-
case "Challenge": return decision.params?.policyId;
|
|
14936
|
-
case "Redirect": return decision.target?.policyId;
|
|
14937
|
-
case "Instruct": return decision.payload?.policyId;
|
|
14938
|
-
default: return;
|
|
14939
|
-
}
|
|
14940
|
-
}
|
|
14941
|
-
|
|
14942
15088
|
//#endregion
|
|
14943
15089
|
//#region src/policy/bespoke-policy.ts
|
|
14944
15090
|
/** Stable synthetic `@id` per explicit bespoke mechanism. */
|
|
@@ -14997,132 +15143,24 @@ function nonNavigablePolicyLabel(policyId) {
|
|
|
14997
15143
|
|
|
14998
15144
|
//#endregion
|
|
14999
15145
|
//#region src/policy/policy-lint.ts
|
|
15000
|
-
const
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
/**
|
|
15006
|
-
* Flag every un-narrowed deny rule in a composed Cedar bundle. Pure and
|
|
15007
|
-
* parity-irrelevant: a heuristic author-time WARNING, never an enforcement
|
|
15008
|
-
* decision. Shares its "un-narrowed deny" definition with the deploy gate
|
|
15009
|
-
* (`pathHasUnnarrowedDenyRule`) so the editor and the gate agree.
|
|
15010
|
-
*/
|
|
15146
|
+
const NARROW_ADVICE = "Add a `principal.category == \"ai_agent\"` (or `principal.name`) condition, or confirm you intend to affect them.";
|
|
15147
|
+
const EVERYONE_MESSAGE = `This rule denies every visitor, including humans and ${NO_EVIDENCE_CATEGORY} visitors, because it does not narrow the principal. ${NARROW_ADVICE}`;
|
|
15148
|
+
const HUMAN_MESSAGE = `This rule denies human visitors because it does not narrow the principal. ${NARROW_ADVICE}`;
|
|
15149
|
+
const NO_EVIDENCE_MESSAGE = `This rule also applies to ${NO_EVIDENCE_CATEGORY} visitors, who are real people whose browser sent no evidence to classify. Add a \`${NO_EVIDENCE_EXCLUSION_TERM}\` condition, or confirm you intend to affect them.`;
|
|
15150
|
+
const messageFor = (classes) => classes.length === PROBE_CLASSES.length ? EVERYONE_MESSAGE : classes.includes("no_evidence") ? NO_EVIDENCE_MESSAGE : HUMAN_MESSAGE;
|
|
15011
15151
|
function lintUnnarrowedDenyRules(cedar) {
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
const line = idx < 0 ? 1 : cedar.slice(0, idx).split("\n").length;
|
|
15018
|
-
if (idx >= 0) searchFrom = idx + block.length;
|
|
15019
|
-
findings.push({
|
|
15020
|
-
ruleId: blockIdAnnotation(block),
|
|
15021
|
-
line,
|
|
15022
|
-
message: UNNARROWED_DENY_MESSAGE
|
|
15023
|
-
});
|
|
15024
|
-
}
|
|
15025
|
-
return findings;
|
|
15026
|
-
}
|
|
15027
|
-
|
|
15028
|
-
//#endregion
|
|
15029
|
-
//#region src/policy/approval-quorum.ts
|
|
15030
|
-
/**
|
|
15031
|
-
* The step-up APPROVAL QUORUM a composed Cedar policy requires for a request —
|
|
15032
|
-
* the `@approvers(...)` (+ optional `@quorum("N")`) annotations on a
|
|
15033
|
-
* CHALLENGE-verdict rule.
|
|
15034
|
-
*
|
|
15035
|
-
* WHY (ADR D7 — distinct verdict): the engine emits a single `Challenge` for
|
|
15036
|
-
* both consent (`@scopes`) and human-approval step-up (`@approvers`). They are
|
|
15037
|
-
* DIFFERENT security flows and must not collide — a consent challenge mints a
|
|
15038
|
-
* delegation; an approval-quorum challenge demands N-of-M humans cryptographically
|
|
15039
|
-
* sign. This classifier is the seam that tells them apart from the policy text:
|
|
15040
|
-
* - a CHALLENGE rule carrying `@approvers` → an approval quorum (this returns it)
|
|
15041
|
-
* - a CHALLENGE rule with only `@scopes` (or neither) → consent (returns null)
|
|
15042
|
-
*
|
|
15043
|
-
* It mirrors {@link requiredScopesForRequest}: the SAME best-effort block parse
|
|
15044
|
-
* and the SAME request narrowing (shared {@link blockApplies}), so the rule it
|
|
15045
|
-
* reads the quorum off is the rule the engine actually challenged on — not merely
|
|
15046
|
-
* one that shares a path. Reading the annotation is reading the SSOT (the policy
|
|
15047
|
-
* is the source of truth for "what this action requires"), not re-deriving it.
|
|
15048
|
-
*
|
|
15049
|
-
* The engine carries no rule id on its Challenge, so the classifier re-matches by
|
|
15050
|
-
* request facts and is FAIL-CLOSED on ambiguity:
|
|
15051
|
-
* - if a CONSENT-only CHALLENGE rule ALSO applies, it returns null — the engine
|
|
15052
|
-
* may have challenged on THAT, and reading approval off a different rule would
|
|
15053
|
-
* conflate the two flows (ADR D7)
|
|
15054
|
-
* - if two applying approval rules disagree on {n, approvers}, it returns null —
|
|
15055
|
-
* enforcing the wrong approver roster is a worse failure than a clean deny
|
|
15056
|
-
* Each caller feeds it the SAME facts its engine evaluated, so it narrows to the
|
|
15057
|
-
* rule the engine could have fired on. The EDGE worker sets resource.path +
|
|
15058
|
-
* principal.name and narrows on them; the Fly gateway sets NEITHER (it populates
|
|
15059
|
-
* category + the resource entity, leaving resource.path=="" and principal.name=""),
|
|
15060
|
-
* so it passes those as "" — path/name-scoped rules don't fire there, exactly as
|
|
15061
|
-
* the engine sees it, and a same-scope tie falls to the fail-closed guard above.
|
|
15062
|
-
*/
|
|
15063
|
-
function approvalQuorumForRequest(policySource, request) {
|
|
15064
|
-
if (!policySource || !policySource.trim()) return null;
|
|
15065
|
-
let chosen = null;
|
|
15066
|
-
for (const block of policySource.split(/\n\s*\n/)) {
|
|
15067
|
-
if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
|
|
15068
|
-
if (!blockApplies(block, request)) continue;
|
|
15069
|
-
const approvers = parseApprovers(block);
|
|
15070
|
-
if (!approvers) return null;
|
|
15071
|
-
const candidate = {
|
|
15072
|
-
n: parseQuorumN(block),
|
|
15073
|
-
approvers
|
|
15074
|
-
};
|
|
15075
|
-
if (chosen && !sameQuorum(chosen, candidate)) return null;
|
|
15076
|
-
chosen = candidate;
|
|
15077
|
-
}
|
|
15078
|
-
return chosen;
|
|
15079
|
-
}
|
|
15080
|
-
/** The DIDs of an `@approvers("did … did")` annotation, or null when the rule
|
|
15081
|
-
* carries none (a consent challenge) or an empty/whitespace list (no real gate). */
|
|
15082
|
-
function parseApprovers(block) {
|
|
15083
|
-
const m = block.match(/@approvers\("([^"]*)"\)/);
|
|
15084
|
-
if (!m) return null;
|
|
15085
|
-
const approvers = m[1].split(/\s+/).filter(Boolean);
|
|
15086
|
-
return approvers.length > 0 ? approvers : null;
|
|
15087
|
-
}
|
|
15088
|
-
/** Two quorums match iff same n and same ordered approver list. */
|
|
15089
|
-
function sameQuorum(a, b) {
|
|
15090
|
-
return a.n === b.n && a.approvers.length === b.approvers.length && a.approvers.every((did, i) => did === b.approvers[i]);
|
|
15091
|
-
}
|
|
15092
|
-
/**
|
|
15093
|
-
* The `@quorum("N")` count, or 1 when absent/malformed. Fail-secure: an
|
|
15094
|
-
* unparseable or `< 1` value falls back to 1 (the smallest real quorum), never 0
|
|
15095
|
-
* — which would make the step-up gate a no-op. The route's own
|
|
15096
|
-
* `validateStepUpQuorum` is the second line of defence on a misconfigured n.
|
|
15097
|
-
*/
|
|
15098
|
-
function parseQuorumN(block) {
|
|
15099
|
-
const m = block.match(/@quorum\("([^"]*)"\)/);
|
|
15100
|
-
if (!m) return 1;
|
|
15101
|
-
const n = Number(m[1]);
|
|
15102
|
-
return Number.isInteger(n) && n >= 1 ? n : 1;
|
|
15152
|
+
return unnarrowedDenyStatements(cedar).map(({ statement, classes, line }) => ({
|
|
15153
|
+
ruleId: statementId(statement),
|
|
15154
|
+
line,
|
|
15155
|
+
message: messageFor(classes)
|
|
15156
|
+
}));
|
|
15103
15157
|
}
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
* legitimately met; `{ ok: true }` only when the quorum is a real gate.
|
|
15111
|
-
*
|
|
15112
|
-
* Ordering is load-bearing: the `n` guard runs first, so an invalid quorum that
|
|
15113
|
-
* is both non-positive AND has no approvers reports `invalid_step_up_quorum`
|
|
15114
|
-
* (stable/deterministic reason).
|
|
15115
|
-
*/
|
|
15116
|
-
function validateStepUpQuorum(quorum) {
|
|
15117
|
-
if (!Number.isInteger(quorum.n) || quorum.n < 1) return {
|
|
15118
|
-
ok: false,
|
|
15119
|
-
reason: "invalid_step_up_quorum"
|
|
15120
|
-
};
|
|
15121
|
-
if (!Array.isArray(quorum.approvers) || quorum.approvers.length === 0) return {
|
|
15122
|
-
ok: false,
|
|
15123
|
-
reason: "step_up_no_approvers"
|
|
15124
|
-
};
|
|
15125
|
-
return { ok: true };
|
|
15158
|
+
const MISSING_BASELINE_MESSAGE = `This policy has no baseline permit, so every visitor that no permit rule covers is denied, humans and ${NO_EVIDENCE_CATEGORY} visitors included. Add \`permit(principal, action, resource);\` if you want unmatched traffic allowed.`;
|
|
15159
|
+
function lintMissingBaselinePermit(cedar) {
|
|
15160
|
+
return lacksBaselinePermit(cedar) ? [{
|
|
15161
|
+
line: 1,
|
|
15162
|
+
message: MISSING_BASELINE_MESSAGE
|
|
15163
|
+
}] : [];
|
|
15126
15164
|
}
|
|
15127
15165
|
|
|
15128
15166
|
//#endregion
|
|
@@ -15139,6 +15177,11 @@ function validateStepUpQuorum(quorum) {
|
|
|
15139
15177
|
* - Fallback to default policy on errors
|
|
15140
15178
|
* - Configurable API endpoints
|
|
15141
15179
|
*/
|
|
15180
|
+
function looksLikePolicyApiBody(data) {
|
|
15181
|
+
if (typeof data !== "object" || data === null) return false;
|
|
15182
|
+
const threshold = data.blockThreshold;
|
|
15183
|
+
return typeof threshold === "number" && Number.isFinite(threshold);
|
|
15184
|
+
}
|
|
15142
15185
|
var PolicyUnavailableError = class extends Error {
|
|
15143
15186
|
code = "POLICY_UNAVAILABLE";
|
|
15144
15187
|
constructor() {
|
|
@@ -15295,6 +15338,7 @@ var PolicyFetcher = class {
|
|
|
15295
15338
|
});
|
|
15296
15339
|
if (!response.ok) throw new Error(`API returned ${response.status}: ${response.statusText}`);
|
|
15297
15340
|
const data = await response.json();
|
|
15341
|
+
if (!looksLikePolicyApiBody(data)) throw new Error("Policy response is not from the policy API");
|
|
15298
15342
|
const policy = safeParsePolicyConfig(data);
|
|
15299
15343
|
if (!policy) throw new Error("Invalid policy response format");
|
|
15300
15344
|
return policy;
|
|
@@ -15414,545 +15458,6 @@ function createEvaluationContext(options) {
|
|
|
15414
15458
|
};
|
|
15415
15459
|
}
|
|
15416
15460
|
|
|
15417
|
-
//#endregion
|
|
15418
|
-
//#region src/host-adapter/verdict-cookie.ts
|
|
15419
|
-
/**
|
|
15420
|
-
* Canonical cookie name. Sites-1's `/blocked` page reads from this
|
|
15421
|
-
* exact key; do not rename without updating the dashboard route.
|
|
15422
|
-
*/
|
|
15423
|
-
const VERDICT_COOKIE_NAME = "__checkpoint_verdict";
|
|
15424
|
-
/**
|
|
15425
|
-
* Compute the verdict label from a `RenderedResponse`.
|
|
15426
|
-
*/
|
|
15427
|
-
function deriveVerdict(rendered) {
|
|
15428
|
-
if (rendered.status === null) return "allowed";
|
|
15429
|
-
if (rendered.status === 302) return "redirected";
|
|
15430
|
-
return "denied";
|
|
15431
|
-
}
|
|
15432
|
-
/**
|
|
15433
|
-
* Build the `__checkpoint_verdict` cookie value Sites-1's Sonner toast
|
|
15434
|
-
* reads. Byte-format pinned by tests in both `checkpoint-nextjs` and
|
|
15435
|
-
* `checkpoint-express`:
|
|
15436
|
-
*
|
|
15437
|
-
* - allowed: `{"verdict":"allowed"}`
|
|
15438
|
-
* - denied: `{"verdict":"denied","reason":"<r>"}`
|
|
15439
|
-
* - redirected: `{"verdict":"redirected"}`
|
|
15440
|
-
*
|
|
15441
|
-
* Returns raw JSON; the host's cookie-write call URL-encodes.
|
|
15442
|
-
*/
|
|
15443
|
-
function encodeVerdictCookie(rendered) {
|
|
15444
|
-
const verdict = deriveVerdict(rendered);
|
|
15445
|
-
const reason = rendered.headers["X-Checkpoint-Reason"];
|
|
15446
|
-
return JSON.stringify(reason ? {
|
|
15447
|
-
verdict,
|
|
15448
|
-
reason
|
|
15449
|
-
} : { verdict });
|
|
15450
|
-
}
|
|
15451
|
-
|
|
15452
|
-
//#endregion
|
|
15453
|
-
//#region src/host-adapter/content-negotiation.ts
|
|
15454
|
-
/**
|
|
15455
|
-
* Content negotiation — framework-agnostic Accept-header parsing for
|
|
15456
|
-
* host adapters.
|
|
15457
|
-
*
|
|
15458
|
-
* The engine's `RenderedResponse` doesn't make HTML-vs-JSON branching
|
|
15459
|
-
* decisions; the host wrapper does that based on what the client
|
|
15460
|
-
* accepts. Both Next.js (NextRequest) and Express (Request) carry the
|
|
15461
|
-
* Accept header in different shapes — `req.headers.get('accept')` vs
|
|
15462
|
-
* `req.get('Accept')` vs `req.headers.accept` — so we accept any
|
|
15463
|
-
* Headers-like input and do the parsing here.
|
|
15464
|
-
*/
|
|
15465
|
-
/**
|
|
15466
|
-
* `true` when the client signaled it accepts HTML or XHTML. Used by
|
|
15467
|
-
* host adapters to choose between an HTML `/blocked` rewrite (browsers)
|
|
15468
|
-
* and a JSON 4xx response (curl, fetch-from-a-tool, ChatGPT-User).
|
|
15469
|
-
*
|
|
15470
|
-
* Loose match — q-values, parameters, and additional MIME types are
|
|
15471
|
-
* allowed. The spec's q-value precedence (RFC 9110 § 12.5.1) doesn't
|
|
15472
|
-
* matter here; we only care whether HTML is present at all.
|
|
15473
|
-
*
|
|
15474
|
-
* Accepts:
|
|
15475
|
-
* - a `Headers` instance (Web Fetch API; Next.js, Hono, Cloudflare)
|
|
15476
|
-
* - a plain `Record<string, string>` (Express, Connect, Fastify)
|
|
15477
|
-
* - a single string (caller already extracted the Accept value)
|
|
15478
|
-
* - `undefined` (treated as no-HTML)
|
|
15479
|
-
*/
|
|
15480
|
-
function acceptsHtml(input) {
|
|
15481
|
-
const accept = extractAccept(input);
|
|
15482
|
-
if (!accept) return false;
|
|
15483
|
-
return accept.includes("text/html") || accept.includes("application/xhtml+xml");
|
|
15484
|
-
}
|
|
15485
|
-
function extractAccept(input) {
|
|
15486
|
-
if (!input) return void 0;
|
|
15487
|
-
if (typeof input === "string") return input;
|
|
15488
|
-
if (typeof input.get === "function") return input.get("accept") ?? void 0;
|
|
15489
|
-
const rec = input;
|
|
15490
|
-
const value = rec.accept ?? rec.Accept;
|
|
15491
|
-
if (Array.isArray(value)) return value.join(",");
|
|
15492
|
-
return value;
|
|
15493
|
-
}
|
|
15494
|
-
|
|
15495
|
-
//#endregion
|
|
15496
|
-
//#region src/host-adapter/decision-mapping.ts
|
|
15497
|
-
/**
|
|
15498
|
-
* Path the `/blocked` dashboard route lives at. HTML clients that hit
|
|
15499
|
-
* a 4xx verdict get rewritten here at status 200 so the page renders
|
|
15500
|
-
* with the verdict cookie set and Sonner can pick up the toast.
|
|
15501
|
-
*
|
|
15502
|
-
* Hard-coded by convention; if a customer ever needs a custom path,
|
|
15503
|
-
* pass it through `CheckpointConfig.blockedPath` and override in the
|
|
15504
|
-
* host adapter (not in this lookup).
|
|
15505
|
-
*/
|
|
15506
|
-
const BLOCKED_PATH = "/blocked";
|
|
15507
|
-
/**
|
|
15508
|
-
* Classify a `RenderedResponse` into one of the four host-adapter
|
|
15509
|
-
* branches. `clientAcceptsHtml` comes from `acceptsHtml()` in
|
|
15510
|
-
* `content-negotiation.ts`.
|
|
15511
|
-
*/
|
|
15512
|
-
function classifyResponseShape(rendered, clientAcceptsHtml) {
|
|
15513
|
-
if (rendered.status === null) return "pass-through";
|
|
15514
|
-
if (rendered.status === 302 && rendered.headers.Location) return "redirect";
|
|
15515
|
-
if (clientAcceptsHtml && rendered.status >= 400 && rendered.status < 500) return "html-block";
|
|
15516
|
-
return "json-block";
|
|
15517
|
-
}
|
|
15518
|
-
|
|
15519
|
-
//#endregion
|
|
15520
|
-
//#region src/host-adapter/fetcher-envelope.ts
|
|
15521
|
-
/**
|
|
15522
|
-
* Dual-envelope selection predicate (draft-kya-http-02 §8.1 fetcher-200).
|
|
15523
|
-
*
|
|
15524
|
-
* AI-agent fetchers (Claude-User WebFetch, ChatGPT) collapse 4xx/5xx
|
|
15525
|
-
* responses and never surface the body to the LLM, so the §8.1 step-up
|
|
15526
|
-
* challenge served at 401 is invisible. The fix is a dual envelope: keep
|
|
15527
|
-
* the spec 401 for capable/discovery clients, and serve a body-readable
|
|
15528
|
-
* HTTP 200 (no `WWW-Authenticate`) for cooperative, self-identifying
|
|
15529
|
-
* agents so they can read the body + relay the consent link.
|
|
15530
|
-
*
|
|
15531
|
-
* `serveBodyReadable200` is the shared selection predicate every TS PEP
|
|
15532
|
-
* (checkpoint-nextjs, checkpoint-express / wasm-runtime) consults when its
|
|
15533
|
-
* challenge-emission mode is `negotiated`. Centralising it here — rather
|
|
15534
|
-
* than re-implementing per PEP — makes drift structurally impossible; the
|
|
15535
|
-
* fetcher-200 fixture freezes envelope BYTES, this function freezes the
|
|
15536
|
-
* SELECTION.
|
|
15537
|
-
*
|
|
15538
|
-
* **This is a cooperative-UX bridge, NOT an access control.** A spoofer
|
|
15539
|
-
* that hides its identity and does not opt in simply receives the spec
|
|
15540
|
-
* 401 (and the original body-drop). Access is still gated entirely by the
|
|
15541
|
-
* unchanged detection + delegation verification — never by which envelope
|
|
15542
|
-
* is selected.
|
|
15543
|
-
*/
|
|
15544
|
-
/**
|
|
15545
|
-
* Durable opt-in header — the primary, framework-agnostic signal that a
|
|
15546
|
-
* caller is a cooperative agent able to handle the 200 fetcher envelope.
|
|
15547
|
-
* Any non-empty value counts as opt-in (value semantics are reconciled
|
|
15548
|
-
* with mcp-i-cloudflare's `KYA-Accept-Challenge: delegation` in the spec).
|
|
15549
|
-
*/
|
|
15550
|
-
const ACCEPT_CHALLENGE_HEADER = "kya-accept-challenge";
|
|
15551
|
-
function readHeader(input, name) {
|
|
15552
|
-
if (!input) return void 0;
|
|
15553
|
-
if (typeof input.get === "function") return input.get(name) ?? void 0;
|
|
15554
|
-
const rec = input;
|
|
15555
|
-
const lower = name.toLowerCase();
|
|
15556
|
-
for (const key of Object.keys(rec)) if (key.toLowerCase() === lower) {
|
|
15557
|
-
const v = rec[key];
|
|
15558
|
-
return Array.isArray(v) ? v[0] : v ?? void 0;
|
|
15559
|
-
}
|
|
15560
|
-
}
|
|
15561
|
-
/**
|
|
15562
|
-
* Decide whether a `negotiated`-mode PEP should serve the body-readable
|
|
15563
|
-
* HTTP 200 fetcher envelope (`true`) or the spec 401 (`false`).
|
|
15564
|
-
*
|
|
15565
|
-
* Serve 200 when EITHER:
|
|
15566
|
-
* 1. the caller opts in via a non-empty `KYA-Accept-Challenge` header
|
|
15567
|
-
* (the durable, primary signal), OR
|
|
15568
|
-
* 2. detection classifies the caller as an AI agent — BOTH `isAgent` and
|
|
15569
|
-
* `detectionClass === 'ai_agent'` must agree (a transitional UA heuristic,
|
|
15570
|
-
* retired as frameworks adopt the header).
|
|
15571
|
-
*
|
|
15572
|
-
* Otherwise serve the 401 — spoofers, silent, discovery, and OAuth
|
|
15573
|
-
* clients all land here, which is acceptable because this is UX, not a
|
|
15574
|
-
* security boundary.
|
|
15575
|
-
*
|
|
15576
|
-
* Requiring both `isAgent` AND the `ai_agent` class to fire the heuristic
|
|
15577
|
-
* mirrors .NET `IsInteractiveAiAgent` (`IsAgent && DetectionClass.Type ==
|
|
15578
|
-
* AiAgent`) and the gateway worker, so the cross-PEP selection cannot drift on
|
|
15579
|
-
* the pathological case where the two signals disagree (class says agent,
|
|
15580
|
-
* `isAgent` says no): that caller is treated as non-cooperative (spec 401),
|
|
15581
|
-
* never demoted past it. In normal engine output the two signals agree, so
|
|
15582
|
-
* who-gets-200 is unchanged for real traffic.
|
|
15583
|
-
*
|
|
15584
|
-
* @param headers request headers (for the opt-in signal)
|
|
15585
|
-
* @param detectionClass the caller's detection class in any representation
|
|
15586
|
-
* the engine produces (a `DetectionClass` object, the
|
|
15587
|
-
* `ai_agent` wire string, or absent)
|
|
15588
|
-
* @param isAgent the engine's `isAgent` verdict — gates the `ai_agent`
|
|
15589
|
-
* heuristic so a class/`isAgent` disagreement gets the 401
|
|
15590
|
-
*/
|
|
15591
|
-
function serveBodyReadable200(headers, detectionClass, isAgent) {
|
|
15592
|
-
const optIn = readHeader(headers, ACCEPT_CHALLENGE_HEADER);
|
|
15593
|
-
if (optIn && optIn.trim().length > 0) return true;
|
|
15594
|
-
if (isAgent && detectionClass !== void 0 && detectionClass !== null) {
|
|
15595
|
-
if (normalizeDetectionClassEnum(detectionClass) === "ai_agent") return true;
|
|
15596
|
-
}
|
|
15597
|
-
return false;
|
|
15598
|
-
}
|
|
15599
|
-
/**
|
|
15600
|
-
* Resolve the challenge-emission mode + request signals into the single
|
|
15601
|
-
* boolean each PEP needs: serve the body-readable 200 (`true`) or the spec
|
|
15602
|
-
* 401 (`false`). Centralising the mode gate here — not just the predicate —
|
|
15603
|
-
* keeps the rollout switch identical across every TS PEP.
|
|
15604
|
-
*/
|
|
15605
|
-
function selectBodyReadable200(mode, headers, detectionClass, isAgent) {
|
|
15606
|
-
if (mode === "always-200") return true;
|
|
15607
|
-
if (mode === "negotiated") return serveBodyReadable200(headers, detectionClass, isAgent);
|
|
15608
|
-
return false;
|
|
15609
|
-
}
|
|
15610
|
-
|
|
15611
|
-
//#endregion
|
|
15612
|
-
//#region src/mcpi/kya-http-error-codes.ts
|
|
15613
|
-
/**
|
|
15614
|
-
* KYA-HTTP error code registry — draft-kya-http-02 §9 / H1.2 (#3245).
|
|
15615
|
-
*
|
|
15616
|
-
* The `kyaos/*` strings are wire constants returned in the `error` field of a
|
|
15617
|
-
* KYA-HTTP failure response (and mapped to an HTTP status). Emitters MUST use
|
|
15618
|
-
* these EXACT bytes; consumers MAY additionally accept the legacy `kya/*`
|
|
15619
|
-
* spellings for one transition cycle.
|
|
15620
|
-
*
|
|
15621
|
-
* The single source of truth is the golden fixture
|
|
15622
|
-
* `packages/checkpoint-shared/fixtures/kya-http/error-codes.json`; the parity
|
|
15623
|
-
* test in `__tests__/kya-http-error-codes.test.ts` reads that JSON via `fs` and
|
|
15624
|
-
* asserts this map is byte-exact against it (no drift, no omissions).
|
|
15625
|
-
*
|
|
15626
|
-
* `as const satisfies Record<string, \`kyaos/${string}\`>` keeps the narrow
|
|
15627
|
-
* literal value types (so consumers get autocomplete and a compile error on a
|
|
15628
|
-
* typo'd code) while still proving every value is a well-formed `kyaos/…` string.
|
|
15629
|
-
*/
|
|
15630
|
-
const KYA_HTTP_ERROR = {
|
|
15631
|
-
MISSING_SIGNATURE: "kyaos/missing-signature",
|
|
15632
|
-
INVALID_SIGNATURE: "kyaos/invalid-signature",
|
|
15633
|
-
EXPIRED: "kyaos/expired",
|
|
15634
|
-
REPLAY: "kyaos/replay",
|
|
15635
|
-
DID_UNRESOLVABLE: "kyaos/did-unresolvable",
|
|
15636
|
-
AUTHORIZATION_REQUIRED: "kyaos/authorization-required",
|
|
15637
|
-
PROFILE_VIOLATION: "kyaos/profile-violation",
|
|
15638
|
-
DELEGATION_REVOKED: "kyaos/delegation-revoked",
|
|
15639
|
-
SCOPE_INSUFFICIENT: "kyaos/scope-insufficient",
|
|
15640
|
-
CHAIN_BROKEN: "kyaos/chain-broken",
|
|
15641
|
-
HOLDER_MISMATCH: "kyaos/holder-mismatch",
|
|
15642
|
-
AUDIENCE_MISMATCH: "kyaos/audience-mismatch",
|
|
15643
|
-
SESSION_MISMATCH: "kyaos/session-mismatch",
|
|
15644
|
-
PICKUP_PINNED: "kyaos/pickup-pinned",
|
|
15645
|
-
ASSURANCE_INSUFFICIENT: "kyaos/assurance-insufficient",
|
|
15646
|
-
STATUS_PENDING: "kyaos/status-pending",
|
|
15647
|
-
AUTHORIZATION_HOST_UNAVAILABLE: "kyaos/authorization-host-unavailable",
|
|
15648
|
-
REPLAY_STATE_UNAVAILABLE: "kyaos/replay-state-unavailable",
|
|
15649
|
-
REPLAY_CAPACITY: "kyaos/replay-capacity",
|
|
15650
|
-
INVALID_SESSION: "kyaos/invalid-session",
|
|
15651
|
-
PICKUP_EXPIRED: "kyaos/pickup-expired"
|
|
15652
|
-
};
|
|
15653
|
-
/**
|
|
15654
|
-
* The HTTP status the registry assigns each code (draft-kya-http-02 §9).
|
|
15655
|
-
* Mirrors `error-codes.json` exactly, pinned by `__tests__/kya-http-error-codes.test.ts`,
|
|
15656
|
-
* and matches the engine's own table (`rust/crates/kya-os-engine/src/render/kya_error.rs`).
|
|
15657
|
-
*/
|
|
15658
|
-
const KYA_HTTP_ERROR_STATUS = {
|
|
15659
|
-
[KYA_HTTP_ERROR.MISSING_SIGNATURE]: 401,
|
|
15660
|
-
[KYA_HTTP_ERROR.INVALID_SIGNATURE]: 401,
|
|
15661
|
-
[KYA_HTTP_ERROR.EXPIRED]: 401,
|
|
15662
|
-
[KYA_HTTP_ERROR.REPLAY]: 401,
|
|
15663
|
-
[KYA_HTTP_ERROR.DID_UNRESOLVABLE]: 401,
|
|
15664
|
-
[KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED]: 401,
|
|
15665
|
-
[KYA_HTTP_ERROR.PROFILE_VIOLATION]: 403,
|
|
15666
|
-
[KYA_HTTP_ERROR.DELEGATION_REVOKED]: 403,
|
|
15667
|
-
[KYA_HTTP_ERROR.SCOPE_INSUFFICIENT]: 403,
|
|
15668
|
-
[KYA_HTTP_ERROR.CHAIN_BROKEN]: 403,
|
|
15669
|
-
[KYA_HTTP_ERROR.HOLDER_MISMATCH]: 403,
|
|
15670
|
-
[KYA_HTTP_ERROR.AUDIENCE_MISMATCH]: 403,
|
|
15671
|
-
[KYA_HTTP_ERROR.SESSION_MISMATCH]: 403,
|
|
15672
|
-
[KYA_HTTP_ERROR.PICKUP_PINNED]: 403,
|
|
15673
|
-
[KYA_HTTP_ERROR.ASSURANCE_INSUFFICIENT]: 403,
|
|
15674
|
-
[KYA_HTTP_ERROR.STATUS_PENDING]: 503,
|
|
15675
|
-
[KYA_HTTP_ERROR.AUTHORIZATION_HOST_UNAVAILABLE]: 503,
|
|
15676
|
-
[KYA_HTTP_ERROR.REPLAY_STATE_UNAVAILABLE]: 503,
|
|
15677
|
-
[KYA_HTTP_ERROR.REPLAY_CAPACITY]: 429,
|
|
15678
|
-
[KYA_HTTP_ERROR.INVALID_SESSION]: 404,
|
|
15679
|
-
[KYA_HTTP_ERROR.PICKUP_EXPIRED]: 410
|
|
15680
|
-
};
|
|
15681
|
-
|
|
15682
|
-
//#endregion
|
|
15683
|
-
//#region src/host-adapter/challenge-wire.ts
|
|
15684
|
-
/**
|
|
15685
|
-
* Canonical fixture-pinned KYA HTTP challenge-wire builder.
|
|
15686
|
-
*
|
|
15687
|
-
* The builder is transport-neutral and Edge-safe. Hosts must register the
|
|
15688
|
-
* challenge and resolve every URI before calling it; this module validates and
|
|
15689
|
-
* serializes those trusted values without network, database, or request access.
|
|
15690
|
-
*/
|
|
15691
|
-
const PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
|
|
15692
|
-
const DEFAULT_POLL_INTERVAL_S = 3;
|
|
15693
|
-
const INVALID_QUOTED_VALUE = /[\u0000-\u001f\u007f"\\]/;
|
|
15694
|
-
const SCOPE_TOKEN = /^[\x21\x23-\x5b\x5d-\x7e]+$/;
|
|
15695
|
-
const SID = /^kya-[0-9a-f]{16,}$/;
|
|
15696
|
-
const ASSURANCE_TIERS = /* @__PURE__ */ new Set([
|
|
15697
|
-
"anonymous",
|
|
15698
|
-
"attested-bearer",
|
|
15699
|
-
"key-bound",
|
|
15700
|
-
"registered",
|
|
15701
|
-
"delegated"
|
|
15702
|
-
]);
|
|
15703
|
-
/** Typed validation failure raised before any response is materialized. */
|
|
15704
|
-
var ChallengeWireError = class extends TypeError {
|
|
15705
|
-
code;
|
|
15706
|
-
constructor(code, message) {
|
|
15707
|
-
super(message);
|
|
15708
|
-
this.name = "ChallengeWireError";
|
|
15709
|
-
this.code = code;
|
|
15710
|
-
}
|
|
15711
|
-
};
|
|
15712
|
-
/** Generate a 128-bit, lower-case hexadecimal challenge id. */
|
|
15713
|
-
function generateDelegationSid() {
|
|
15714
|
-
const bytes = /* @__PURE__ */ new Uint8Array(16);
|
|
15715
|
-
crypto.getRandomValues(bytes);
|
|
15716
|
-
let hex = "";
|
|
15717
|
-
for (const byte of bytes) hex += byte.toString(16).padStart(2, "0");
|
|
15718
|
-
return `kya-${hex}`;
|
|
15719
|
-
}
|
|
15720
|
-
/** Derive pickup from the registered consent origin, never request Host. */
|
|
15721
|
-
function deriveDelegationPickupUri(consentUri, sid) {
|
|
15722
|
-
const consent = parseHttpsUrl("consentUri", consentUri);
|
|
15723
|
-
assertQuotedValue("sid", sid, "invalid-sid");
|
|
15724
|
-
return `${consent.origin}/api/delegation/pickup/${sid}`;
|
|
15725
|
-
}
|
|
15726
|
-
/** Build the byte-pinned Delegation authentication field value. */
|
|
15727
|
-
function buildDelegationChallengeHeader(input) {
|
|
15728
|
-
const normalized = validateInput(input);
|
|
15729
|
-
const params = [
|
|
15730
|
-
["realm", normalized.realm],
|
|
15731
|
-
["sid", normalized.sid],
|
|
15732
|
-
["consent_uri", normalized.consentUri],
|
|
15733
|
-
["pickup_uri", normalized.pickupUri]
|
|
15734
|
-
];
|
|
15735
|
-
if (normalized.requiredScopes.length > 0) params.push(["scope", normalized.requiredScopes.join(" ")]);
|
|
15736
|
-
if (normalized.minAssurance) params.push(["min_assurance", normalized.minAssurance]);
|
|
15737
|
-
if (input.pollIntervalS !== void 0) params.push(["interval", String(normalized.pollIntervalS)]);
|
|
15738
|
-
params.push(["kind", normalized.kind]);
|
|
15739
|
-
return `Delegation ${params.map(([name, value]) => `${name}="${value}"`).join(", ")}`;
|
|
15740
|
-
}
|
|
15741
|
-
/** Build RFC 9728 Bearer discovery for a protected-resource realm. */
|
|
15742
|
-
function buildDelegationBearerHeader(realm) {
|
|
15743
|
-
assertRealm(realm);
|
|
15744
|
-
return `Bearer resource_metadata="https://${realm}${PROTECTED_RESOURCE_METADATA_PATH}"`;
|
|
15745
|
-
}
|
|
15746
|
-
/** Build the four required machine-followable delegation instruction elements. */
|
|
15747
|
-
function buildDelegationInstructions(consentUri, pickupUri, pollIntervalS) {
|
|
15748
|
-
return `This action requires human authorization. First establish your pickup binding at ${pickupUri}. If you can sign HTTP requests, sign each poll with an ephemeral did:key; otherwise generate one random 32-byte token encoded as unpadded base64url and send it as X-KYA-Pickup-Token on EVERY poll. After receiving 202 pending, show your user this link and ask them to approve: ${consentUri}. Continue polling ${pickupUri} every ${pollIntervalS} seconds with the same binding. When the response status is 200, take the 'delegation' value and retry your original request with header 'Authorization: Bearer <delegation>'.`;
|
|
15749
|
-
}
|
|
15750
|
-
/** Build the proof-bound body shared byte-for-byte by both HTTP envelopes. */
|
|
15751
|
-
function buildDelegationChallengeBody(input) {
|
|
15752
|
-
const normalized = validateInput(input);
|
|
15753
|
-
const common = {
|
|
15754
|
-
sid: normalized.sid,
|
|
15755
|
-
consent_uri: normalized.consentUri,
|
|
15756
|
-
pickup_uri: normalized.pickupUri,
|
|
15757
|
-
...normalized.requiredScopes.length > 0 ? { required_scopes: [...normalized.requiredScopes] } : {},
|
|
15758
|
-
...normalized.minAssurance ? { min_assurance: normalized.minAssurance } : {},
|
|
15759
|
-
poll_interval_s: normalized.pollIntervalS,
|
|
15760
|
-
challenge_proof: input.challengeProof
|
|
15761
|
-
};
|
|
15762
|
-
if (normalized.kind === "approval_quorum") return {
|
|
15763
|
-
error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
|
|
15764
|
-
kyaos: {
|
|
15765
|
-
sid: common.sid,
|
|
15766
|
-
kind: "approval_quorum",
|
|
15767
|
-
quorum: normalized.quorum,
|
|
15768
|
-
action_nonce: normalized.actionNonce,
|
|
15769
|
-
consent_uri: common.consent_uri,
|
|
15770
|
-
pickup_uri: common.pickup_uri,
|
|
15771
|
-
...common.required_scopes ? { required_scopes: common.required_scopes } : {},
|
|
15772
|
-
...common.min_assurance ? { min_assurance: common.min_assurance } : {},
|
|
15773
|
-
poll_interval_s: common.poll_interval_s,
|
|
15774
|
-
challenge_proof: common.challenge_proof
|
|
15775
|
-
},
|
|
15776
|
-
instructions: buildApprovalQuorumInstructions(normalized)
|
|
15777
|
-
};
|
|
15778
|
-
return {
|
|
15779
|
-
error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
|
|
15780
|
-
kyaos: {
|
|
15781
|
-
...common,
|
|
15782
|
-
action: {
|
|
15783
|
-
type: "delegation",
|
|
15784
|
-
consent_uri: normalized.consentUri,
|
|
15785
|
-
pickup_uri: normalized.pickupUri,
|
|
15786
|
-
poll_interval_s: normalized.pollIntervalS,
|
|
15787
|
-
pin: { header: "X-KYA-Pickup-Token" },
|
|
15788
|
-
retry: {
|
|
15789
|
-
header: "Authorization",
|
|
15790
|
-
scheme: "Bearer",
|
|
15791
|
-
value_from: "delegation"
|
|
15792
|
-
}
|
|
15793
|
-
}
|
|
15794
|
-
},
|
|
15795
|
-
instructions: buildDelegationInstructions(normalized.consentUri, normalized.pickupUri, normalized.pollIntervalS)
|
|
15796
|
-
};
|
|
15797
|
-
}
|
|
15798
|
-
/** Build either the canonical 401 or its body-identical fetcher-200 envelope. */
|
|
15799
|
-
function buildDelegationChallengeEnvelope(input, mode = "spec-401") {
|
|
15800
|
-
const normalized = validateInput(input);
|
|
15801
|
-
if (normalized.kind === "approval_quorum" && mode === "fetcher-200") throw new ChallengeWireError("unsupported-envelope", "fetcher-200 is not fixture-defined for approval_quorum");
|
|
15802
|
-
const body = buildDelegationChallengeBody(input);
|
|
15803
|
-
if (normalized.kind === "approval_quorum") return {
|
|
15804
|
-
status: 401,
|
|
15805
|
-
headers: [
|
|
15806
|
-
["WWW-Authenticate", buildDelegationChallengeHeader(input)],
|
|
15807
|
-
["Retry-After", String(normalized.pollIntervalS)],
|
|
15808
|
-
["Content-Type", "application/json"],
|
|
15809
|
-
["Cache-Control", "no-store"]
|
|
15810
|
-
],
|
|
15811
|
-
body
|
|
15812
|
-
};
|
|
15813
|
-
const hintHeaders = [
|
|
15814
|
-
["Content-Type", "application/json"],
|
|
15815
|
-
["Cache-Control", "no-store"],
|
|
15816
|
-
["KYA-Auth-Required", "true"],
|
|
15817
|
-
["KYA-Auth-Url", normalized.consentUri],
|
|
15818
|
-
["Link", `<${normalized.consentUri}>; rel="kya-authorize"`],
|
|
15819
|
-
["KYA-Action", "challenge"]
|
|
15820
|
-
];
|
|
15821
|
-
if (mode === "fetcher-200") return {
|
|
15822
|
-
status: 200,
|
|
15823
|
-
headers: hintHeaders,
|
|
15824
|
-
body
|
|
15825
|
-
};
|
|
15826
|
-
return {
|
|
15827
|
-
status: 401,
|
|
15828
|
-
headers: [
|
|
15829
|
-
["WWW-Authenticate", buildDelegationChallengeHeader(input)],
|
|
15830
|
-
["WWW-Authenticate", `Bearer resource_metadata="${normalized.resourceMetadataUri}"`],
|
|
15831
|
-
["Retry-After", String(normalized.pollIntervalS)],
|
|
15832
|
-
...hintHeaders
|
|
15833
|
-
],
|
|
15834
|
-
body
|
|
15835
|
-
};
|
|
15836
|
-
}
|
|
15837
|
-
/** Preferred generic name; the legacy export remains for host compatibility. */
|
|
15838
|
-
const buildChallengeWire = buildDelegationChallengeEnvelope;
|
|
15839
|
-
function validateInput(input) {
|
|
15840
|
-
assertRealm(input.realm);
|
|
15841
|
-
assertQuotedValue("sid", input.sid, "invalid-sid");
|
|
15842
|
-
if (!SID.test(input.sid)) throw new ChallengeWireError("invalid-sid", "sid must start with kya- and contain at least 64 bits of lower-case hexadecimal entropy");
|
|
15843
|
-
const consent = parseHttpsUrl("consentUri", input.consentUri);
|
|
15844
|
-
const pickup = parseHttpsUrl("pickupUri", input.pickupUri);
|
|
15845
|
-
const expectedPickup = `${consent.origin}/api/delegation/pickup/${input.sid}`;
|
|
15846
|
-
if (pickup.href !== expectedPickup) throw new ChallengeWireError("invalid-uri", "pickupUri must use the registered consent origin and sid");
|
|
15847
|
-
const pollIntervalS = input.pollIntervalS ?? DEFAULT_POLL_INTERVAL_S;
|
|
15848
|
-
if (!Number.isInteger(pollIntervalS) || pollIntervalS < 1 || pollIntervalS > 999) throw new ChallengeWireError("invalid-interval", "pollIntervalS must be an integer from 1 through 999");
|
|
15849
|
-
if (input.challengeProof === void 0 || input.challengeProof === null) throw new ChallengeWireError("invalid-proof", "challengeProof is required");
|
|
15850
|
-
const requiredScopes = input.requiredScopes ?? [];
|
|
15851
|
-
for (const scope of requiredScopes) if (!SCOPE_TOKEN.test(scope)) throw new ChallengeWireError("invalid-scope", `invalid required scope: ${scope}`);
|
|
15852
|
-
if (input.minAssurance && !ASSURANCE_TIERS.has(input.minAssurance)) throw new ChallengeWireError("invalid-assurance", `invalid minAssurance: ${input.minAssurance}`);
|
|
15853
|
-
const kind = input.kind ?? "delegation";
|
|
15854
|
-
if (kind !== "delegation" && kind !== "approval_quorum") throw new ChallengeWireError("invalid-kind", `unsupported challenge kind: ${String(kind)}`);
|
|
15855
|
-
let resourceMetadataUri;
|
|
15856
|
-
let quorum;
|
|
15857
|
-
let actionNonce;
|
|
15858
|
-
if (kind === "delegation") {
|
|
15859
|
-
resourceMetadataUri = parseHttpsUrl("resourceMetadataUri", input.resourceMetadataUri).href;
|
|
15860
|
-
const expectedMetadata = `https://${input.realm}${PROTECTED_RESOURCE_METADATA_PATH}`;
|
|
15861
|
-
if (resourceMetadataUri !== expectedMetadata) throw new ChallengeWireError("invalid-uri", "resourceMetadataUri must be the protected resource RFC 9728 metadata URL");
|
|
15862
|
-
} else {
|
|
15863
|
-
const approval = input;
|
|
15864
|
-
quorum = approval.quorum;
|
|
15865
|
-
actionNonce = approval.actionNonce;
|
|
15866
|
-
if (!Number.isInteger(quorum) || quorum < 1) throw new ChallengeWireError("invalid-quorum", "quorum must be a positive integer");
|
|
15867
|
-
assertQuotedValue("actionNonce", actionNonce, "invalid-action-nonce");
|
|
15868
|
-
}
|
|
15869
|
-
return {
|
|
15870
|
-
realm: input.realm,
|
|
15871
|
-
sid: input.sid,
|
|
15872
|
-
consentUri: consent.href,
|
|
15873
|
-
pickupUri: pickup.href,
|
|
15874
|
-
resourceMetadataUri,
|
|
15875
|
-
requiredScopes,
|
|
15876
|
-
pollIntervalS,
|
|
15877
|
-
minAssurance: input.minAssurance,
|
|
15878
|
-
kind,
|
|
15879
|
-
quorum,
|
|
15880
|
-
actionNonce
|
|
15881
|
-
};
|
|
15882
|
-
}
|
|
15883
|
-
function buildApprovalQuorumInstructions(input) {
|
|
15884
|
-
return `This action requires approval from ${input.quorum} human approvers. Show your user this link to begin the approval process: ${input.consentUri}. Then poll ${input.pickupUri} every ${input.pollIntervalS} seconds (sign polls with an ephemeral did:key, or send one random 32-byte X-KYA-Pickup-Token on EVERY poll). When the response status is 200, retry your original request presenting the returned grants in the KYA-Approvals header.`;
|
|
15885
|
-
}
|
|
15886
|
-
function assertRealm(realm) {
|
|
15887
|
-
assertQuotedValue("realm", realm, "invalid-realm");
|
|
15888
|
-
if (realm.includes("/") || realm.includes("@") || realm.includes("?") || realm.includes("#")) throw new ChallengeWireError("invalid-realm", "realm must be a host with an optional port");
|
|
15889
|
-
try {
|
|
15890
|
-
if (new URL(`https://${realm}`).host !== realm) throw new Error("invalid authority");
|
|
15891
|
-
} catch {
|
|
15892
|
-
throw new ChallengeWireError("invalid-realm", "realm must be a valid host with an optional port");
|
|
15893
|
-
}
|
|
15894
|
-
}
|
|
15895
|
-
function assertQuotedValue(name, value, code) {
|
|
15896
|
-
if (typeof value !== "string" || value.length === 0 || INVALID_QUOTED_VALUE.test(value)) throw new ChallengeWireError(code, `${name} contains characters unsafe for an HTTP quoted-string`);
|
|
15897
|
-
}
|
|
15898
|
-
function parseHttpsUrl(name, value) {
|
|
15899
|
-
assertQuotedValue(name, value, "invalid-uri");
|
|
15900
|
-
let parsed;
|
|
15901
|
-
try {
|
|
15902
|
-
parsed = new URL(value);
|
|
15903
|
-
} catch {
|
|
15904
|
-
throw new ChallengeWireError("invalid-uri", `${name} must be an absolute HTTPS URL`);
|
|
15905
|
-
}
|
|
15906
|
-
if (parsed.protocol !== "https:" || parsed.username || parsed.password) throw new ChallengeWireError("invalid-uri", `${name} must be an absolute HTTPS URL without credentials`);
|
|
15907
|
-
return parsed;
|
|
15908
|
-
}
|
|
15909
|
-
|
|
15910
|
-
//#endregion
|
|
15911
|
-
//#region src/host-adapter/challenge-context.ts
|
|
15912
|
-
const DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = 3e3;
|
|
15913
|
-
/**
|
|
15914
|
-
* Resolve and validate registered challenge context at the async host boundary.
|
|
15915
|
-
* Resolver failures become an absent context so the renderer can emit the
|
|
15916
|
-
* canonical retryable status-pending response; secrets and proof values are
|
|
15917
|
-
* never included in failure events.
|
|
15918
|
-
*/
|
|
15919
|
-
async function resolveChallengeContext(resolver, context, options = {}) {
|
|
15920
|
-
if (!resolver) return void 0;
|
|
15921
|
-
const timeoutMs = options.timeoutMs ?? 3e3;
|
|
15922
|
-
if (!Number.isInteger(timeoutMs) || timeoutMs < 1) throw new TypeError("challenge context timeout must be a positive integer");
|
|
15923
|
-
let timeoutId;
|
|
15924
|
-
try {
|
|
15925
|
-
const value = await Promise.race([Promise.resolve(resolver(context)), new Promise((_resolve, reject) => {
|
|
15926
|
-
timeoutId = setTimeout(() => reject(new ChallengeContextTimeoutError(timeoutMs)), timeoutMs);
|
|
15927
|
-
})]);
|
|
15928
|
-
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
15929
|
-
if (!value) return void 0;
|
|
15930
|
-
try {
|
|
15931
|
-
buildChallengeWire(value, "spec-401");
|
|
15932
|
-
return value;
|
|
15933
|
-
} catch (error) {
|
|
15934
|
-
options.onFailure?.({
|
|
15935
|
-
reason: "invalid-context",
|
|
15936
|
-
message: error.message
|
|
15937
|
-
});
|
|
15938
|
-
return;
|
|
15939
|
-
}
|
|
15940
|
-
} catch (error) {
|
|
15941
|
-
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
15942
|
-
options.onFailure?.({
|
|
15943
|
-
reason: error instanceof ChallengeContextTimeoutError ? "timeout" : "resolver-error",
|
|
15944
|
-
message: error instanceof ChallengeContextTimeoutError ? error.message : "challenge context resolver failed"
|
|
15945
|
-
});
|
|
15946
|
-
return;
|
|
15947
|
-
}
|
|
15948
|
-
}
|
|
15949
|
-
var ChallengeContextTimeoutError = class extends Error {
|
|
15950
|
-
constructor(timeoutMs) {
|
|
15951
|
-
super(`challenge context resolution exceeded ${timeoutMs}ms`);
|
|
15952
|
-
this.name = "ChallengeContextTimeoutError";
|
|
15953
|
-
}
|
|
15954
|
-
};
|
|
15955
|
-
|
|
15956
15461
|
//#endregion
|
|
15957
15462
|
//#region src/wire/vault.ts
|
|
15958
15463
|
/**
|
|
@@ -16079,9 +15584,9 @@ function deriveMcpiOrgKid(slug) {
|
|
|
16079
15584
|
* surface stay unchanged.
|
|
16080
15585
|
*
|
|
16081
15586
|
* Throws on an invalid slug (same boundary as {@link deriveMcpiOrgDid}) rather
|
|
16082
|
-
* than returning `[]`: an empty list
|
|
16083
|
-
*
|
|
16084
|
-
*
|
|
15587
|
+
* than returning `[]`: an empty list makes the engine reject every delegation,
|
|
15588
|
+
* so an org with a broken slug is a configuration error to surface loudly
|
|
15589
|
+
* server-side, not a silent outage of every delegated agent.
|
|
16085
15590
|
*/
|
|
16086
15591
|
function resolveTrustedDelegationRoots(org) {
|
|
16087
15592
|
return [deriveMcpiOrgDid(org.slug)];
|
|
@@ -16098,53 +15603,6 @@ function deriveMcpiUserDid(slug, userId) {
|
|
|
16098
15603
|
return `${deriveMcpiOrgDid(slug)}:users:${userId}`;
|
|
16099
15604
|
}
|
|
16100
15605
|
|
|
16101
|
-
//#endregion
|
|
16102
|
-
//#region src/mcpi/delegation-headers.ts
|
|
16103
|
-
/**
|
|
16104
|
-
* Delegation-proof request detection (P2 / DR-1).
|
|
16105
|
-
*
|
|
16106
|
-
* The engine's L2 delegation-root pinning (`ContextSpec.trustedDelegationRoots`)
|
|
16107
|
-
* is only consulted when a request actually carries a delegation credential.
|
|
16108
|
-
* Every consumer surface — the Cloudflare gateway worker, the published SDK
|
|
16109
|
-
* middleware (Next.js / Express), and the Next.js detector route — uses this one
|
|
16110
|
-
* check to decide whether to resolve + inject the org's trusted roots, so the
|
|
16111
|
-
* human / no-delegation hot path stays a precise no-op.
|
|
16112
|
-
*
|
|
16113
|
-
* Keeping the header set here (rather than re-listing the literals at each site)
|
|
16114
|
-
* is the whole point: a new delegation transport header is added in one place
|
|
16115
|
-
* and every verifier surface agrees.
|
|
16116
|
-
*/
|
|
16117
|
-
/**
|
|
16118
|
-
* Lowercased delegation-proof header names. `kya-os-delegation-credential` is the
|
|
16119
|
-
* canonical KYA-OS transport; `kya-delegation` is the legacy envelope form still
|
|
16120
|
-
* accepted via `legacyEnvelopeFallback`.
|
|
16121
|
-
*/
|
|
16122
|
-
const DELEGATION_PROOF_HEADERS = ["kya-os-delegation-credential", "kya-delegation"];
|
|
16123
|
-
/** A header value is "present" when it is a non-empty string (or non-empty list). */
|
|
16124
|
-
function isPresent(value) {
|
|
16125
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
16126
|
-
return typeof value === "string" && value.length > 0;
|
|
16127
|
-
}
|
|
16128
|
-
/**
|
|
16129
|
-
* Does the request carry a KYA-OS delegation-proof header?
|
|
16130
|
-
*
|
|
16131
|
-
* Accepts either a `Headers` instance (Next.js / fetch — case-insensitive
|
|
16132
|
-
* lookup) or a plain header record (raw Node/Express headers, gateway worker's
|
|
16133
|
-
* lowercased map). Record keys are matched case-insensitively, so callers do not
|
|
16134
|
-
* need to pre-normalize. Returns `false` for `null`/`undefined`.
|
|
16135
|
-
*/
|
|
16136
|
-
function requestCarriesDelegationProof(headers) {
|
|
16137
|
-
if (!headers) return false;
|
|
16138
|
-
if (typeof headers.get === "function") {
|
|
16139
|
-
const h = headers;
|
|
16140
|
-
return DELEGATION_PROOF_HEADERS.some((name) => isPresent(h.get(name)));
|
|
16141
|
-
}
|
|
16142
|
-
const record = headers;
|
|
16143
|
-
const lowerKeyed = /* @__PURE__ */ new Map();
|
|
16144
|
-
for (const key of Object.keys(record)) lowerKeyed.set(key.toLowerCase(), record[key]);
|
|
16145
|
-
return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));
|
|
16146
|
-
}
|
|
16147
|
-
|
|
16148
15606
|
//#endregion
|
|
16149
15607
|
//#region src/mcpi/principal.ts
|
|
16150
15608
|
/**
|
|
@@ -16382,24 +15840,6 @@ const DelegationVerifiedBySchema = _enum([
|
|
|
16382
15840
|
"checkpoint"
|
|
16383
15841
|
]);
|
|
16384
15842
|
/**
|
|
16385
|
-
* Max length of a registered session anchor (`sid`) accepted on the wire and
|
|
16386
|
-
* enforced again at the customer route. The join partner
|
|
16387
|
-
* `bouncer_sessions.id` is `varchar(100)`; `detections.registered_sid` stays
|
|
16388
|
-
* `text` (converting a live column to `varchar` would take an ACCESS EXCLUSIVE
|
|
16389
|
-
* rewrite of the hottest table), so this constant is the width contract
|
|
16390
|
-
* instead of the column type.
|
|
16391
|
-
*/
|
|
16392
|
-
const REGISTERED_SID_MAX_LENGTH = 100;
|
|
16393
|
-
/**
|
|
16394
|
-
* The one delegation result that may attribute a `sid` to a session timeline.
|
|
16395
|
-
* A rejected presentation carries no engine-emitted sid, and a sid on a
|
|
16396
|
-
* `failed` / `not_presented` report is attacker-shaped, so ingest stamps
|
|
16397
|
-
* `registered_sid` only for this result and nulls it otherwise (D4 / D15).
|
|
16398
|
-
* One member on purpose: Section 13 of the plan records how an explicitly
|
|
16399
|
-
* unverified-labeled `failed` could join it later.
|
|
16400
|
-
*/
|
|
16401
|
-
const SID_ATTRIBUTABLE_RESULT = "verified";
|
|
16402
|
-
/**
|
|
16403
15843
|
* The delegation the agent presented (a reference + outcome, not the proof).
|
|
16404
15844
|
* `result` and `verifiedBy` are required; the JWT claims (`jti` / `iss` / `aud`
|
|
16405
15845
|
* / `capabilities` / `exp`) are optional because `not_presented` carries none.
|
|
@@ -18293,11 +17733,82 @@ const TrackingReadinessSchema = object({
|
|
|
18293
17733
|
}).strict())
|
|
18294
17734
|
}).strict();
|
|
18295
17735
|
|
|
17736
|
+
//#endregion
|
|
17737
|
+
//#region src/api/cli-registration.ts
|
|
17738
|
+
const CLI_PAIRING_PROTOCOL_VERSION = 2;
|
|
17739
|
+
const CLI_PAIRING_UPGRADE_MESSAGE = "Upgrade the KYA-OS CLI and run checkpoint init again. This pairing requires independent terminal proof.";
|
|
17740
|
+
const CliPairingProofSchema = string().regex(/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/);
|
|
17741
|
+
const CLI_PAIRING_FRAMEWORKS = [
|
|
17742
|
+
"nextjs",
|
|
17743
|
+
"express",
|
|
17744
|
+
"static",
|
|
17745
|
+
"unknown"
|
|
17746
|
+
];
|
|
17747
|
+
const readable = string().max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
|
|
17748
|
+
const label = readable.min(1);
|
|
17749
|
+
const hint = string().trim().min(1).max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
|
|
17750
|
+
const uuid = string().uuid();
|
|
17751
|
+
const CliPairingRegisterRequestSchema = object({
|
|
17752
|
+
protocolVersion: literal(2),
|
|
17753
|
+
exchangeChallenge: CliPairingProofSchema,
|
|
17754
|
+
domainHint: hint.optional(),
|
|
17755
|
+
repoName: hint.optional(),
|
|
17756
|
+
framework: _enum(CLI_PAIRING_FRAMEWORKS).optional()
|
|
17757
|
+
}).strict();
|
|
17758
|
+
const CliPairingApprovedClaimSchema = object({
|
|
17759
|
+
userId: uuid,
|
|
17760
|
+
organizationId: uuid,
|
|
17761
|
+
projectId: uuid
|
|
17762
|
+
}).strict();
|
|
17763
|
+
const CliPairingClaimSchema = object({
|
|
17764
|
+
userId: uuid,
|
|
17765
|
+
userEmail: label,
|
|
17766
|
+
userName: readable.nullable(),
|
|
17767
|
+
organizationId: uuid,
|
|
17768
|
+
organizationName: label,
|
|
17769
|
+
organizationSlug: readable.nullable(),
|
|
17770
|
+
projectId: uuid,
|
|
17771
|
+
projectName: label,
|
|
17772
|
+
projectDomain: readable.nullable()
|
|
17773
|
+
}).strict();
|
|
17774
|
+
const CliPairingExchangeRequestSchema = object({
|
|
17775
|
+
protocolVersion: literal(2),
|
|
17776
|
+
registrationId: uuid,
|
|
17777
|
+
exchangeVerifier: CliPairingProofSchema,
|
|
17778
|
+
approvedClaim: CliPairingApprovedClaimSchema
|
|
17779
|
+
}).strict();
|
|
17780
|
+
const CliPairingRegisterDataSchema = object({
|
|
17781
|
+
protocolVersion: literal(2),
|
|
17782
|
+
registrationId: uuid,
|
|
17783
|
+
claimToken: string().regex(/^cliclaim_[a-f0-9]{64}$/),
|
|
17784
|
+
claimUrl: string().url(),
|
|
17785
|
+
confirmationCode: string().regex(/^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$/),
|
|
17786
|
+
expiresAt: string().datetime()
|
|
17787
|
+
}).strict();
|
|
17788
|
+
const CliPairingPrivateStatusDataSchema = discriminatedUnion("status", [object({
|
|
17789
|
+
protocolVersion: literal(2),
|
|
17790
|
+
status: literal("pending"),
|
|
17791
|
+
claimed: _null()
|
|
17792
|
+
}).strict(), object({
|
|
17793
|
+
protocolVersion: literal(2),
|
|
17794
|
+
status: literal("claimed"),
|
|
17795
|
+
claimed: CliPairingClaimSchema
|
|
17796
|
+
}).strict()]);
|
|
17797
|
+
const CliPairingExchangeDataSchema = object({
|
|
17798
|
+
protocolVersion: literal(2),
|
|
17799
|
+
userId: uuid,
|
|
17800
|
+
projectId: uuid,
|
|
17801
|
+
organizationId: uuid,
|
|
17802
|
+
friendlyId: string().nullable(),
|
|
17803
|
+
apiKey: string().regex(/^sk_[a-f0-9]{64}$/),
|
|
17804
|
+
dashboardUrl: string().url()
|
|
17805
|
+
}).strict();
|
|
17806
|
+
|
|
18296
17807
|
//#endregion
|
|
18297
17808
|
//#region src/index.ts
|
|
18298
17809
|
const VERSION = "0.1.0";
|
|
18299
17810
|
const PACKAGE_NAME = "@kya-os/checkpoint-shared";
|
|
18300
17811
|
|
|
18301
17812
|
//#endregion
|
|
18302
|
-
export { A2ARpcEnvelopeSchema, A2ASignedRequestSchema, A2ATaskRequestSchema, A2ATaskSourceConfigSchema, A2ATaskStateSchema, ACCEPT_CHALLENGE_HEADER, ADMIN_DELTA_BASES, ADMIN_OVERVIEW_CACHE_STATUSES, ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT, ADMIN_OVERVIEW_LIST_LIMIT_MAX, ADMIN_OVERVIEW_SECTIONS, ADMIN_OVERVIEW_WINDOWS, AGENT_CATEGORY_META, AI_AGENT_HEADERS, ANALYTICS_ERRORS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, ATTESTED_BEARER_MAX_TTL_SECONDS, AUDIT_ERRORS, AUDIT_PROTOCOL_ERRORS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AUTH_MODES, AcceptanceWithdrawalSchema, AcceptedArtifactRevisionSchema, AccountSchema, AddFingerprintToProfileRequestSchema, AddModelCredentialSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AgentTypeSchema as WasmAgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema$1 as AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, ApplyIdentityIntentSchema, ApproveTaskPublicationSchema, ApprovedTaskPublicationSchema, ArtifactIdentitySchema, AssuranceTierSchema, AuthErrorType, AuthProviderTypeSchema, BARE_ERRORS, BASELINE_ALLOW_POLICY_ID, BESPOKE_POLICY_IDS, BILLING_ERRORS, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BOUNCER_LOWERCASE_ERRORS, BOUNCER_UPPERCASE_ERRORS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BindingStatusSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, CACHE_LIMITS, CACHE_TTL, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CORRELATION_ID_HEADER, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, ChallengeWireError, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClaimVerificationSchema, CliIdentityQuerySchema, CliIdentityServiceSchema, CliIdentitySummarySchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfigureLinearInstallationSchema, ConfigureLinearInstallationV2Schema, ConfigureTaskSourceInstallationSchema, ConfiguredProviderSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentTermsSchema, ConsentUISchema, ConsumedArtifactSchema, CorrelationIdSchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CreateProvisioningOrganizationRequestSchema, CreateProvisioningOrganizationResponseSchema, CredentialProviderConfigSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_ADMIN_OVERVIEW_WINDOW, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_MAX_VENDOR_RANGE_AGE_MS, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DELEGATION_PROOF_HEADERS, DEPLOY_ERRORS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DETECTION_REASON_CODES, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationAuditSourceSchema, DelegationAuditSummarySchema, DelegationConstraintSummarySchema, DelegationEffectiveStatusSchema, DelegationExportChannelSchema, DelegationExportRecordSchema, DelegationExposureSchema, DelegationListStatusFilterSchema, DelegationManagementDetailSchema, DelegationManagementItemSchema, DelegationManagementListSchema, DelegationPollingStatusSchema, DelegationResultSchema, DelegationRevokeRequestSchema, DelegationRevokeResponseSchema, DelegationSchema, DelegationStatusSchema, DelegationStoredStatusSchema, DelegationVerifiedBySchema, DeleteAccountSchema, DenyListEntrySchema, DependencyBindingSchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasonCodeSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalExposureSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, DidCommTaskSourceBindingSchema, DidCommTaskSourceConfigSchema, DidCommTaskSourceMessageSchema, DiscordTaskSourceConfigSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ENTROPY_CONFIDENCE_CEILING, ENTROPY_CONFIDENCE_FLOOR, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXCLUSION_BUCKETS, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, EnrollWorkloadSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema$1 as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, FleetPullRequestReceiptSchema, ForgeabilityRiskSchema, GitHubTaskSourceConfigSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INSTALLATION_KINDS, INSTALLATION_TYPES, INTERNAL_ERRORS, IdentityIntentActionSchema, IdentityIntentRequestSchema, IdentityIntentSchema, IdentityIntentStateSchema, IdentityObservationSchema, ImmutableArtifactLocatorSchema, ImportIssueV2Schema, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, IssueTaskGrantSchema, JafarParseError, KNOWN_AGENT_PATTERNS, KYAOS_PROTOCOL_ERRORS, KYA_A2A_EXTENSION, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, LOWERCASE_ERRORS, LinearActivityGateSchema, LinearActivityObservationSummarySchema, LinearInstallationAuthorizationSchema, LinearInstallationProviderStatusSchema, LinearInstallationStatusReasonSchema, LinearInstallationStatusSchema, LinearInstallationWorkflowSchema, LinearObsoleteActivityListSchema, LinearObsoleteActivitySchema, ListProvisioningOrganizationsRequestSchema, ListProvisioningOrganizationsResponseSchema, LoggingConfigSchema, MANAGEMENT_ACCESS_PREFIX, MANAGEMENT_AUDIENCE, MANAGEMENT_CLIENT_ID, MANAGEMENT_CONSENT_MAX_ORGANIZATIONS, MANAGEMENT_CONSENT_MAX_PROJECTS, MANAGEMENT_DEVICE_INTERVAL, MANAGEMENT_REFRESH_PREFIX, MANAGEMENT_USER_CODE_ALPHABET, MATCH_ACTIONS, MAX_BULK_BATCH_SIZE, MAX_ED25519_KEY_BODY_LENGTH, MAX_REASON_CODES_HEADER_BYTES, MAX_REASON_CODES_ON_WIRE, MAX_TASK_GRANT_DAYS, MAX_TASK_GRANT_DEPTH, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, ManagementAccessTokenSchema, ManagementAuthorizeQuerySchema, ManagementConsentContextSchema, ManagementConsentSchema, ManagementDeviceDescriptionSchema, ManagementDeviceRequestSchema, ManagementDeviceResponseSchema, ManagementDomainErrorSchema, ManagementErrorCodeSchema, ManagementErrorReasonSchema, ManagementErrorSchema, ManagementLoopbackRedirectSchema, ManagementPostureJwkSchema, ManagementPostureOriginsRequestSchema, ManagementPostureSchema, ManagementPrincipalSchema, ManagementProfileSchema, ManagementProjectNameSchema, ManagementProjectsSchema, ManagementRefreshTokenSchema, ManagementRevokeRequestSchema, ManagementRuntimeKeyPurposeSchema, ManagementRuntimeKeyRequestSchema, ManagementRuntimeKeySchema, ManagementScopeRequestSchema, ManagementScopeSchema, ManagementSessionSchema, ManagementTokenRequestSchema, ManagementTokenResponseSchema, MarketplaceSourceSchema, MaterializationPlanSchema, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, ModelCredentialFingerprintSchema, ModelCredentialLabelSchema, ModelCredentialListSchema, ModelCredentialProviderSchema, ModelCredentialRefusalCodeSchema, ModelCredentialResultSchema, ModelCredentialRevocationSchema, ModelCredentialSchema, MouseEventSchema, NETWORK_ERRORS, NetworkConfigSchema, NetworkContextSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAUTH_LOWERCASE_ERRORS, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderConfigSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PINNED_SIGNING_VENDORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_ERRORS, POLICY_MATCH_TYPES, PROVIDER_AUTH_TYPES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PaginationResponseSchema as PublicPaginationResponseSchema, ParentIntegrationStatusSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, PolicyUnavailableError, PostureOriginsSchema, ProjectIdSchema, ProjectIdentitySchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderConfigSchema, ProviderDefinitionSchema, ProviderRegistryDefinitionSchema, ProvidersResponseSchema, ProvisionKeyRequestSchema, ProvisionKeyResponseSchema, ProvisioningModeSchema, ProvisioningOrganizationRoleSchema, ProvisioningOrganizationSummarySchema, ProxyInfoSchema, ProxyTypeSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, READABLE_TEXT, READABLE_TEXT_MESSAGE, REGISTERED_SID_MAX_LENGTH, REPORT_AI_AGENT_NAMES, REPORT_AI_CRAWLER_NAMES, RESOURCE_ERRORS, RULE_CATEGORIES, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, ReassignTaskLeadSchema, RecommendationGenerationSchema, RecommendationQuerySchema, ReconciliationDecisionSetSchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, RegistryAuthorityStateSchema, ReplaceTaskGrantSchema, ReportedAgentSchema, ReportedDelegationSchema, ReportedIdentitySchema, ReportedPrincipalSchema, RepositoryIdentitySchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RevokeModelCredentialSchema, RevokeProvisionQuerySchema, RevokeProvisionResponseSchema, RevokeTaskGrantSchema, RevokeWorkloadEnrollmentSchema, RiskAssessmentSchema, RiskScoreSchema, RiskScoreSourceSchema, RotateModelCredentialSchema, RotateWorkloadEnrollmentSchema, RoutingTypeSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SERVICE_TRAFFIC_KEYS, SESSION_ERRORS, SESSION_LIMITS, SHADOW_NOISY_OR_CONFIDENCE_KEY, SID_ATTRIBUTABLE_RESULT, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifySessionClassSchema, ShopifySessionSchema, ShopifySessionsPaginationSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, SsoLinkRequestSchema, SsoLinkResponseSchema, StaleReasonSchema, StaleReasonsSchema, StaleVendorRangesError, StartLinearInstallationSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TASK_ADMISSION_PROTOCOLS, TASK_ADMISSION_RESEND, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRAFFIC_TAXONOMY_BUCKETS, TRUSTED_BOTS, TaskAdmissionProtocolSchema, TaskGrantAdmissionRequestSchema, TaskGrantAdmissionSchema, TaskGrantAllowanceSchema, TaskGrantArgumentsSchema, TaskGrantBindingSchema, TaskGrantEffectiveStatusSchema, TaskGrantHolderListRequestSchema, TaskGrantIssueResultSchema, TaskGrantListSchema, TaskGrantRevocationSchema, TaskGrantSchema, TaskGrantStatusRequestSchema, TaskGrantStatusSchema, TaskGrantStatusValueSchema, TaskGrantViewSchema, TaskLeadAssignmentSchema, TaskLeadPoolSchema, TaskMailboxClaimRequestSchema, TaskMailboxClaimSchema, TaskMailboxProtocolSchema, TaskMailboxResultSchema, TaskMailboxScopeSchema, TaskMailboxSettlementSchema, TaskMailboxStatusRequestSchema, TaskMailboxStatusSchema, TaskModelInvokeSchema, TaskModelMessagesSchema, TaskModelPolicySchema, TaskModelReceiptSchema, TaskModelStatusSchema, TaskModelUsageSchema, TaskProjectionEvidenceSchema, TaskProjectionStateSchema, TaskSourceIntentSchema, TaskSourceProviderConfigSchema, TaskSourceProviderSchema, TaskStandingActionSchema, TaskStandingAdmissionReceiptBaseSchema, TaskStandingAdmissionRequestBaseSchema, TaskStandingAdmissionRequestSchema, TaskStandingAdmissionSchema, TaskStandingCapabilitySchema, TaskStandingLimitsSchema, TaskStandingPolicySchema, TaskStandingReconcileSchema, TaskStatusProjectionListSchema, TaskStatusProjectionSchema, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TrackDependencyV2Schema, TrackingReadinessReasonCodeSchema, TrackingReadinessSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, UNCALIBRATED_NOISY_OR_PRIOR, UNNAMED_AGENT_LABEL, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UUID_PATTERN, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VERDICT_COOKIE_NAME, VERSION, VerdictEvidenceSchema, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, WorkloadEnrollmentChallengeSchema, WorkloadEnrollmentListSchema, WorkloadEnrollmentProofPayloadSchema, WorkloadEnrollmentResultSchema, WorkloadEnrollmentRevocationSchema, WorkloadEnrollmentSchema, WorkloadRotationProofPayloadSchema, acceptsHtml, adminOverviewQuerySchema, approvalQuorumForRequest, assertVendorRangesFresh, assignmentChangeRequestSchema, auditLogQuerySchema, base58btcDecode, base58btcEncode, batchAssignmentRequestSchema, bespokePolicyLabel, blockDelegationVerdict, blockEqualityLiterals, buildChallengeWire, buildDelegationBearerHeader, buildDelegationChallengeBody, buildDelegationChallengeEnvelope, buildDelegationChallengeHeader, buildDelegationInstructions, buildInitialStepsState, buildKnownPatternLookup, buildVerdictEvidence, calculateDeployProgress, callbackSchema, cedarQuotedValueRegExp, changePasswordSchema, classifyAgentTaxonomy, classifyResponseShape, claudeRuntimeLabel, compressIpv6, computeEntropyConfidence, contractDigest, createError, createErrorResponse, createEvaluationContext, createKyaA2AAgentCard, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, decodeDidKeyP256, decodeEd25519PublicKeyMultibaseTolerant, defaultConfig, deriveConflictId, deriveCorrelationId, deriveDelegationPickupUri, deriveImportIssueId, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeEd25519PublicKeyMultibase, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractCorrelationIdFromHeaders, extractMatch, fetchPolicy, findMatchingPattern, findStaleVendorRanges, forgotPasswordSchema, formatAgentCategory, formatAgentCategoryInline, formatConfidence, formatReasonCodesHeader, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateDelegationSid, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, hasClaudeCodeToken, hasClaudeSearchBotToken, hasClaudeUserToken, hasPinnedSigningVendor, initializePolicyFetcher, ipAddressSchema, isAuthorizedLead, isBespokePolicyId, isBlockingAction, isClaudeProductLabel, isForbidBlock, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isNonNavigablePolicyId, isPassThroughAction, isPolicyUnavailableError, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isUnnarrowedDenyBlock, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, lintUnnarrowedDenyRules, loadRulesAsync, mapDetectionToReasonCodes, mapLegacyAuthType, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, modelCredentialFingerprint, nonNavigablePolicyLabel, normalizeAgentName, normalizeChallengeType, normalizeClientIp, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeHandshakeMethod, normalizeOrganizationName, normalizeWireMethod, oauthClientSchema, parseAcceptedArtifactRevision, parseAgentName, parseClaimVerification, parseDependencyBinding, parseEvaluationContext, parseImportIssueV2, parseIpv6, parseJafarFeed, parseMaterializationPlan, parsePolicyConfig, parseRules, partial, passwordSchema, pathHasUnnarrowedDenyRule, pathLiteralsInBlock, permitDelegationVerdict, projectResetRequestSchema, readableText, reconstructConfidenceFromEvidence, refineClaudeDisplayLabel, refineSessionGrainClaudeLabel, requestCarriesDelegationProof, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveBotSignals, resolveChallengeContext, resolveClientIp, resolveTrustedDelegationRoots, riskScoreColumnValue, riskScoreFromMetadata, riskScoreSourceFromMetadata, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signUpSchema, splitCedarBlocks, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, taskGrantArgumentsDigest, testPattern, testPatterns, toBareHost, toCoarseReasonKind, toPercent, toProviderRegistryFormat, toStoredCorrelationId, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validModelAdmission, validate, validateClientDetection, validateFingerprintRequest, validateOrThrow, validateOrganizationName, validateProviderConfig, validateProviderDefinition, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyContractRecordIdentity, verifyEmailSchema, wasmToDetectionResult };
|
|
17813
|
+
export { A2ARpcEnvelopeSchema, A2ASignedRequestSchema, A2ATaskRequestSchema, A2ATaskSourceConfigSchema, A2ATaskStateSchema, ACCEPT_CHALLENGE_HEADER, ADMIN_ACCOUNTS_STATUS_FILTERS, ADMIN_ACCOUNT_STATUSES, ADMIN_DELTA_BASES, ADMIN_ORG_EXCLUSION_REASONS, ADMIN_OVERVIEW_CACHE_STATUSES, ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT, ADMIN_OVERVIEW_LIST_LIMIT_MAX, ADMIN_OVERVIEW_SECTIONS, ADMIN_OVERVIEW_WINDOWS, ADMIN_TRUSTED_METRICS, AGENT_CATEGORY_META, AI_AGENT_HEADERS, ANALYTICS_ERRORS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, ATTESTED_BEARER_MAX_TTL_SECONDS, AUDIT_ERRORS, AUDIT_PROTOCOL_ERRORS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AUTH_MODES, AcceptanceWithdrawalSchema, AcceptedArtifactRevisionSchema, AccountSchema, AddFingerprintToProfileRequestSchema, AddModelCredentialSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AgentTypeSchema as WasmAgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AllowedDomainsSchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema$1 as AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, ApplyIdentityIntentSchema, ApproveTaskPublicationSchema, ApprovedTaskPublicationSchema, ArtifactIdentitySchema, AssuranceTierSchema, AuthErrorType, AuthProviderTypeSchema, BARE_ERRORS, BASELINE_ALLOW_POLICY_ID, BESPOKE_POLICY_IDS, BILLING_ERRORS, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BOUNCER_LOWERCASE_ERRORS, BOUNCER_UPPERCASE_ERRORS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BindingStatusSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, ByteBoundedMemo, CACHE_LIMITS, CACHE_TTL, CLI_PAIRING_FRAMEWORKS, CLI_PAIRING_PROTOCOL_VERSION, CLI_PAIRING_UPGRADE_MESSAGE, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CORRELATION_ID_HEADER, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, ChallengeWireError, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClaimVerificationSchema, CliIdentityQuerySchema, CliIdentityServiceSchema, CliIdentitySummarySchema, CliPairingApprovedClaimSchema, CliPairingClaimSchema, CliPairingExchangeDataSchema, CliPairingExchangeRequestSchema, CliPairingPrivateStatusDataSchema, CliPairingProofSchema, CliPairingRegisterDataSchema, CliPairingRegisterRequestSchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfigureLinearInstallationSchema, ConfigureLinearInstallationV2Schema, ConfigureTaskSourceInstallationSchema, ConfiguredProviderSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentInputCopySchema, ConsentPolicyCapabilitySchema, ConsentPolicyResponseSchema, ConsentPolicyRiskLevelSchema, ConsentScopeLabelsSchema, ConsentSignInCopySchema, ConsentTermsSchema, ConsentUISchema, ConsumedArtifactSchema, CorrelationIdSchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CreateProvisioningOrganizationRequestSchema, CreateProvisioningOrganizationResponseSchema, CredentialProviderConfigSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_ADMIN_OVERVIEW_WINDOW, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_MAX_VENDOR_RANGE_AGE_MS, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DELEGATION_PROOF_HEADERS, DEPLOY_ERRORS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DETECTION_REASON_CODES, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationAuditSourceSchema, DelegationAuditSummarySchema, DelegationConstraintSummarySchema, DelegationEffectiveStatusSchema, DelegationExportChannelSchema, DelegationExportRecordSchema, DelegationExposureSchema, DelegationListStatusFilterSchema, DelegationManagementDetailSchema, DelegationManagementItemSchema, DelegationManagementListSchema, DelegationPollingStatusSchema, DelegationResultSchema, DelegationRevokeRequestSchema, DelegationRevokeResponseSchema, DelegationSchema, DelegationStatusSchema, DelegationStoredStatusSchema, DelegationVerifiedBySchema, DeleteAccountSchema, DenyListEntrySchema, DependencyBindingSchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasonCodeSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalExposureSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, DidCommTaskSourceBindingSchema, DidCommTaskSourceConfigSchema, DidCommTaskSourceMessageSchema, DiscordTaskSourceConfigSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ENTROPY_CONFIDENCE_CEILING, ENTROPY_CONFIDENCE_FLOOR, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXCLUSION_BUCKETS, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, EnrollWorkloadSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FAIL_CLOSED_BODY, FAIL_CLOSED_HEADERS, FAIL_CLOSED_STATUS, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema$1 as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, FleetPullRequestReceiptSchema, ForgeabilityRiskSchema, GATEWAY_VAULT_ERRORS, GitHubTaskSourceConfigSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INSTALLATION_KINDS, INSTALLATION_TYPES, INTERNAL_ERRORS, IdentityIntentActionSchema, IdentityIntentRequestSchema, IdentityIntentSchema, IdentityIntentStateSchema, IdentityObservationSchema, ImmutableArtifactLocatorSchema, ImportIssueV2Schema, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, IssueTaskGrantSchema, JafarParseError, KNOWN_AGENT_PATTERNS, KYAOS_PROTOCOL_ERRORS, KYA_A2A_EXTENSION, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, LOWERCASE_ERRORS, LinearActivityGateSchema, LinearActivityObservationSummarySchema, LinearInstallationAuthorizationSchema, LinearInstallationProviderStatusSchema, LinearInstallationStatusReasonSchema, LinearInstallationStatusSchema, LinearInstallationWorkflowSchema, LinearObsoleteActivityListSchema, LinearObsoleteActivitySchema, ListProvisioningOrganizationsRequestSchema, ListProvisioningOrganizationsResponseSchema, LoggingConfigSchema, MANAGEMENT_ACCESS_PREFIX, MANAGEMENT_AUDIENCE, MANAGEMENT_CLIENT_ID, MANAGEMENT_CONSENT_MAX_ORGANIZATIONS, MANAGEMENT_CONSENT_MAX_PROJECTS, MANAGEMENT_DEVICE_INTERVAL, MANAGEMENT_REFRESH_PREFIX, MANAGEMENT_USER_CODE_ALPHABET, MATCH_ACTIONS, MAX_ALLOWED_DOMAINS, MAX_ALLOWED_DOMAIN_LENGTH, MAX_BULK_BATCH_SIZE, MAX_ED25519_KEY_BODY_LENGTH, MAX_REASON_CODES_HEADER_BYTES, MAX_REASON_CODES_ON_WIRE, MAX_TASK_GRANT_DAYS, MAX_TASK_GRANT_DEPTH, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, ManagementAccessTokenSchema, ManagementAuthorizeQuerySchema, ManagementConsentContextSchema, ManagementConsentSchema, ManagementDeviceDescriptionSchema, ManagementDeviceRequestSchema, ManagementDeviceResponseSchema, ManagementDomainErrorSchema, ManagementErrorCodeSchema, ManagementErrorReasonSchema, ManagementErrorSchema, ManagementLoopbackRedirectSchema, ManagementPostureJwkSchema, ManagementPostureOriginsRequestSchema, ManagementPostureSchema, ManagementPrincipalSchema, ManagementProfileSchema, ManagementProjectNameSchema, ManagementProjectsSchema, ManagementRefreshTokenSchema, ManagementRevokeRequestSchema, ManagementRuntimeKeyPurposeSchema, ManagementRuntimeKeyRequestSchema, ManagementRuntimeKeySchema, ManagementScopeRequestSchema, ManagementScopeSchema, ManagementSessionSchema, ManagementTokenRequestSchema, ManagementTokenResponseSchema, MarketplaceSourceSchema, MaterializationPlanSchema, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, ModelCredentialFingerprintSchema, ModelCredentialLabelSchema, ModelCredentialListSchema, ModelCredentialProviderSchema, ModelCredentialRefusalCodeSchema, ModelCredentialResultSchema, ModelCredentialRevocationSchema, ModelCredentialSchema, MouseEventSchema, NETWORK_ERRORS, NO_EVIDENCE_CATEGORY, NO_EVIDENCE_EQUALITY_TERM, NO_EVIDENCE_EXCLUSION_TERM, NetworkConfigSchema, NetworkContextSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAUTH_LOWERCASE_ERRORS, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderConfigSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PINNED_SIGNING_VENDORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_ERRORS, POLICY_MATCH_TYPES, PROVIDER_AUTH_TYPES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PaginationResponseSchema as PublicPaginationResponseSchema, ParentIntegrationStatusSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, PolicyUnavailableError, PostureOriginsSchema, ProjectIdSchema, ProjectIdentitySchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderConfigSchema, ProviderDefinitionSchema, ProviderRegistryDefinitionSchema, ProvidersResponseSchema, ProvisionKeyRequestSchema, ProvisionKeyResponseSchema, ProvisioningAccountLinkRequestSchema, ProvisioningAccountLinkResponseSchema, ProvisioningIdentityProofSchema, ProvisioningModeSchema, ProvisioningOrganizationRoleSchema, ProvisioningOrganizationSummarySchema, ProxyAssertionSchema, ProxyCollectionStateSchema, ProxyInfoSchema, ProxyTypeSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, READABLE_TEXT, READABLE_TEXT_MESSAGE, REGISTERED_SID_MAX_LENGTH, REPORT_AI_AGENT_NAMES, REPORT_AI_CRAWLER_NAMES, RESOURCE_ERRORS, RULE_CATEGORIES, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, ReassignTaskLeadSchema, RecommendationGenerationSchema, RecommendationQuerySchema, ReconciliationDecisionSetSchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, RegistryAuthorityStateSchema, ReplaceTaskGrantSchema, ReportedAgentSchema, ReportedDelegationSchema, ReportedIdentitySchema, ReportedPrincipalSchema, RepositoryIdentitySchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RevokeModelCredentialSchema, RevokeProvisionQuerySchema, RevokeProvisionResponseSchema, RevokeTaskGrantSchema, RevokeWorkloadEnrollmentSchema, RiskAssessmentSchema, RiskScoreSchema, RiskScoreSourceSchema, RotateModelCredentialSchema, RotateWorkloadEnrollmentSchema, RoutingTypeSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SERVICE_TRAFFIC_KEYS, SESSION_ERRORS, SESSION_LIMITS, SHADOW_NOISY_OR_CONFIDENCE_KEY, SID_ATTRIBUTABLE_RESULT, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifySessionClassSchema, ShopifySessionSchema, ShopifySessionsPaginationSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, SsoLinkRequestSchema, SsoLinkResponseSchema, StaleReasonSchema, StaleReasonsSchema, StaleVendorRangesError, StartLinearInstallationSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TASK_ADMISSION_PROTOCOLS, TASK_ADMISSION_RESEND, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRAFFIC_TAXONOMY_BUCKETS, TRUSTED_BOTS, TaskAdmissionProtocolSchema, TaskGrantAdmissionRequestSchema, TaskGrantAdmissionSchema, TaskGrantAllowanceSchema, TaskGrantArgumentsSchema, TaskGrantBindingSchema, TaskGrantEffectiveStatusSchema, TaskGrantHolderListRequestSchema, TaskGrantIssueResultSchema, TaskGrantListSchema, TaskGrantRevocationSchema, TaskGrantSchema, TaskGrantStatusRequestSchema, TaskGrantStatusSchema, TaskGrantStatusValueSchema, TaskGrantViewSchema, TaskLeadAssignmentSchema, TaskLeadPoolSchema, TaskMailboxClaimRequestSchema, TaskMailboxClaimSchema, TaskMailboxProtocolSchema, TaskMailboxResultSchema, TaskMailboxScopeSchema, TaskMailboxSettlementSchema, TaskMailboxStatusRequestSchema, TaskMailboxStatusSchema, TaskModelInvokeSchema, TaskModelMessagesSchema, TaskModelPolicySchema, TaskModelReceiptSchema, TaskModelStatusSchema, TaskModelUsageSchema, TaskProjectionEvidenceSchema, TaskProjectionStateSchema, TaskSourceIntentSchema, TaskSourceProviderConfigSchema, TaskSourceProviderSchema, TaskStandingActionSchema, TaskStandingAdmissionReceiptBaseSchema, TaskStandingAdmissionRequestBaseSchema, TaskStandingAdmissionRequestSchema, TaskStandingAdmissionSchema, TaskStandingCapabilitySchema, TaskStandingLimitsSchema, TaskStandingPolicySchema, TaskStandingReconcileSchema, TaskStatusProjectionListSchema, TaskStatusProjectionSchema, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TrackDependencyV2Schema, TrackingReadinessReasonCodeSchema, TrackingReadinessSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, UNCALIBRATED_NOISY_OR_PRIOR, UNNAMED_AGENT_LABEL, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UUID_PATTERN, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VAULT_ERRORS, VERDICT_COOKIE_NAME, VERSION, VerdictEvidenceSchema, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, WorkloadEnrollmentChallengeSchema, WorkloadEnrollmentListSchema, WorkloadEnrollmentProofPayloadSchema, WorkloadEnrollmentResultSchema, WorkloadEnrollmentRevocationSchema, WorkloadEnrollmentSchema, WorkloadRotationProofPayloadSchema, acceptsHtml, adminAccountsQuerySchema, adminOverviewQuerySchema, analyzePolicySource, approvalQuorumForRequest, assertVendorRangesFresh, assignmentChangeRequestSchema, auditLogQuerySchema, base58btcDecode, base58btcEncode, batchAssignmentRequestSchema, bespokePolicyLabel, blockDelegationVerdict, blockEqualityLiterals, buildChallengeWire, buildDelegationBearerHeader, buildDelegationChallengeBody, buildDelegationChallengeEnvelope, buildDelegationChallengeHeader, buildDelegationInstructions, buildInitialStepsState, buildKnownPatternLookup, buildVerdictEvidence, calculateDeployProgress, callbackSchema, cedarQuotedValueRegExp, changePasswordSchema, classifyAgentTaxonomy, classifyResponseShape, claudeRuntimeLabel, compressIpv6, computeEntropyConfidence, contractDigest, createError, createErrorResponse, createEvaluationContext, createKyaA2AAgentCard, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, decodeDidKeyP256, decodeEd25519PublicKeyMultibaseTolerant, defaultConfig, deriveConflictId, deriveCorrelationId, deriveDelegationPickupUri, deriveImportIssueId, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeEd25519PublicKeyMultibase, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractCorrelationIdFromHeaders, extractMatch, fetchPolicy, findMatchingPattern, findStaleVendorRanges, forgotPasswordSchema, formatAgentCategory, formatAgentCategoryInline, formatConfidence, formatReasonCodesHeader, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateDelegationSid, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, hasClaudeCodeToken, hasClaudeSearchBotToken, hasClaudeUserToken, hasPinnedSigningVendor, hostMatchesAllowedDomains, initializePolicyFetcher, ipAddressSchema, isAuthorizedLead, isBespokePolicyId, isBlockingAction, isClaudeProductLabel, isEngineEnforcing, isForbidBlock, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isNonNavigablePolicyId, isPassThroughAction, isPolicyUnavailableError, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isUnnarrowedDenyBlock, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, lintMissingBaselinePermit, lintUnnarrowedDenyRules, loadRulesAsync, mapDetectionToReasonCodes, mapLegacyAuthType, mapProxyAssertions, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, modelCredentialFingerprint, nonNavigablePolicyLabel, normalizeAgentName, normalizeAllowedDomainForWrite, normalizeAllowedDomainList, normalizeChallengeType, normalizeClientIp, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeHandshakeMethod, normalizeOrganizationName, normalizeStoredAllowedDomain, normalizeWireMethod, oauthClientSchema, parseAcceptedArtifactRevision, parseAgentName, parseCedarStatements, parseClaimVerification, parseDependencyBinding, parseEvaluationContext, parseImportIssueV2, parseIpv6, parseJafarFeed, parseMaterializationPlan, parsePolicyConfig, parseRules, partial, passwordSchema, pathHasExplicitDenyRuleFor, pathHasUnnarrowedDenyRule, pathHasUnnarrowedDenyRuleFor, pathLiteralsInBlock, permitDelegationVerdict, projectResetRequestSchema, readableText, reconstructConfidenceFromEvidence, refineClaudeDisplayLabel, refineSessionGrainClaudeLabel, requestCarriesDelegationProof, requestPresentedCredential, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveBotSignals, resolveChallengeContext, resolveClientIp, resolveTrustedDelegationRoots, riskScoreColumnValue, riskScoreFromMetadata, riskScoreSourceFromMetadata, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signUpSchema, splitCedarBlocks, statementApplies, statementId, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, taskGrantArgumentsDigest, testPattern, testPatterns, toBareHost, toCoarseReasonKind, toPercent, toProviderRegistryFormat, toStoredCorrelationId, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validModelAdmission, validate, validateClientDetection, validateFingerprintRequest, validateOrThrow, validateOrganizationName, validateProviderConfig, validateProviderDefinition, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyContractRecordIdentity, verifyEmailSchema, wasmToDetectionResult, withNoEvidenceExclusion };
|
|
18303
17814
|
//# sourceMappingURL=index.mjs.map
|