@kya-os/checkpoint-shared 1.5.1 → 1.6.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/dist/beacon-nonce/index.d.mts +36 -0
  3. package/dist/beacon-nonce/index.d.mts.map +1 -0
  4. package/dist/beacon-nonce/index.d.ts +36 -0
  5. package/dist/beacon-nonce/index.d.ts.map +1 -0
  6. package/dist/beacon-nonce/index.js +305 -0
  7. package/dist/beacon-nonce/index.mjs +294 -0
  8. package/dist/beacon-nonce/index.mjs.map +1 -0
  9. package/dist/beacon-types/index.d.mts +40 -0
  10. package/dist/beacon-types/index.d.mts.map +1 -1
  11. package/dist/beacon-types/index.d.ts +40 -0
  12. package/dist/beacon-types/index.d.ts.map +1 -1
  13. package/dist/beacon-types/index.js +53 -5
  14. package/dist/beacon-types/index.mjs +49 -6
  15. package/dist/beacon-types/index.mjs.map +1 -1
  16. package/dist/browser-posture-BuChqmH5.d.mts +169 -0
  17. package/dist/browser-posture-BuChqmH5.d.mts.map +1 -0
  18. package/dist/browser-posture-DIaVLuW3.d.ts +169 -0
  19. package/dist/browser-posture-DIaVLuW3.d.ts.map +1 -0
  20. package/dist/browser-posture-cookie.d.mts +4 -2
  21. package/dist/browser-posture-cookie.d.mts.map +1 -0
  22. package/dist/browser-posture-cookie.d.ts +4 -2
  23. package/dist/browser-posture-cookie.d.ts.map +1 -0
  24. package/dist/browser-posture-cookie.mjs.map +1 -1
  25. package/dist/browser-posture-proof.d.mts +18 -0
  26. package/dist/browser-posture-proof.d.mts.map +1 -0
  27. package/dist/browser-posture-proof.d.ts +18 -0
  28. package/dist/browser-posture-proof.d.ts.map +1 -0
  29. package/dist/browser-posture-proof.js +66 -0
  30. package/dist/browser-posture-proof.mjs +63 -0
  31. package/dist/browser-posture-proof.mjs.map +1 -0
  32. package/dist/browser-posture-report.d.mts +59 -2
  33. package/dist/browser-posture-report.d.mts.map +1 -1
  34. package/dist/browser-posture-report.d.ts +59 -2
  35. package/dist/browser-posture-report.d.ts.map +1 -1
  36. package/dist/browser-posture-report.js +1 -1
  37. package/dist/browser-posture-report.mjs +1 -1
  38. package/dist/browser-posture-report.mjs.map +1 -1
  39. package/dist/browser-posture.d.mts +2 -85
  40. package/dist/browser-posture.d.ts +2 -85
  41. package/dist/browser-posture.js +207 -45
  42. package/dist/browser-posture.mjs +195 -45
  43. package/dist/browser-posture.mjs.map +1 -1
  44. package/dist/browser.d.mts +0 -8
  45. package/dist/browser.d.mts.map +1 -1
  46. package/dist/browser.d.ts +0 -8
  47. package/dist/browser.d.ts.map +1 -1
  48. package/dist/browser.js +1 -1
  49. package/dist/browser.mjs +1 -1
  50. package/dist/browser.mjs.map +1 -1
  51. package/dist/clearance.d.mts +1 -1
  52. package/dist/clearance.d.ts +1 -1
  53. package/dist/clearance.js +2 -2
  54. package/dist/clearance.mjs +2 -2
  55. package/dist/{client-ip-HOfe6ucV.mjs → client-ip-B2Xeo-GK.mjs} +2 -2
  56. package/dist/{client-ip-HOfe6ucV.mjs.map → client-ip-B2Xeo-GK.mjs.map} +1 -1
  57. package/dist/{client-ip-1y2iXAYW.js → client-ip-CW6pRyLf.js} +1 -1
  58. package/dist/consent-handoff.d.mts +41 -0
  59. package/dist/consent-handoff.d.mts.map +1 -0
  60. package/dist/consent-handoff.d.ts +41 -0
  61. package/dist/consent-handoff.d.ts.map +1 -0
  62. package/dist/consent-handoff.js +1 -0
  63. package/dist/consent-handoff.mjs +2 -0
  64. package/dist/consent-handoff.mjs.map +1 -0
  65. package/dist/errors/index.d.mts +155 -0
  66. package/dist/errors/index.d.mts.map +1 -1
  67. package/dist/errors/index.d.ts +155 -0
  68. package/dist/errors/index.d.ts.map +1 -1
  69. package/dist/errors/index.js +513 -9
  70. package/dist/errors/index.mjs +513 -10
  71. package/dist/errors/index.mjs.map +1 -1
  72. package/dist/{external-jr_S4iSS.d.ts → external-B7WI9FyQ.d.mts} +2 -2
  73. package/dist/{external-jr_S4iSS.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
  74. package/dist/{external-jr_S4iSS.d.mts → external-B7WI9FyQ.d.ts} +2 -2
  75. package/dist/{external-jr_S4iSS.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
  76. package/dist/gateway-client-ip.d.mts +1 -1
  77. package/dist/gateway-client-ip.d.ts +1 -1
  78. package/dist/gateway-client-ip.js +2 -2
  79. package/dist/gateway-client-ip.mjs +2 -2
  80. package/dist/index.d.mts +6375 -1532
  81. package/dist/index.d.mts.map +1 -1
  82. package/dist/index.d.ts +6375 -1532
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +5629 -697
  85. package/dist/index.mjs +5341 -683
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/mcpi/approval-grant/index.d.mts +1 -1
  88. package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
  89. package/dist/mcpi/approval-grant/index.d.ts +1 -1
  90. package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
  91. package/dist/mcpi/approval-grant/index.js +58 -49
  92. package/dist/mcpi/approval-grant/index.mjs +58 -49
  93. package/dist/mcpi/approval-grant/index.mjs.map +1 -1
  94. package/dist/mcpi/dashboard-config/index.d.mts +3 -2
  95. package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
  96. package/dist/mcpi/dashboard-config/index.d.ts +3 -2
  97. package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
  98. package/dist/posture-origins/index.d.mts +41 -0
  99. package/dist/posture-origins/index.d.mts.map +1 -0
  100. package/dist/posture-origins/index.d.ts +41 -0
  101. package/dist/posture-origins/index.d.ts.map +1 -0
  102. package/dist/posture-origins/index.js +441 -0
  103. package/dist/posture-origins/index.mjs +430 -0
  104. package/dist/posture-origins/index.mjs.map +1 -0
  105. package/dist/posture-origins-LFkX80oF.js +627 -0
  106. package/dist/posture-origins-Pn-ii-Pp.mjs +533 -0
  107. package/dist/posture-origins-Pn-ii-Pp.mjs.map +1 -0
  108. package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
  109. package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
  110. package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
  111. package/dist/rules.json +0 -1
  112. package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
  113. package/dist/schemas-7qodsG-Z.mjs.map +1 -0
  114. package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
  115. package/dist/signals/index.d.mts +75 -55
  116. package/dist/signals/index.d.mts.map +1 -1
  117. package/dist/signals/index.d.ts +75 -55
  118. package/dist/signals/index.d.ts.map +1 -1
  119. package/dist/signals/index.js +246 -2
  120. package/dist/signals/index.mjs +236 -3
  121. package/dist/signals/index.mjs.map +1 -1
  122. package/fixtures/browser-integrity/captured-java-0.2.1-missing-score.json +10 -0
  123. package/fixtures/browser-integrity/null-score.json +11 -0
  124. package/fixtures/browser-integrity/numeric-score.json +11 -0
  125. package/fixtures/browser-posture-claims.json +168 -0
  126. package/fixtures/browser-posture-headers.json +6 -0
  127. package/fixtures/cli-registration.v2.json +115 -0
  128. package/fixtures/detection/reason-codes.json +1 -1
  129. package/fixtures/kya-http/README.md +34 -25
  130. package/fixtures/kya-http/consent-handoff.codes.json +34 -0
  131. package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
  132. package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
  133. package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
  134. package/fixtures/reviewer-grant-revocation.v1.json +285 -0
  135. package/fixtures/workbench/a2a-signed-request.v1.json +255 -0
  136. package/fixtures/workbench/artifact-bindings.v1.json +1003 -0
  137. package/fixtures/workbench/delegation-management.v1.json +507 -0
  138. package/fixtures/workbench/didcomm-task-source.v1.json +191 -0
  139. package/fixtures/workbench/graph-interfaces.v1.json +1887 -0
  140. package/fixtures/workbench/identity-provisioning.v1.json +643 -0
  141. package/fixtures/workbench/linear-installation.v1.json +484 -0
  142. package/fixtures/workbench/management-session.v1.json +716 -0
  143. package/fixtures/workbench/model-credentials.v1.json +630 -0
  144. package/fixtures/workbench/source-claim-pooled.v1.json +50 -0
  145. package/fixtures/workbench/task-grant.v1.json +695 -0
  146. package/fixtures/workbench/task-status-projection.v1.json +591 -0
  147. package/fixtures/workbench/workload-enrollment.v1.json +580 -0
  148. package/package.json +24 -5
  149. package/src/data/compiled/merged-rules.json +2 -9
  150. package/src/data/default-rules.json +0 -1
  151. package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +0 -5
  152. package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +0 -1
  153. package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +0 -5
  154. package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +0 -1
  155. package/dist/browser-posture.d.mts.map +0 -1
  156. package/dist/browser-posture.d.ts.map +0 -1
  157. package/dist/patterns-CkRVOdtV.js +0 -243
  158. package/dist/patterns-DzkGy_qk.mjs +0 -173
  159. package/dist/patterns-DzkGy_qk.mjs.map +0 -1
  160. package/dist/schemas-DxY-dk9y.mjs.map +0 -1
  161. package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_schemas = require('./schemas-BmjNLAE7.js');
3
- const require_patterns = require('./patterns-CkRVOdtV.js');
4
- const require_project_verification_key = require('./project-verification-key-C3L5rd8a.js');
2
+ const require_schemas = require('./schemas-YhagYDx_.js');
3
+ const require_posture_origins = require('./posture-origins-LFkX80oF.js');
4
+ const require_project_verification_key = require('./project-verification-key-BccT12tQ.js');
5
5
  let jose = require("jose");
6
6
 
7
7
  //#region src/browser-posture-cookie.ts
@@ -17,7 +17,7 @@ let jose = require("jose");
17
17
  * reader will look for.
18
18
  */
19
19
  function postureCookieName(projectId) {
20
- if (!require_patterns.UUID_PATTERN.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Invalid posture project id");
20
+ if (!require_posture_origins.UUID_PATTERN.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Invalid posture project id");
21
21
  return `__Host-checkpoint_posture_${projectId}`;
22
22
  }
23
23
 
@@ -30,8 +30,41 @@ function postureCookieName(projectId) {
30
30
  */
31
31
  const POSTURE_TTL_SECONDS = 120;
32
32
 
33
+ //#endregion
34
+ //#region src/browser-posture-schema.ts
35
+ const BrowserPostureSchema = require_schemas.object({
36
+ v: require_schemas.literal(1),
37
+ project_id: require_schemas.string().min(1).max(128),
38
+ origin: require_schemas.string().url(),
39
+ session_id: require_schemas.guid(),
40
+ binding: require_schemas.string().regex(/^[a-f0-9]{64}$/),
41
+ verdict: require_schemas._enum([
42
+ "agent-driven",
43
+ "human",
44
+ "insufficient"
45
+ ]),
46
+ score: require_schemas.number().min(0).max(1).nullable(),
47
+ scorer_version: require_schemas.number().int().positive().max(2147483647),
48
+ reasons: require_schemas.array(require_schemas.string().max(160)).max(8),
49
+ automation_disclosed: require_schemas.boolean().default(false),
50
+ automation_corroborated: require_schemas.boolean().default(false),
51
+ detection: require_schemas.object({
52
+ class: require_schemas._enum(["ai_agent", "bot"]),
53
+ name: require_schemas.string().min(1).max(64).regex(/^[^\p{Cc}]+$/u),
54
+ confidence: require_schemas.number().int().min(0).max(100)
55
+ }).optional(),
56
+ cnf: require_schemas.object({ jkt: require_schemas.string().min(1).max(255) }).optional(),
57
+ iat: require_schemas.number().int().nonnegative(),
58
+ exp: require_schemas.number().int().positive()
59
+ });
60
+
33
61
  //#endregion
34
62
  //#region src/browser-posture-report.ts
63
+ const POSTURE_VERIFICATION_STATUSES = [
64
+ "verified",
65
+ "absent",
66
+ "rejected"
67
+ ];
35
68
  /** Audit projection: no token, cookie binding, raw counters, or credential fields. */
36
69
  const BrowserPostureReportSchema = require_schemas.object({
37
70
  projectId: require_schemas.string().min(1).max(128),
@@ -48,6 +81,31 @@ const BrowserPostureReportSchema = require_schemas.object({
48
81
  expiresAt: require_schemas.number().int().positive(),
49
82
  source: require_schemas.literal("verified-posture")
50
83
  });
84
+ const BROWSER_POSTURE_REJECTION_REASONS = [
85
+ "malformed",
86
+ "unknown-key",
87
+ "bad-signature",
88
+ "invalid-claims",
89
+ "project-mismatch",
90
+ "origin-mismatch",
91
+ "audience-mismatch",
92
+ "expired",
93
+ "not-yet-valid",
94
+ "binding-mismatch",
95
+ "session-missing"
96
+ ];
97
+ const BrowserPostureOutcomeSchema = require_schemas.object({
98
+ status: require_schemas._enum(POSTURE_VERIFICATION_STATUSES),
99
+ reason: require_schemas._enum(BROWSER_POSTURE_REJECTION_REASONS).optional()
100
+ }).refine((outcome) => outcome.status === "rejected" === (outcome.reason !== void 0), {
101
+ message: "reason is required if and only if status is rejected",
102
+ path: ["reason"]
103
+ });
104
+ const BROWSER_POSTURE_REASON_PATTERN = /^[a-z][a-z-]{0,31}$/;
105
+ const BROWSER_POSTURE_REJECTIONS_MAX_ENTRIES = 50;
106
+ const BROWSER_POSTURE_REJECTION_COUNT_MAX = 1e6;
107
+ const BrowserPostureRejectionsSchema = require_schemas.record(require_schemas.string(), require_schemas.unknown()).transform((counts) => Object.fromEntries(Object.entries(counts).filter((entry) => BROWSER_POSTURE_REASON_PATTERN.test(entry[0]) && typeof entry[1] === "number" && Number.isInteger(entry[1]) && entry[1] > 0).slice(0, 50).map(([reason, count]) => [reason, Math.min(count, BROWSER_POSTURE_REJECTION_COUNT_MAX)])));
108
+ const BrowserPostureReportIngestSchema = BrowserPostureReportSchema.extend({ score: BrowserPostureReportSchema.shape.score.default(null) });
51
109
  function browserPostureReport(posture) {
52
110
  return {
53
111
  projectId: posture.project_id,
@@ -70,27 +128,43 @@ const UNSIGNED_BROWSER_AGENT = {
70
128
  verificationMethod: "behavioral"
71
129
  };
72
130
  const behavioralConfidence = (score) => Math.min(85, Math.max(50, Math.round((score ?? .5) * 100)));
131
+ function postureUpgrade(posture) {
132
+ const { detection, reasons } = posture;
133
+ const verificationMethod = "behavioral";
134
+ if (detection) return {
135
+ detectionClass: detection.class,
136
+ isAgent: true,
137
+ agentName: detection.name,
138
+ confidence: detection.confidence,
139
+ verificationMethod,
140
+ reasons
141
+ };
142
+ if (posture.automation_disclosed) return {
143
+ detectionClass: "bot",
144
+ isAgent: true,
145
+ agentName: "Automation Tools",
146
+ confidence: 80,
147
+ verificationMethod,
148
+ reasons
149
+ };
150
+ if (posture.verdict === "agent-driven") return {
151
+ detectionClass: UNSIGNED_BROWSER_AGENT.detectionClass,
152
+ isAgent: true,
153
+ agentName: UNSIGNED_BROWSER_AGENT.agentType,
154
+ confidence: behavioralConfidence(posture.score),
155
+ verificationMethod,
156
+ reasons
157
+ };
158
+ if (posture.automation_corroborated) return {
159
+ detectionClass: "incomplete_data",
160
+ isAgent: false,
161
+ confidence: 40,
162
+ verificationMethod,
163
+ reasons
164
+ };
165
+ }
73
166
  const POSTURE_ISSUER = "checkpoint:browser-posture:v1";
74
167
  const POSTURE_TYPE = "checkpoint-posture+jwt";
75
- const BrowserPostureSchema = require_schemas.object({
76
- v: require_schemas.literal(1),
77
- project_id: require_schemas.string().min(1).max(128),
78
- origin: require_schemas.string().url(),
79
- session_id: require_schemas.guid(),
80
- binding: require_schemas.string().regex(/^[a-f0-9]{64}$/),
81
- verdict: require_schemas._enum([
82
- "agent-driven",
83
- "human",
84
- "insufficient"
85
- ]),
86
- score: require_schemas.number().min(0).max(1).nullable(),
87
- scorer_version: require_schemas.number().int().positive().max(2147483647),
88
- reasons: require_schemas.array(require_schemas.string().max(160)).max(8),
89
- automation_disclosed: require_schemas.boolean().default(false),
90
- automation_corroborated: require_schemas.boolean().default(false),
91
- iat: require_schemas.number().int().nonnegative(),
92
- exp: require_schemas.number().int().positive()
93
- });
94
168
  /** Duplicate cookies are ambiguous, so none is trusted. */
95
169
  function readPostureCookie(header, name) {
96
170
  const matches = (header ?? "").split(";").map((s) => s.trim()).filter((s) => s.startsWith(`${name}=`));
@@ -108,7 +182,7 @@ async function postureSessionBinding(sessionId) {
108
182
  function validOrigin(origin) {
109
183
  try {
110
184
  const url = new URL(origin);
111
- return url.protocol === "https:" && url.origin === origin;
185
+ return url.protocol === "https:" && url.origin === origin && /^[^.*][^*]*$/.test(url.hostname);
112
186
  } catch {
113
187
  return false;
114
188
  }
@@ -123,31 +197,101 @@ async function signBrowserPosture(posture, privateKey, keyId) {
123
197
  kid: keyId
124
198
  }).setIssuer(POSTURE_ISSUER).setAudience(claims.origin).sign(key);
125
199
  }
126
- async function verifyBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
127
- if (!token || token.length > 3800 || !browserSessionId || browserSessionId.length > 255 || !validOrigin(config.origin) || config.publicKey.d || config.publicKey.kty !== "EC" || config.publicKey.crv !== "P-256") return void 0;
200
+ const BASE64URL = /^[A-Za-z0-9_-]+$/;
201
+ const rejected = (reason) => ({
202
+ status: "rejected",
203
+ reason
204
+ });
205
+ const postureOutcomeReport = (outcome) => outcome.status === "verified" ? { status: "verified" } : outcome;
206
+ const verifiedPosture = (outcome) => outcome.status === "verified" ? outcome.posture : void 0;
207
+ async function inspectBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
208
+ if (!token) return { status: "absent" };
209
+ if (!browserSessionId || browserSessionId.length > 255) return rejected("session-missing");
210
+ const parts = token.split(".");
211
+ if (token.length > 3800 || parts.length !== 3 || !parts.every((part) => BASE64URL.test(part)) || parts[0].length % 4 === 1) return rejected("malformed");
212
+ let header;
128
213
  try {
129
- const publicKey = require_project_verification_key.projectVerificationKey(token, config, now);
130
- if (!publicKey) return void 0;
131
- const key = await (0, jose.importJWK)(publicKey, "ES256");
132
- const { payload, protectedHeader } = await (0, jose.jwtVerify)(token, key, {
133
- algorithms: ["ES256"],
134
- issuer: POSTURE_ISSUER,
135
- audience: config.origin,
136
- typ: POSTURE_TYPE,
137
- currentDate: /* @__PURE__ */ new Date(now * 1e3)
138
- });
139
- if ("crit" in protectedHeader || "b64" in protectedHeader || Array.isArray(payload.aud) && payload.aud.some((audience) => typeof audience !== "string")) return void 0;
140
- const parsed = BrowserPostureSchema.safeParse(payload);
141
- if (!parsed.success) return void 0;
142
- const claims = parsed.data;
143
- if (claims.project_id !== projectId || claims.origin !== config.origin || claims.iat > now + 5 || claims.exp <= now || claims.exp <= claims.iat || claims.exp - claims.iat > 120 || claims.binding !== await postureSessionBinding(browserSessionId)) return void 0;
144
- return claims;
214
+ header = (0, jose.decodeProtectedHeader)(token);
145
215
  } catch {
146
- return;
216
+ return rejected("malformed");
147
217
  }
218
+ if (header.alg !== "ES256" || header.typ !== "checkpoint-posture+jwt" || typeof header.kid !== "string" || "crit" in header || "b64" in header) return rejected("malformed");
219
+ const publicKey = validOrigin(config.origin) && !config.publicKey.d && config.publicKey.kty === "EC" && config.publicKey.crv === "P-256" ? require_project_verification_key.projectVerificationKey(token, config, now) : void 0;
220
+ const key = publicKey && await (0, jose.importJWK)(publicKey, "ES256").catch(() => void 0);
221
+ if (!key) return rejected("unknown-key");
222
+ let signed;
223
+ try {
224
+ signed = await (0, jose.compactVerify)(token, key, { algorithms: ["ES256"] });
225
+ } catch {
226
+ return rejected("bad-signature");
227
+ }
228
+ let json;
229
+ try {
230
+ json = JSON.parse(new TextDecoder().decode(signed.payload));
231
+ } catch {
232
+ return rejected("malformed");
233
+ }
234
+ const record$1 = require_schemas.record(require_schemas.string(), require_schemas.unknown()).safeParse(json);
235
+ if (!record$1.success) return rejected("invalid-claims");
236
+ const audiences = [record$1.data.aud].flat();
237
+ if (audiences.some((audience) => typeof audience !== "string")) return rejected("malformed");
238
+ const notBefore = record$1.data.nbf;
239
+ const parsed = BrowserPostureSchema.safeParse(record$1.data);
240
+ if (!parsed.success || record$1.data.iss !== "checkpoint:browser-posture:v1" || notBefore !== void 0 && typeof notBefore !== "number" || record$1.data.origin !== parsed.data.origin || !validOrigin(parsed.data.origin)) return rejected("invalid-claims");
241
+ const claims = parsed.data;
242
+ if (claims.project_id !== projectId) return rejected("project-mismatch");
243
+ if (claims.origin !== config.origin && !require_posture_origins.matchAllowedOrigin(claims.origin, config.origins ?? [])) return rejected("origin-mismatch");
244
+ if (!audiences.includes(claims.origin)) return rejected("audience-mismatch");
245
+ if (claims.exp <= now) return rejected("expired");
246
+ if (claims.iat > now + 5 || notBefore !== void 0 && notBefore > now) return rejected("not-yet-valid");
247
+ if (claims.exp <= claims.iat || claims.exp - claims.iat > 120) return rejected("invalid-claims");
248
+ if (claims.binding !== await postureSessionBinding(browserSessionId)) return rejected("binding-mismatch");
249
+ return {
250
+ status: "verified",
251
+ posture: claims
252
+ };
253
+ }
254
+ async function verifyBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
255
+ return verifiedPosture(await inspectBrowserPosture(token, config, projectId, browserSessionId, now));
256
+ }
257
+ /**
258
+ * Request headers a page sends when its posture cookies cannot reach the
259
+ * server: a request to another host (the cookies are host-only) or a browser
260
+ * that blocks cookies. The page reads both values from the beacon's
261
+ * `onReceipt`.
262
+ */
263
+ const POSTURE_HEADER = "kya-posture";
264
+ const POSTURE_SESSION_HEADER = "kya-posture-session";
265
+ /** The `PostureRequest` of any header store, read through its own lowercase-name getter. */
266
+ function postureRequestFromHeaders(get) {
267
+ const cookie = get("cookie");
268
+ return {
269
+ cookie: Array.isArray(cookie) ? cookie.join("; ") : cookie,
270
+ posture: get(POSTURE_HEADER),
271
+ session: get(POSTURE_SESSION_HEADER)
272
+ };
273
+ }
274
+ /**
275
+ * A header, when the request carries a non-empty one, wins over its cookie.
276
+ * A header sent twice, or joined into one comma-separated value, is ambiguous,
277
+ * so neither copy is trusted and the cookie is not consulted either: the page
278
+ * chose the header. Every runtime applies the same rule
279
+ * (`tests/browser-posture/vectors.json` `requests`).
280
+ */
281
+ function postureRequestValue(header, cookieHeader, cookieName) {
282
+ const values = (Array.isArray(header) ? header : [header]).map((value) => value?.trim()).filter((value) => Boolean(value));
283
+ if (values.length === 0) return readPostureCookie(cookieHeader, cookieName);
284
+ return values.length === 1 && !values[0].includes(",") ? values[0] : void 0;
285
+ }
286
+ /** Read and verify posture from the `KYA-Posture` headers, falling back to the cookies. */
287
+ async function postureOutcomeFromRequest(request, config, projectId, now) {
288
+ return inspectBrowserPosture(postureRequestValue(request.posture, request.cookie, postureCookieName(projectId)), config, projectId, postureRequestValue(request.session, request.cookie, config.sessionCookieName ?? "_as_beacon_session"), now);
289
+ }
290
+ async function postureFromRequest(request, config, projectId, now) {
291
+ return verifiedPosture(await postureOutcomeFromRequest(request, config, projectId, now));
148
292
  }
149
293
  async function postureFromCookies(header, config, projectId) {
150
- return verifyBrowserPosture(readPostureCookie(header, postureCookieName(projectId)), config, projectId, readPostureCookie(header, config.sessionCookieName ?? "_as_beacon_session"));
294
+ return postureFromRequest({ cookie: header }, config, projectId);
151
295
  }
152
296
  /** Exact paths or an explicit subtree ending in /*. Longest designation wins. */
153
297
  function postureRequiredScopes(config, path) {
@@ -158,8 +302,14 @@ function postureRequiredScopes(config, path) {
158
302
  }
159
303
  /** Validate operator configuration at startup, before any request can depend on it. */
160
304
  function validateBrowserPostureConfig(config, projectId) {
161
- if (!projectId || !require_patterns.VALIDATION_PATTERNS.UUID.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Browser posture requires projectId to be the lowercase project UUID (the friendly id is not accepted)");
305
+ if (!projectId || !require_posture_origins.VALIDATION_PATTERNS.UUID.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Browser posture requires projectId to be the lowercase project UUID (the friendly id is not accepted)");
162
306
  if (!validOrigin(config.origin) || !config.keyId || config.publicKey.kty !== "EC" || config.publicKey.crv !== "P-256" || !config.publicKey.x || !config.publicKey.y || config.publicKey.d) throw new Error("Browser posture requires projectId, an exact HTTPS origin, and a public ES256 key");
307
+ const origins = config.origins ?? [];
308
+ if (origins.length > 20) throw new Error(`Browser posture accepts at most ${20} additional origins`);
309
+ for (const entry of origins) {
310
+ const parsed = require_posture_origins.parseOriginPattern(entry);
311
+ if (!parsed.ok) throw new Error(`Invalid browser posture origin "${entry}": ${parsed.error}`);
312
+ }
163
313
  const paths = /* @__PURE__ */ new Set();
164
314
  for (const route of config.protectedRoutes ?? []) {
165
315
  if (!/^\/(?:[^?#*\\]*)(?:\/\*)?$/.test(route.path) && route.path !== "/*") throw new Error("Invalid integrity-protected path");
@@ -173,18 +323,30 @@ function validateBrowserPostureConfig(config, projectId) {
173
323
  }
174
324
 
175
325
  //#endregion
326
+ exports.BROWSER_POSTURE_REJECTION_REASONS = BROWSER_POSTURE_REJECTION_REASONS;
327
+ exports.BrowserPostureOutcomeSchema = BrowserPostureOutcomeSchema;
328
+ exports.BrowserPostureReportIngestSchema = BrowserPostureReportIngestSchema;
176
329
  exports.BrowserPostureReportSchema = BrowserPostureReportSchema;
177
330
  exports.BrowserPostureSchema = BrowserPostureSchema;
331
+ exports.POSTURE_HEADER = POSTURE_HEADER;
178
332
  exports.POSTURE_ISSUER = POSTURE_ISSUER;
333
+ exports.POSTURE_SESSION_HEADER = POSTURE_SESSION_HEADER;
179
334
  exports.POSTURE_TTL_SECONDS = POSTURE_TTL_SECONDS;
180
335
  exports.POSTURE_TYPE = POSTURE_TYPE;
336
+ exports.POSTURE_VERIFICATION_STATUSES = POSTURE_VERIFICATION_STATUSES;
181
337
  exports.UNSIGNED_BROWSER_AGENT = UNSIGNED_BROWSER_AGENT;
182
338
  exports.behavioralConfidence = behavioralConfidence;
183
339
  exports.browserPostureReport = browserPostureReport;
340
+ exports.inspectBrowserPosture = inspectBrowserPosture;
184
341
  exports.postureCookieName = postureCookieName;
185
342
  exports.postureFromCookies = postureFromCookies;
343
+ exports.postureFromRequest = postureFromRequest;
344
+ exports.postureOutcomeFromRequest = postureOutcomeFromRequest;
345
+ exports.postureOutcomeReport = postureOutcomeReport;
346
+ exports.postureRequestFromHeaders = postureRequestFromHeaders;
186
347
  exports.postureRequiredScopes = postureRequiredScopes;
187
348
  exports.postureSessionBinding = postureSessionBinding;
349
+ exports.postureUpgrade = postureUpgrade;
188
350
  exports.readPostureCookie = readPostureCookie;
189
351
  exports.signBrowserPosture = signBrowserPosture;
190
352
  exports.validateBrowserPostureConfig = validateBrowserPostureConfig;
@@ -1,7 +1,7 @@
1
- import { _ as number, c as boolean, f as guid, h as literal, i as _enum, s as array, v as object, x as string } from "./schemas-DxY-dk9y.mjs";
2
- import { c as VALIDATION_PATTERNS, s as UUID_PATTERN } from "./patterns-DzkGy_qk.mjs";
3
- import { t as projectVerificationKey } from "./project-verification-key-CgSVX9_m.mjs";
4
- import { SignJWT, importJWK, jwtVerify } from "jose";
1
+ import { C as string, T as unknown, c as array, g as literal, i as _enum, l as boolean, p as guid, v as number, x as record, y as object } from "./schemas-7qodsG-Z.mjs";
2
+ import { d as UUID_PATTERN, f as VALIDATION_PATTERNS, n as matchAllowedOrigin, r as parseOriginPattern } from "./posture-origins-Pn-ii-Pp.mjs";
3
+ import { t as projectVerificationKey } from "./project-verification-key-66N4edKn.mjs";
4
+ import { SignJWT, compactVerify, decodeProtectedHeader, importJWK } from "jose";
5
5
 
6
6
  //#region src/browser-posture-cookie.ts
7
7
  /**
@@ -29,8 +29,41 @@ function postureCookieName(projectId) {
29
29
  */
30
30
  const POSTURE_TTL_SECONDS = 120;
31
31
 
32
+ //#endregion
33
+ //#region src/browser-posture-schema.ts
34
+ const BrowserPostureSchema = object({
35
+ v: literal(1),
36
+ project_id: string().min(1).max(128),
37
+ origin: string().url(),
38
+ session_id: guid(),
39
+ binding: string().regex(/^[a-f0-9]{64}$/),
40
+ verdict: _enum([
41
+ "agent-driven",
42
+ "human",
43
+ "insufficient"
44
+ ]),
45
+ score: number().min(0).max(1).nullable(),
46
+ scorer_version: number().int().positive().max(2147483647),
47
+ reasons: array(string().max(160)).max(8),
48
+ automation_disclosed: boolean().default(false),
49
+ automation_corroborated: boolean().default(false),
50
+ detection: object({
51
+ class: _enum(["ai_agent", "bot"]),
52
+ name: string().min(1).max(64).regex(/^[^\p{Cc}]+$/u),
53
+ confidence: number().int().min(0).max(100)
54
+ }).optional(),
55
+ cnf: object({ jkt: string().min(1).max(255) }).optional(),
56
+ iat: number().int().nonnegative(),
57
+ exp: number().int().positive()
58
+ });
59
+
32
60
  //#endregion
33
61
  //#region src/browser-posture-report.ts
62
+ const POSTURE_VERIFICATION_STATUSES = [
63
+ "verified",
64
+ "absent",
65
+ "rejected"
66
+ ];
34
67
  /** Audit projection: no token, cookie binding, raw counters, or credential fields. */
35
68
  const BrowserPostureReportSchema = object({
36
69
  projectId: string().min(1).max(128),
@@ -47,6 +80,31 @@ const BrowserPostureReportSchema = object({
47
80
  expiresAt: number().int().positive(),
48
81
  source: literal("verified-posture")
49
82
  });
83
+ const BROWSER_POSTURE_REJECTION_REASONS = [
84
+ "malformed",
85
+ "unknown-key",
86
+ "bad-signature",
87
+ "invalid-claims",
88
+ "project-mismatch",
89
+ "origin-mismatch",
90
+ "audience-mismatch",
91
+ "expired",
92
+ "not-yet-valid",
93
+ "binding-mismatch",
94
+ "session-missing"
95
+ ];
96
+ const BrowserPostureOutcomeSchema = object({
97
+ status: _enum(POSTURE_VERIFICATION_STATUSES),
98
+ reason: _enum(BROWSER_POSTURE_REJECTION_REASONS).optional()
99
+ }).refine((outcome) => outcome.status === "rejected" === (outcome.reason !== void 0), {
100
+ message: "reason is required if and only if status is rejected",
101
+ path: ["reason"]
102
+ });
103
+ const BROWSER_POSTURE_REASON_PATTERN = /^[a-z][a-z-]{0,31}$/;
104
+ const BROWSER_POSTURE_REJECTIONS_MAX_ENTRIES = 50;
105
+ const BROWSER_POSTURE_REJECTION_COUNT_MAX = 1e6;
106
+ const BrowserPostureRejectionsSchema = record(string(), unknown()).transform((counts) => Object.fromEntries(Object.entries(counts).filter((entry) => BROWSER_POSTURE_REASON_PATTERN.test(entry[0]) && typeof entry[1] === "number" && Number.isInteger(entry[1]) && entry[1] > 0).slice(0, 50).map(([reason, count]) => [reason, Math.min(count, BROWSER_POSTURE_REJECTION_COUNT_MAX)])));
107
+ const BrowserPostureReportIngestSchema = BrowserPostureReportSchema.extend({ score: BrowserPostureReportSchema.shape.score.default(null) });
50
108
  function browserPostureReport(posture) {
51
109
  return {
52
110
  projectId: posture.project_id,
@@ -69,27 +127,43 @@ const UNSIGNED_BROWSER_AGENT = {
69
127
  verificationMethod: "behavioral"
70
128
  };
71
129
  const behavioralConfidence = (score) => Math.min(85, Math.max(50, Math.round((score ?? .5) * 100)));
130
+ function postureUpgrade(posture) {
131
+ const { detection, reasons } = posture;
132
+ const verificationMethod = "behavioral";
133
+ if (detection) return {
134
+ detectionClass: detection.class,
135
+ isAgent: true,
136
+ agentName: detection.name,
137
+ confidence: detection.confidence,
138
+ verificationMethod,
139
+ reasons
140
+ };
141
+ if (posture.automation_disclosed) return {
142
+ detectionClass: "bot",
143
+ isAgent: true,
144
+ agentName: "Automation Tools",
145
+ confidence: 80,
146
+ verificationMethod,
147
+ reasons
148
+ };
149
+ if (posture.verdict === "agent-driven") return {
150
+ detectionClass: UNSIGNED_BROWSER_AGENT.detectionClass,
151
+ isAgent: true,
152
+ agentName: UNSIGNED_BROWSER_AGENT.agentType,
153
+ confidence: behavioralConfidence(posture.score),
154
+ verificationMethod,
155
+ reasons
156
+ };
157
+ if (posture.automation_corroborated) return {
158
+ detectionClass: "incomplete_data",
159
+ isAgent: false,
160
+ confidence: 40,
161
+ verificationMethod,
162
+ reasons
163
+ };
164
+ }
72
165
  const POSTURE_ISSUER = "checkpoint:browser-posture:v1";
73
166
  const POSTURE_TYPE = "checkpoint-posture+jwt";
74
- const BrowserPostureSchema = object({
75
- v: literal(1),
76
- project_id: string().min(1).max(128),
77
- origin: string().url(),
78
- session_id: guid(),
79
- binding: string().regex(/^[a-f0-9]{64}$/),
80
- verdict: _enum([
81
- "agent-driven",
82
- "human",
83
- "insufficient"
84
- ]),
85
- score: number().min(0).max(1).nullable(),
86
- scorer_version: number().int().positive().max(2147483647),
87
- reasons: array(string().max(160)).max(8),
88
- automation_disclosed: boolean().default(false),
89
- automation_corroborated: boolean().default(false),
90
- iat: number().int().nonnegative(),
91
- exp: number().int().positive()
92
- });
93
167
  /** Duplicate cookies are ambiguous, so none is trusted. */
94
168
  function readPostureCookie(header, name) {
95
169
  const matches = (header ?? "").split(";").map((s) => s.trim()).filter((s) => s.startsWith(`${name}=`));
@@ -107,7 +181,7 @@ async function postureSessionBinding(sessionId) {
107
181
  function validOrigin(origin) {
108
182
  try {
109
183
  const url = new URL(origin);
110
- return url.protocol === "https:" && url.origin === origin;
184
+ return url.protocol === "https:" && url.origin === origin && /^[^.*][^*]*$/.test(url.hostname);
111
185
  } catch {
112
186
  return false;
113
187
  }
@@ -122,31 +196,101 @@ async function signBrowserPosture(posture, privateKey, keyId) {
122
196
  kid: keyId
123
197
  }).setIssuer(POSTURE_ISSUER).setAudience(claims.origin).sign(key);
124
198
  }
125
- async function verifyBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
126
- if (!token || token.length > 3800 || !browserSessionId || browserSessionId.length > 255 || !validOrigin(config.origin) || config.publicKey.d || config.publicKey.kty !== "EC" || config.publicKey.crv !== "P-256") return void 0;
199
+ const BASE64URL = /^[A-Za-z0-9_-]+$/;
200
+ const rejected = (reason) => ({
201
+ status: "rejected",
202
+ reason
203
+ });
204
+ const postureOutcomeReport = (outcome) => outcome.status === "verified" ? { status: "verified" } : outcome;
205
+ const verifiedPosture = (outcome) => outcome.status === "verified" ? outcome.posture : void 0;
206
+ async function inspectBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
207
+ if (!token) return { status: "absent" };
208
+ if (!browserSessionId || browserSessionId.length > 255) return rejected("session-missing");
209
+ const parts = token.split(".");
210
+ if (token.length > 3800 || parts.length !== 3 || !parts.every((part) => BASE64URL.test(part)) || parts[0].length % 4 === 1) return rejected("malformed");
211
+ let header;
127
212
  try {
128
- const publicKey = projectVerificationKey(token, config, now);
129
- if (!publicKey) return void 0;
130
- const key = await importJWK(publicKey, "ES256");
131
- const { payload, protectedHeader } = await jwtVerify(token, key, {
132
- algorithms: ["ES256"],
133
- issuer: POSTURE_ISSUER,
134
- audience: config.origin,
135
- typ: POSTURE_TYPE,
136
- currentDate: /* @__PURE__ */ new Date(now * 1e3)
137
- });
138
- if ("crit" in protectedHeader || "b64" in protectedHeader || Array.isArray(payload.aud) && payload.aud.some((audience) => typeof audience !== "string")) return void 0;
139
- const parsed = BrowserPostureSchema.safeParse(payload);
140
- if (!parsed.success) return void 0;
141
- const claims = parsed.data;
142
- if (claims.project_id !== projectId || claims.origin !== config.origin || claims.iat > now + 5 || claims.exp <= now || claims.exp <= claims.iat || claims.exp - claims.iat > 120 || claims.binding !== await postureSessionBinding(browserSessionId)) return void 0;
143
- return claims;
213
+ header = decodeProtectedHeader(token);
144
214
  } catch {
145
- return;
215
+ return rejected("malformed");
146
216
  }
217
+ if (header.alg !== "ES256" || header.typ !== "checkpoint-posture+jwt" || typeof header.kid !== "string" || "crit" in header || "b64" in header) return rejected("malformed");
218
+ const publicKey = validOrigin(config.origin) && !config.publicKey.d && config.publicKey.kty === "EC" && config.publicKey.crv === "P-256" ? projectVerificationKey(token, config, now) : void 0;
219
+ const key = publicKey && await importJWK(publicKey, "ES256").catch(() => void 0);
220
+ if (!key) return rejected("unknown-key");
221
+ let signed;
222
+ try {
223
+ signed = await compactVerify(token, key, { algorithms: ["ES256"] });
224
+ } catch {
225
+ return rejected("bad-signature");
226
+ }
227
+ let json;
228
+ try {
229
+ json = JSON.parse(new TextDecoder().decode(signed.payload));
230
+ } catch {
231
+ return rejected("malformed");
232
+ }
233
+ const record$1 = record(string(), unknown()).safeParse(json);
234
+ if (!record$1.success) return rejected("invalid-claims");
235
+ const audiences = [record$1.data.aud].flat();
236
+ if (audiences.some((audience) => typeof audience !== "string")) return rejected("malformed");
237
+ const notBefore = record$1.data.nbf;
238
+ const parsed = BrowserPostureSchema.safeParse(record$1.data);
239
+ if (!parsed.success || record$1.data.iss !== "checkpoint:browser-posture:v1" || notBefore !== void 0 && typeof notBefore !== "number" || record$1.data.origin !== parsed.data.origin || !validOrigin(parsed.data.origin)) return rejected("invalid-claims");
240
+ const claims = parsed.data;
241
+ if (claims.project_id !== projectId) return rejected("project-mismatch");
242
+ if (claims.origin !== config.origin && !matchAllowedOrigin(claims.origin, config.origins ?? [])) return rejected("origin-mismatch");
243
+ if (!audiences.includes(claims.origin)) return rejected("audience-mismatch");
244
+ if (claims.exp <= now) return rejected("expired");
245
+ if (claims.iat > now + 5 || notBefore !== void 0 && notBefore > now) return rejected("not-yet-valid");
246
+ if (claims.exp <= claims.iat || claims.exp - claims.iat > 120) return rejected("invalid-claims");
247
+ if (claims.binding !== await postureSessionBinding(browserSessionId)) return rejected("binding-mismatch");
248
+ return {
249
+ status: "verified",
250
+ posture: claims
251
+ };
252
+ }
253
+ async function verifyBrowserPosture(token, config, projectId, browserSessionId, now = Math.floor(Date.now() / 1e3)) {
254
+ return verifiedPosture(await inspectBrowserPosture(token, config, projectId, browserSessionId, now));
255
+ }
256
+ /**
257
+ * Request headers a page sends when its posture cookies cannot reach the
258
+ * server: a request to another host (the cookies are host-only) or a browser
259
+ * that blocks cookies. The page reads both values from the beacon's
260
+ * `onReceipt`.
261
+ */
262
+ const POSTURE_HEADER = "kya-posture";
263
+ const POSTURE_SESSION_HEADER = "kya-posture-session";
264
+ /** The `PostureRequest` of any header store, read through its own lowercase-name getter. */
265
+ function postureRequestFromHeaders(get) {
266
+ const cookie = get("cookie");
267
+ return {
268
+ cookie: Array.isArray(cookie) ? cookie.join("; ") : cookie,
269
+ posture: get(POSTURE_HEADER),
270
+ session: get(POSTURE_SESSION_HEADER)
271
+ };
272
+ }
273
+ /**
274
+ * A header, when the request carries a non-empty one, wins over its cookie.
275
+ * A header sent twice, or joined into one comma-separated value, is ambiguous,
276
+ * so neither copy is trusted and the cookie is not consulted either: the page
277
+ * chose the header. Every runtime applies the same rule
278
+ * (`tests/browser-posture/vectors.json` `requests`).
279
+ */
280
+ function postureRequestValue(header, cookieHeader, cookieName) {
281
+ const values = (Array.isArray(header) ? header : [header]).map((value) => value?.trim()).filter((value) => Boolean(value));
282
+ if (values.length === 0) return readPostureCookie(cookieHeader, cookieName);
283
+ return values.length === 1 && !values[0].includes(",") ? values[0] : void 0;
284
+ }
285
+ /** Read and verify posture from the `KYA-Posture` headers, falling back to the cookies. */
286
+ async function postureOutcomeFromRequest(request, config, projectId, now) {
287
+ return inspectBrowserPosture(postureRequestValue(request.posture, request.cookie, postureCookieName(projectId)), config, projectId, postureRequestValue(request.session, request.cookie, config.sessionCookieName ?? "_as_beacon_session"), now);
288
+ }
289
+ async function postureFromRequest(request, config, projectId, now) {
290
+ return verifiedPosture(await postureOutcomeFromRequest(request, config, projectId, now));
147
291
  }
148
292
  async function postureFromCookies(header, config, projectId) {
149
- return verifyBrowserPosture(readPostureCookie(header, postureCookieName(projectId)), config, projectId, readPostureCookie(header, config.sessionCookieName ?? "_as_beacon_session"));
293
+ return postureFromRequest({ cookie: header }, config, projectId);
150
294
  }
151
295
  /** Exact paths or an explicit subtree ending in /*. Longest designation wins. */
152
296
  function postureRequiredScopes(config, path) {
@@ -159,6 +303,12 @@ function postureRequiredScopes(config, path) {
159
303
  function validateBrowserPostureConfig(config, projectId) {
160
304
  if (!projectId || !VALIDATION_PATTERNS.UUID.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Browser posture requires projectId to be the lowercase project UUID (the friendly id is not accepted)");
161
305
  if (!validOrigin(config.origin) || !config.keyId || config.publicKey.kty !== "EC" || config.publicKey.crv !== "P-256" || !config.publicKey.x || !config.publicKey.y || config.publicKey.d) throw new Error("Browser posture requires projectId, an exact HTTPS origin, and a public ES256 key");
306
+ const origins = config.origins ?? [];
307
+ if (origins.length > 20) throw new Error(`Browser posture accepts at most ${20} additional origins`);
308
+ for (const entry of origins) {
309
+ const parsed = parseOriginPattern(entry);
310
+ if (!parsed.ok) throw new Error(`Invalid browser posture origin "${entry}": ${parsed.error}`);
311
+ }
162
312
  const paths = /* @__PURE__ */ new Set();
163
313
  for (const route of config.protectedRoutes ?? []) {
164
314
  if (!/^\/(?:[^?#*\\]*)(?:\/\*)?$/.test(route.path) && route.path !== "/*") throw new Error("Invalid integrity-protected path");
@@ -172,5 +322,5 @@ function validateBrowserPostureConfig(config, projectId) {
172
322
  }
173
323
 
174
324
  //#endregion
175
- export { BrowserPostureReportSchema, BrowserPostureSchema, POSTURE_ISSUER, POSTURE_TTL_SECONDS, POSTURE_TYPE, UNSIGNED_BROWSER_AGENT, behavioralConfidence, browserPostureReport, postureCookieName, postureFromCookies, postureRequiredScopes, postureSessionBinding, readPostureCookie, signBrowserPosture, validateBrowserPostureConfig, verifyBrowserPosture };
325
+ export { BROWSER_POSTURE_REJECTION_REASONS, BrowserPostureOutcomeSchema, BrowserPostureReportIngestSchema, BrowserPostureReportSchema, BrowserPostureSchema, POSTURE_HEADER, POSTURE_ISSUER, POSTURE_SESSION_HEADER, POSTURE_TTL_SECONDS, POSTURE_TYPE, POSTURE_VERIFICATION_STATUSES, UNSIGNED_BROWSER_AGENT, behavioralConfidence, browserPostureReport, inspectBrowserPosture, postureCookieName, postureFromCookies, postureFromRequest, postureOutcomeFromRequest, postureOutcomeReport, postureRequestFromHeaders, postureRequiredScopes, postureSessionBinding, postureUpgrade, readPostureCookie, signBrowserPosture, validateBrowserPostureConfig, verifyBrowserPosture };
176
326
  //# sourceMappingURL=browser-posture.mjs.map