@kya-os/checkpoint-shared 1.10.0 → 1.11.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 +89 -0
- package/dist/base64url-BbVG8f-v.js +65 -0
- package/dist/base64url-D2MvsR20.mjs +49 -0
- package/dist/base64url-D2MvsR20.mjs.map +1 -0
- package/dist/beacon-forward-secret/index.d.mts +4 -0
- package/dist/beacon-forward-secret/index.d.mts.map +1 -0
- package/dist/beacon-forward-secret/index.d.ts +4 -0
- package/dist/beacon-forward-secret/index.d.ts.map +1 -0
- package/dist/beacon-forward-secret/index.js +15 -0
- package/dist/beacon-forward-secret/index.mjs +15 -0
- package/dist/beacon-forward-secret/index.mjs.map +1 -0
- package/dist/beacon-types/index.d.mts +53 -1
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +53 -1
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +86 -1
- package/dist/beacon-types/index.mjs +77 -2
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/{browser-posture-5fPrsxx7.d.mts → browser-posture-WPk0kl9u.d.mts} +18 -1
- package/dist/browser-posture-WPk0kl9u.d.mts.map +1 -0
- package/dist/{browser-posture-CCR1kh5e.d.ts → browser-posture-_y6BcdXw.d.ts} +18 -1
- package/dist/browser-posture-_y6BcdXw.d.ts.map +1 -0
- package/dist/browser-posture-cookie.mjs.map +1 -1
- package/dist/browser-posture-proof-verifier.js +136 -5
- package/dist/browser-posture-proof-verifier.mjs +134 -2
- package/dist/browser-posture-proof-verifier.mjs.map +1 -0
- package/dist/browser-posture-proof.d.mts +1 -1
- package/dist/browser-posture-proof.d.ts +1 -1
- package/dist/browser-posture-proof.js +1 -1
- package/dist/browser-posture-proof.mjs +1 -1
- package/dist/browser-posture-report.d.mts +17 -0
- package/dist/browser-posture-report.d.mts.map +1 -1
- package/dist/browser-posture-report.d.ts +17 -0
- package/dist/browser-posture-report.d.ts.map +1 -1
- package/dist/browser-posture.d.mts +1 -1
- package/dist/browser-posture.d.ts +1 -1
- package/dist/browser-posture.js +18 -1
- package/dist/browser-posture.mjs +18 -1
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/browser.d.mts +10 -0
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +10 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/canonical-signer/index.d.mts.map +1 -1
- package/dist/canonical-signer/index.d.ts.map +1 -1
- package/dist/canonical-signer/index.js +0 -4
- package/dist/canonical-signer/index.mjs +0 -4
- package/dist/canonical-signer/index.mjs.map +1 -1
- package/dist/{client-ip-B7w-uHfS.d.ts → client-ip-8KneiMK0.d.mts} +12 -2
- package/dist/{client-ip-B7w-uHfS.d.mts.map → client-ip-8KneiMK0.d.mts.map} +1 -1
- package/dist/{client-ip-B7w-uHfS.d.mts → client-ip-8KneiMK0.d.ts} +12 -2
- package/dist/{client-ip-B7w-uHfS.d.ts.map → client-ip-8KneiMK0.d.ts.map} +1 -1
- package/dist/{client-ip-B8wFzJ5f.js → client-ip-BEmLC4I4.js} +71 -0
- package/dist/{client-ip-DIJyr6px.mjs → client-ip-DlHx7GGh.mjs} +61 -2
- package/dist/client-ip-DlHx7GGh.mjs.map +1 -0
- package/dist/client-ip.d.mts +2 -2
- package/dist/client-ip.d.ts +2 -2
- package/dist/client-ip.js +3 -1
- package/dist/client-ip.mjs +2 -2
- package/dist/deploy/index.d.mts.map +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +5 -1
- package/dist/deploy/index.mjs +5 -1
- package/dist/deploy/index.mjs.map +1 -1
- package/dist/{detection-reason-mapping-CQexNvR7.d.ts → detection-reason-mapping-BemDaDED.d.mts} +5 -2
- package/dist/detection-reason-mapping-BemDaDED.d.mts.map +1 -0
- package/dist/{detection-reason-mapping-CQexNvR7.d.mts → detection-reason-mapping-BemDaDED.d.ts} +5 -2
- package/dist/detection-reason-mapping-BemDaDED.d.ts.map +1 -0
- package/dist/{detection-reason-mapping-B9RSkOs8.js → detection-reason-mapping-BxYaQ8kb.js} +33 -8
- package/dist/{detection-reason-mapping-BGymWIPl.mjs → detection-reason-mapping-j-7bXsVb.mjs} +29 -10
- package/dist/detection-reason-mapping-j-7bXsVb.mjs.map +1 -0
- package/dist/errors/index.d.mts +4 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +24 -8
- package/dist/errors/index.mjs +24 -8
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{fetcher-CZfLcbRZ.d.mts → fetcher-CTKz07jg.d.mts} +12 -2
- package/dist/fetcher-CTKz07jg.d.mts.map +1 -0
- package/dist/{fetcher-CCw4Q95g.d.ts → fetcher-DCr920hx.d.ts} +12 -2
- package/dist/fetcher-DCr920hx.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +1 -1
- package/dist/gateway-client-ip.mjs +1 -1
- package/dist/identity-cookie/index.d.mts +14 -0
- package/dist/identity-cookie/index.d.mts.map +1 -0
- package/dist/identity-cookie/index.d.ts +14 -0
- package/dist/identity-cookie/index.d.ts.map +1 -0
- package/dist/identity-cookie/index.js +45 -0
- package/dist/identity-cookie/index.mjs +43 -0
- package/dist/identity-cookie/index.mjs.map +1 -0
- package/dist/index.d.mts +598 -142
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +598 -142
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +793 -198
- package/dist/index.mjs +743 -188
- package/dist/index.mjs.map +1 -1
- package/dist/kya-http.d.mts +2 -2
- package/dist/kya-http.d.ts +2 -2
- package/dist/kya-http.js +2 -1
- package/dist/kya-http.mjs +2 -2
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -1
- package/dist/patterns-CdTh7LU2.d.mts +35 -0
- package/dist/patterns-CdTh7LU2.d.mts.map +1 -0
- package/dist/patterns-CdTh7LU2.d.ts +35 -0
- package/dist/patterns-CdTh7LU2.d.ts.map +1 -0
- package/dist/{patterns-CiMpbdAF.js → patterns-CnNxRnaK.js} +3 -130
- package/dist/{patterns-D4OAsNQY.mjs → patterns-CpRk9R3M.mjs} +5 -96
- package/dist/patterns-CpRk9R3M.mjs.map +1 -0
- package/dist/patterns.d.mts +2 -2
- package/dist/patterns.d.ts +2 -2
- package/dist/patterns.js +1 -7
- package/dist/patterns.mjs +2 -2
- package/dist/policy/fetcher.d.mts +2 -2
- package/dist/policy/fetcher.d.ts +2 -2
- package/dist/policy/fetcher.js +100 -8
- package/dist/policy/fetcher.mjs +99 -9
- package/dist/policy/fetcher.mjs.map +1 -1
- package/dist/proxy-assertion-mapping-BVwXVSMZ.mjs +81 -0
- package/dist/proxy-assertion-mapping-BVwXVSMZ.mjs.map +1 -0
- package/dist/proxy-assertion-mapping-BxhENrcY.d.mts +70 -0
- package/dist/proxy-assertion-mapping-BxhENrcY.d.mts.map +1 -0
- package/dist/proxy-assertion-mapping-D64AyZfG.js +85 -0
- package/dist/proxy-assertion-mapping-DhAynFqG.d.ts +70 -0
- package/dist/proxy-assertion-mapping-DhAynFqG.d.ts.map +1 -0
- package/dist/proxy-assertions.d.mts +2 -0
- package/dist/proxy-assertions.d.ts +2 -0
- package/dist/proxy-assertions.js +4 -0
- package/dist/proxy-assertions.mjs +3 -0
- package/dist/reason-codes.d.mts +2 -2
- package/dist/reason-codes.d.ts +2 -2
- package/dist/reason-codes.js +3 -2
- package/dist/reason-codes.mjs +2 -2
- package/dist/{registered-sid-CnWIU_l1.d.ts → registered-sid-BgDhdj2l.d.mts} +13 -2
- package/dist/registered-sid-BgDhdj2l.d.mts.map +1 -0
- package/dist/{registered-sid-CnWIU_l1.d.mts → registered-sid-BgDhdj2l.d.ts} +13 -2
- package/dist/registered-sid-BgDhdj2l.d.ts.map +1 -0
- package/dist/{registered-sid-BZfDOfXy.js → registered-sid-DG1tSSvl.js} +67 -12
- package/dist/{registered-sid-CS9V8nPr.mjs → registered-sid-D__xiDPu.mjs} +63 -14
- package/dist/registered-sid-D__xiDPu.mjs.map +1 -0
- package/dist/timezone-country-B6PkDyNP.d.mts +15 -0
- package/dist/timezone-country-B6PkDyNP.d.mts.map +1 -0
- package/dist/timezone-country-B6PkDyNP.d.ts +15 -0
- package/dist/timezone-country-B6PkDyNP.d.ts.map +1 -0
- package/dist/timezone-country-CROxU2Tl.js +505 -0
- package/dist/timezone-country-CrrnkOdy.mjs +489 -0
- package/dist/timezone-country-CrrnkOdy.mjs.map +1 -0
- package/dist/timezone-country.d.mts +2 -0
- package/dist/timezone-country.d.ts +2 -0
- package/dist/timezone-country.js +6 -0
- package/dist/timezone-country.mjs +3 -0
- package/dist/tool-protection/index.mjs.map +1 -1
- package/fixtures/detection/cloudflare-alias-parity.json +383 -0
- package/fixtures/detection/reason-codes.json +3 -1
- package/fixtures/detection/signal-exposure-example.json +1 -1
- package/fixtures/iana-tzdata/backward +375 -0
- package/fixtures/iana-tzdata/renamed-zones.json +21 -0
- package/fixtures/iana-tzdata/version +1 -0
- package/fixtures/iana-tzdata/zone.tab +448 -0
- package/fixtures/workbench/management-session.v1.json +20 -0
- package/fixtures/workbench/model-credentials.v1.json +8 -0
- package/fixtures/workbench/task-grant.v1.json +37 -0
- package/package.json +25 -3
- package/src/data/compiled/merged-rules.json +9 -7
- package/dist/browser-posture-5fPrsxx7.d.mts.map +0 -1
- package/dist/browser-posture-CCR1kh5e.d.ts.map +0 -1
- package/dist/browser-posture-proof-verifier-DvsOmFrM.js +0 -202
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs +0 -180
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs.map +0 -1
- package/dist/client-ip-DIJyr6px.mjs.map +0 -1
- package/dist/detection-reason-mapping-BGymWIPl.mjs.map +0 -1
- package/dist/detection-reason-mapping-CQexNvR7.d.mts.map +0 -1
- package/dist/detection-reason-mapping-CQexNvR7.d.ts.map +0 -1
- package/dist/fetcher-CCw4Q95g.d.ts.map +0 -1
- package/dist/fetcher-CZfLcbRZ.d.mts.map +0 -1
- package/dist/patterns-Bp40cwh2.d.mts +0 -110
- package/dist/patterns-Bp40cwh2.d.mts.map +0 -1
- package/dist/patterns-Bp40cwh2.d.ts +0 -110
- package/dist/patterns-Bp40cwh2.d.ts.map +0 -1
- package/dist/patterns-D4OAsNQY.mjs.map +0 -1
- package/dist/registered-sid-CS9V8nPr.mjs.map +0 -1
- package/dist/registered-sid-CnWIU_l1.d.mts.map +0 -1
- package/dist/registered-sid-CnWIU_l1.d.ts.map +0 -1
|
@@ -148,17 +148,17 @@ function requestDeclaresBody(headers) {
|
|
|
148
148
|
*/
|
|
149
149
|
/** Largest kya-http/2 signed body a host hands the engine. */
|
|
150
150
|
const KYA_SIGNED_BODY_MAX_BYTES = 1048576;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
async function readBodyBounded(request, maxBytes) {
|
|
151
|
+
const EXPIRED = Symbol("expired");
|
|
152
|
+
function expiryAfter(deadlineMs) {
|
|
153
|
+
let timer;
|
|
154
|
+
return {
|
|
155
|
+
expired: new Promise((resolve) => {
|
|
156
|
+
timer = setTimeout(() => resolve(EXPIRED), deadlineMs);
|
|
157
|
+
}),
|
|
158
|
+
clear: () => clearTimeout(timer)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
async function readBodyBounded(request, maxBytes, options) {
|
|
162
162
|
const declaredLength = Number(request.headers.get("content-length"));
|
|
163
163
|
if (Number.isFinite(declaredLength) && declaredLength > maxBytes) return { failure: "too-large" };
|
|
164
164
|
const stream = request.clone().body;
|
|
@@ -166,9 +166,18 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
166
166
|
const reader = stream.getReader();
|
|
167
167
|
const chunks = [];
|
|
168
168
|
let total = 0;
|
|
169
|
+
const expiry = options === void 0 ? void 0 : expiryAfter(options.deadlineMs);
|
|
169
170
|
try {
|
|
170
171
|
for (;;) {
|
|
171
|
-
const
|
|
172
|
+
const next = await (expiry === void 0 ? reader.read() : Promise.race([reader.read(), expiry.expired]));
|
|
173
|
+
if (next === EXPIRED) {
|
|
174
|
+
reader.cancel().catch(() => void 0);
|
|
175
|
+
return {
|
|
176
|
+
failure: "timed-out",
|
|
177
|
+
bytesRead: total
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const { done, value } = next;
|
|
172
181
|
if (done) break;
|
|
173
182
|
total += value.byteLength;
|
|
174
183
|
if (total > maxBytes) {
|
|
@@ -179,6 +188,8 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
179
188
|
}
|
|
180
189
|
} catch {
|
|
181
190
|
return { failure: "unreadable" };
|
|
191
|
+
} finally {
|
|
192
|
+
expiry?.clear();
|
|
182
193
|
}
|
|
183
194
|
const bytes = new Uint8Array(total);
|
|
184
195
|
let offset = 0;
|
|
@@ -189,6 +200,44 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
189
200
|
return { bytes };
|
|
190
201
|
}
|
|
191
202
|
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/mcpi/relayed-request-target.ts
|
|
205
|
+
/**
|
|
206
|
+
* An absolute URL with an authority: an RFC 3986 §3.1 scheme (a letter, then
|
|
207
|
+
* letters, digits, `+`, `-` or `.`, in any case) followed by `://`. A scheme
|
|
208
|
+
* without `//` (`https:/x`, `https:x`) is not one, though a WHATWG URL parser
|
|
209
|
+
* would still read a host from it for a special scheme.
|
|
210
|
+
*/
|
|
211
|
+
const ABSOLUTE_URL = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
212
|
+
/**
|
|
213
|
+
* The request target (path plus query) of a request a caller relays to a
|
|
214
|
+
* Checkpoint enforce endpoint (the gateway Worker's `/__detect/enforce`, the
|
|
215
|
+
* dashboard's `/api/v1/enforce` and `/api/v1/verdict`). The engine verifies a
|
|
216
|
+
* signature over that target, reading `@path` and `@query` from it, with the
|
|
217
|
+
* authority from the relayed `host` header.
|
|
218
|
+
*
|
|
219
|
+
* The SDKs send `url` as an absolute URL (`withCheckpointApi` sends
|
|
220
|
+
* `request.url`), so a `scheme://` URL gives its path and query. Any other `url`
|
|
221
|
+
* is already a request target and is read exactly as sent, less a fragment:
|
|
222
|
+
* resolving it as a URL would read `//host/x` or `/\host/x` as a host and the
|
|
223
|
+
* path `/x`, so a signature over `/x` would verify for it. Without a `url`, the
|
|
224
|
+
* target is `path`. A `url` or `path` that isn't a string counts as absent: the
|
|
225
|
+
* gateway reads its body without validating it.
|
|
226
|
+
*/
|
|
227
|
+
function relayedRequestTarget(url, path) {
|
|
228
|
+
if (typeof url === "string" && url) {
|
|
229
|
+
if (!ABSOLUTE_URL.test(url)) {
|
|
230
|
+
const target = url.split("#", 1)[0];
|
|
231
|
+
return target.startsWith("/") ? target : `/${target}`;
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
const parsed = new URL(url);
|
|
235
|
+
return parsed.pathname + parsed.search;
|
|
236
|
+
} catch {}
|
|
237
|
+
}
|
|
238
|
+
return typeof path === "string" && path ? path : "/";
|
|
239
|
+
}
|
|
240
|
+
|
|
192
241
|
//#endregion
|
|
193
242
|
//#region src/mcpi/anonymous-principal.ts
|
|
194
243
|
/**
|
|
@@ -262,6 +311,12 @@ Object.defineProperty(exports, 'readBodyBounded', {
|
|
|
262
311
|
return readBodyBounded;
|
|
263
312
|
}
|
|
264
313
|
});
|
|
314
|
+
Object.defineProperty(exports, 'relayedRequestTarget', {
|
|
315
|
+
enumerable: true,
|
|
316
|
+
get: function () {
|
|
317
|
+
return relayedRequestTarget;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
265
320
|
Object.defineProperty(exports, 'requestCarriesDelegationProof', {
|
|
266
321
|
enumerable: true,
|
|
267
322
|
get: function () {
|
|
@@ -148,17 +148,17 @@ function requestDeclaresBody(headers) {
|
|
|
148
148
|
*/
|
|
149
149
|
/** Largest kya-http/2 signed body a host hands the engine. */
|
|
150
150
|
const KYA_SIGNED_BODY_MAX_BYTES = 1048576;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
async function readBodyBounded(request, maxBytes) {
|
|
151
|
+
const EXPIRED = Symbol("expired");
|
|
152
|
+
function expiryAfter(deadlineMs) {
|
|
153
|
+
let timer;
|
|
154
|
+
return {
|
|
155
|
+
expired: new Promise((resolve) => {
|
|
156
|
+
timer = setTimeout(() => resolve(EXPIRED), deadlineMs);
|
|
157
|
+
}),
|
|
158
|
+
clear: () => clearTimeout(timer)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
async function readBodyBounded(request, maxBytes, options) {
|
|
162
162
|
const declaredLength = Number(request.headers.get("content-length"));
|
|
163
163
|
if (Number.isFinite(declaredLength) && declaredLength > maxBytes) return { failure: "too-large" };
|
|
164
164
|
const stream = request.clone().body;
|
|
@@ -166,9 +166,18 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
166
166
|
const reader = stream.getReader();
|
|
167
167
|
const chunks = [];
|
|
168
168
|
let total = 0;
|
|
169
|
+
const expiry = options === void 0 ? void 0 : expiryAfter(options.deadlineMs);
|
|
169
170
|
try {
|
|
170
171
|
for (;;) {
|
|
171
|
-
const
|
|
172
|
+
const next = await (expiry === void 0 ? reader.read() : Promise.race([reader.read(), expiry.expired]));
|
|
173
|
+
if (next === EXPIRED) {
|
|
174
|
+
reader.cancel().catch(() => void 0);
|
|
175
|
+
return {
|
|
176
|
+
failure: "timed-out",
|
|
177
|
+
bytesRead: total
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const { done, value } = next;
|
|
172
181
|
if (done) break;
|
|
173
182
|
total += value.byteLength;
|
|
174
183
|
if (total > maxBytes) {
|
|
@@ -179,6 +188,8 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
179
188
|
}
|
|
180
189
|
} catch {
|
|
181
190
|
return { failure: "unreadable" };
|
|
191
|
+
} finally {
|
|
192
|
+
expiry?.clear();
|
|
182
193
|
}
|
|
183
194
|
const bytes = new Uint8Array(total);
|
|
184
195
|
let offset = 0;
|
|
@@ -189,6 +200,44 @@ async function readBodyBounded(request, maxBytes) {
|
|
|
189
200
|
return { bytes };
|
|
190
201
|
}
|
|
191
202
|
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/mcpi/relayed-request-target.ts
|
|
205
|
+
/**
|
|
206
|
+
* An absolute URL with an authority: an RFC 3986 §3.1 scheme (a letter, then
|
|
207
|
+
* letters, digits, `+`, `-` or `.`, in any case) followed by `://`. A scheme
|
|
208
|
+
* without `//` (`https:/x`, `https:x`) is not one, though a WHATWG URL parser
|
|
209
|
+
* would still read a host from it for a special scheme.
|
|
210
|
+
*/
|
|
211
|
+
const ABSOLUTE_URL = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
212
|
+
/**
|
|
213
|
+
* The request target (path plus query) of a request a caller relays to a
|
|
214
|
+
* Checkpoint enforce endpoint (the gateway Worker's `/__detect/enforce`, the
|
|
215
|
+
* dashboard's `/api/v1/enforce` and `/api/v1/verdict`). The engine verifies a
|
|
216
|
+
* signature over that target, reading `@path` and `@query` from it, with the
|
|
217
|
+
* authority from the relayed `host` header.
|
|
218
|
+
*
|
|
219
|
+
* The SDKs send `url` as an absolute URL (`withCheckpointApi` sends
|
|
220
|
+
* `request.url`), so a `scheme://` URL gives its path and query. Any other `url`
|
|
221
|
+
* is already a request target and is read exactly as sent, less a fragment:
|
|
222
|
+
* resolving it as a URL would read `//host/x` or `/\host/x` as a host and the
|
|
223
|
+
* path `/x`, so a signature over `/x` would verify for it. Without a `url`, the
|
|
224
|
+
* target is `path`. A `url` or `path` that isn't a string counts as absent: the
|
|
225
|
+
* gateway reads its body without validating it.
|
|
226
|
+
*/
|
|
227
|
+
function relayedRequestTarget(url, path) {
|
|
228
|
+
if (typeof url === "string" && url) {
|
|
229
|
+
if (!ABSOLUTE_URL.test(url)) {
|
|
230
|
+
const target = url.split("#", 1)[0];
|
|
231
|
+
return target.startsWith("/") ? target : `/${target}`;
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
const parsed = new URL(url);
|
|
235
|
+
return parsed.pathname + parsed.search;
|
|
236
|
+
} catch {}
|
|
237
|
+
}
|
|
238
|
+
return typeof path === "string" && path ? path : "/";
|
|
239
|
+
}
|
|
240
|
+
|
|
192
241
|
//#endregion
|
|
193
242
|
//#region src/mcpi/anonymous-principal.ts
|
|
194
243
|
/**
|
|
@@ -226,5 +275,5 @@ const REGISTERED_SID_MAX_LENGTH = 100;
|
|
|
226
275
|
const SID_ATTRIBUTABLE_RESULT = "verified";
|
|
227
276
|
|
|
228
277
|
//#endregion
|
|
229
|
-
export {
|
|
230
|
-
//# sourceMappingURL=registered-sid-
|
|
278
|
+
export { KYA_SIGNED_BODY_MAX_BYTES as a, requestCarriesDelegationProof as c, requestPresentsKyaSignature as d, relayedRequestTarget as i, requestDeclaresBody as l, SID_ATTRIBUTABLE_RESULT as n, readBodyBounded as o, ANONYMOUS_PRINCIPAL_DID as r, DELEGATION_PROOF_HEADERS as s, REGISTERED_SID_MAX_LENGTH as t, requestPresentedCredential as u };
|
|
279
|
+
//# sourceMappingURL=registered-sid-D__xiDPu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registered-sid-D__xiDPu.mjs","names":[],"sources":["../src/mcpi/delegation-headers.ts","../src/mcpi/signed-body.ts","../src/mcpi/relayed-request-target.ts","../src/mcpi/anonymous-principal.ts","../src/mcpi/registered-sid.ts"],"sourcesContent":["/**\n * Delegation-proof request detection (P2 / DR-1).\n *\n * The engine's L2 delegation-root pinning (`ContextSpec.trustedDelegationRoots`)\n * is consulted for every credential the engine verifies: the delegation-proof\n * headers below AND an `Authorization: Bearer` VC-JWT. Consumers gate root\n * resolution on `requestPresentedCredential`, so the human / no-credential hot\n * path stays a precise no-op.\n *\n * Keeping the header set here (rather than re-listing the literals at each site)\n * is the whole point: a new delegation transport header is added in one place\n * and every verifier surface agrees.\n */\n\n/**\n * Lowercased delegation-proof header names. `kya-os-delegation-credential` is the\n * canonical KYA-OS transport; `kya-delegation` is the legacy envelope form still\n * accepted via `legacyEnvelopeFallback`.\n */\nexport const DELEGATION_PROOF_HEADERS = ['kya-os-delegation-credential', 'kya-delegation'] as const;\n\n/** A header value is \"present\" when it is a non-empty string (or non-empty list). */\nfunction isPresent(value: unknown): boolean {\n if (Array.isArray(value)) return value.length > 0;\n return typeof value === 'string' && value.length > 0;\n}\n\n/**\n * Does the request carry a KYA-OS delegation-proof header?\n *\n * Accepts either a `Headers` instance (Next.js / fetch — case-insensitive\n * lookup) or a plain header record (raw Node/Express headers, gateway worker's\n * lowercased map). Record keys are matched case-insensitively, so callers do not\n * need to pre-normalize. Returns `false` for `null`/`undefined`.\n */\nexport function requestCarriesDelegationProof(\n headers: Headers | Record<string, unknown> | null | undefined\n): boolean {\n if (!headers) return false;\n\n if (typeof (headers as Headers).get === 'function') {\n const h = headers as Headers;\n return DELEGATION_PROOF_HEADERS.some((name) => isPresent(h.get(name)));\n }\n\n const record = headers as Record<string, unknown>;\n const lowerKeyed = new Map<string, unknown>();\n for (const key of Object.keys(record)) {\n lowerKeyed.set(key.toLowerCase(), record[key]);\n }\n return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));\n}\n\nconst MAX_VC_JWT_PAYLOAD_CHARS = 16 * 1024;\n\nfunction headerText(headers: Headers | Record<string, unknown>, name: string): string | undefined {\n if (typeof (headers as Headers).get === 'function') {\n return (headers as Headers).get(name) ?? undefined;\n }\n for (const [key, value] of Object.entries(headers as Record<string, unknown>)) {\n if (key.toLowerCase() !== name) continue;\n if (Array.isArray(value)) return value.join(', ');\n return typeof value === 'string' ? value : undefined;\n }\n return undefined;\n}\n\nfunction isMemberDelimiter(c: string): boolean {\n return c === '=' || c === ';' || c === ',' || c === ' ' || c === '\\t';\n}\n\n// Quote-aware member scan; the engine owns the authoritative parse.\nfunction hasKyaMember(value: string): boolean {\n let memberStart = true;\n let quoted = false;\n let escaped = false;\n for (let i = 0; i < value.length; i++) {\n const c = value[i];\n if (quoted) {\n if (escaped) escaped = false;\n else if (c === '\\\\') escaped = true;\n else if (c === '\"') quoted = false;\n continue;\n }\n if (memberStart) {\n if (c === ' ' || c === '\\t') continue;\n if (\n value.startsWith('kya', i) &&\n (i + 3 === value.length || isMemberDelimiter(value[i + 3]))\n ) {\n return true;\n }\n memberStart = false;\n }\n if (c === '\"') quoted = true;\n else if (c === ',') memberStart = true;\n }\n return false;\n}\n\nfunction decodeBase64UrlJson(segment: string): unknown {\n const padded = segment.replace(/-/g, '+').replace(/_/g, '/');\n const binary = atob(padded + '='.repeat((4 - (padded.length % 4)) % 4));\n const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));\n return JSON.parse(new TextDecoder().decode(bytes));\n}\n\nfunction isDelegationCredentialPayload(payload: unknown): boolean {\n if (typeof payload !== 'object' || payload === null) return false;\n if ('vc' in payload) return true;\n const type = (payload as { type?: unknown }).type;\n return Array.isArray(type) && type.includes('DelegationCredential');\n}\n\n// Must equal the orchestrator's delegation routing (`vc` claim OR flat `type`\n// DelegationCredential); an oversized payload counts as presented.\nfunction looksLikeVcJwt(token: string): boolean {\n const parts = token.split('.');\n if (parts.length !== 3 || parts.some((part) => part.length === 0)) return false;\n if (parts[1].length > MAX_VC_JWT_PAYLOAD_CHARS) return true;\n try {\n return isDelegationCredentialPayload(decodeBase64UrlJson(parts[1]));\n } catch {\n return false;\n }\n}\n\n/** Same definition as the .NET / Java `IsCredentialPresented`. */\nexport function requestPresentedCredential(\n headers: Headers | Record<string, unknown> | null | undefined\n): boolean {\n if (!headers) return false;\n if (requestPresentsKyaSignature(headers)) return true;\n if (requestCarriesDelegationProof(headers)) return true;\n const authorization = headerText(headers, 'authorization');\n const bearer = authorization?.match(/^bearer\\s+(\\S+)/i);\n return bearer !== null && bearer !== undefined && looksLikeVcJwt(bearer[1]);\n}\n\n/**\n * True when `Signature-Input` or `Signature` carries a `kya` member, i.e. the\n * request presents a KYA HTTP Binding (kya-http/2) signature. Same member scan\n * as {@link requestPresentedCredential}; routing only, the engine validates it.\n */\nexport function requestPresentsKyaSignature(\n headers: Headers | Record<string, unknown> | null | undefined\n): boolean {\n if (!headers) return false;\n return ['signature-input', 'signature'].some((name) => {\n const value = headerText(headers, name);\n return value !== undefined && hasKyaMember(value);\n });\n}\n\n/**\n * True when the request's framing says it carries a body: a\n * `Transfer-Encoding` header, or a `Content-Length` other than exactly `0`\n * (an empty, blank or malformed length counts as a body, so it fails closed).\n * This is `type-is`'s `hasBody`, except that `Content-Length: 0` is an empty\n * body. A kya-http/2 verifier uses it to tell a request with no body apart\n * from one whose body bytes it never received. HTTP/2 can carry a body with\n * neither header, so a host that can read the body should pass its bytes\n * instead of relying on this.\n */\nexport function requestDeclaresBody(\n headers: Headers | Record<string, unknown> | null | undefined\n): boolean {\n if (!headers) return false;\n if (headerText(headers, 'transfer-encoding') !== undefined) return true;\n const contentLength = headerText(headers, 'content-length');\n // A string compare, not Number(): Number('') and Number(' ') are 0.\n return contentLength !== undefined && contentLength !== '0';\n}\n","/**\n * The body bound of a kya-http/2 (KYA HTTP Binding) signed request.\n *\n * A kya-http/2 signature binds the body through `Content-Digest`, so a host\n * hands the engine the exact body bytes. Every host bounds them the same way,\n * at the .NET adapters' 1 MiB: a larger signed body is answered 413 and never\n * verified in part. In observe mode it goes on without its bytes, and the\n * refusal it would have been is reported.\n */\n\nimport { requestDeclaresBody } from './delegation-headers';\n\n/** Largest kya-http/2 signed body a host hands the engine. */\nexport const KYA_SIGNED_BODY_MAX_BYTES = 1_048_576;\n\n/** A bounded read: the whole body, or why there is none. Never a prefix. */\nexport type BoundedBody = { bytes: Uint8Array } | { failure: 'too-large' | 'unreadable' };\n\nexport type DeadlineBoundedBody = BoundedBody | { failure: 'timed-out'; bytesRead: number };\n\nexport interface BodyReadOptions {\n deadlineMs: number;\n}\n\nconst EXPIRED = Symbol('expired');\n\nfunction expiryAfter(deadlineMs: number) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const expired = new Promise<typeof EXPIRED>((resolve) => {\n timer = setTimeout(() => resolve(EXPIRED), deadlineMs);\n });\n return { expired, clear: () => clearTimeout(timer) };\n}\n\n/**\n * Read a clone of `request`'s body, stopping at `maxBytes`, so the original\n * body is still owed, whole, downstream. A request with no body stream reads\n * as empty, unless its framing declares a body (one the host dropped): that is\n * `unreadable`, never an empty body.\n *\n * Streamed with an early stop, not `arrayBuffer()`: a chunked body with no\n * `Content-Length` would otherwise be pulled whole (into both branches of the\n * clone's tee) before its size was ever looked at.\n */\nexport function readBodyBounded(request: Request, maxBytes: number): Promise<BoundedBody>;\nexport function readBodyBounded(\n request: Request,\n maxBytes: number,\n options: BodyReadOptions\n): Promise<DeadlineBoundedBody>;\nexport async function readBodyBounded(\n request: Request,\n maxBytes: number,\n options?: BodyReadOptions\n): Promise<DeadlineBoundedBody> {\n const declaredLength = Number(request.headers.get('content-length'));\n if (Number.isFinite(declaredLength) && declaredLength > maxBytes) {\n return { failure: 'too-large' };\n }\n const stream = request.clone().body;\n if (!stream) {\n return requestDeclaresBody(request.headers)\n ? { failure: 'unreadable' }\n : { bytes: new Uint8Array(0) };\n }\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n let total = 0;\n const expiry = options === undefined ? undefined : expiryAfter(options.deadlineMs);\n try {\n for (;;) {\n const next = await (expiry === undefined\n ? reader.read()\n : Promise.race([reader.read(), expiry.expired]));\n if (next === EXPIRED) {\n reader.cancel().catch(() => undefined);\n return { failure: 'timed-out', bytesRead: total };\n }\n const { done, value } = next;\n if (done) break;\n total += value.byteLength;\n if (total > maxBytes) {\n // Not awaited: cancelling one branch of a tee settles only once the\n // other branch (the original body, still owed downstream) is\n // cancelled too, so awaiting here would never return.\n reader.cancel().catch(() => undefined);\n return { failure: 'too-large' };\n }\n chunks.push(value);\n }\n } catch {\n return { failure: 'unreadable' };\n } finally {\n expiry?.clear();\n }\n const bytes = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return { bytes };\n}\n","/**\n * An absolute URL with an authority: an RFC 3986 §3.1 scheme (a letter, then\n * letters, digits, `+`, `-` or `.`, in any case) followed by `://`. A scheme\n * without `//` (`https:/x`, `https:x`) is not one, though a WHATWG URL parser\n * would still read a host from it for a special scheme.\n */\nconst ABSOLUTE_URL = /^[a-z][a-z0-9+.-]*:\\/\\//i;\n\n/**\n * The request target (path plus query) of a request a caller relays to a\n * Checkpoint enforce endpoint (the gateway Worker's `/__detect/enforce`, the\n * dashboard's `/api/v1/enforce` and `/api/v1/verdict`). The engine verifies a\n * signature over that target, reading `@path` and `@query` from it, with the\n * authority from the relayed `host` header.\n *\n * The SDKs send `url` as an absolute URL (`withCheckpointApi` sends\n * `request.url`), so a `scheme://` URL gives its path and query. Any other `url`\n * is already a request target and is read exactly as sent, less a fragment:\n * resolving it as a URL would read `//host/x` or `/\\host/x` as a host and the\n * path `/x`, so a signature over `/x` would verify for it. Without a `url`, the\n * target is `path`. A `url` or `path` that isn't a string counts as absent: the\n * gateway reads its body without validating it.\n */\nexport function relayedRequestTarget(url: unknown, path: unknown): string {\n if (typeof url === 'string' && url) {\n if (!ABSOLUTE_URL.test(url)) {\n const target = url.split('#', 1)[0];\n return target.startsWith('/') ? target : `/${target}`;\n }\n try {\n const parsed = new URL(url);\n return parsed.pathname + parsed.search;\n } catch {\n // Not a URL: fall back to the path.\n }\n }\n return typeof path === 'string' && path ? path : '/';\n}\n","/**\n * Canonical did:web for the anonymous-principal sentinel (see `./principal.ts`).\n * Kept apart from the client DID derivation, which loads `@noble/hashes`, so\n * request-path code can take it from the `./kya-http` lean entry.\n */\nexport const ANONYMOUS_PRINCIPAL_DID = 'did:web:kya.vouched.id:principals:anonymous';\n","/**\n * The registered session anchor (`sid`) contract between a reporter and\n * Checkpoint ingest. Kept apart from `reported-identity.ts`, which builds Zod\n * schemas when it loads, so the runtime and the `./kya-http` entry can read\n * these values without loading Zod.\n */\n\n/**\n * Max length of a registered session anchor (`sid`) accepted on the wire and\n * enforced again at the customer route. The join partner\n * `bouncer_sessions.id` is `varchar(100)`; `detections.registered_sid` stays\n * `text` (converting a live column to `varchar` would take an ACCESS EXCLUSIVE\n * rewrite of the hottest table), so this constant is the width contract\n * instead of the column type.\n */\nexport const REGISTERED_SID_MAX_LENGTH = 100;\n\n/**\n * The one delegation result that may attribute a `sid` to a session timeline.\n * A rejected presentation carries no engine-emitted sid, and a sid on a\n * `failed` / `not_presented` report is attacker-shaped, so ingest stamps\n * `registered_sid` only for this result and nulls it otherwise (D4 / D15).\n * One member on purpose: Section 13 of the plan records how an explicitly\n * unverified-labeled `failed` could join it later.\n */\nexport const SID_ATTRIBUTABLE_RESULT = 'verified' as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,2BAA2B,CAAC,gCAAgC,gBAAgB;;AAGzF,SAAS,UAAU,OAAyB;CAC1C,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,SAAS;CAChD,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS;AACrD;;;;;;;;;AAUA,SAAgB,8BACd,SACS;CACT,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,OAAQ,QAAoB,QAAQ,YAAY;EAClD,MAAM,IAAI;EACV,OAAO,yBAAyB,MAAM,SAAS,UAAU,EAAE,IAAI,IAAI,CAAC,CAAC;CACvE;CAEA,MAAM,SAAS;CACf,MAAM,6BAAa,IAAI,IAAqB;CAC5C,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,WAAW,IAAI,IAAI,YAAY,GAAG,OAAO,IAAI;CAE/C,OAAO,yBAAyB,MAAM,SAAS,UAAU,WAAW,IAAI,IAA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A,MAAM,QAAQ,IAAI,WAAW,KAAK;CAClC,IAAI,SAAS;CACb,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,IAAI,OAAO,MAAM;EACvB,UAAU,MAAM;CAClB;CACA,OAAO,EAAE,MAAM;AACjB;;;;;;;;;;AChGA,MAAM,eAAe;;;;;;;;;;;;;;;;AAiBrB,SAAgB,qBAAqB,KAAc,MAAuB;CACxE,IAAI,OAAO,QAAQ,YAAY,KAAK;EAClC,IAAI,CAAC,aAAa,KAAK,GAAG,GAAG;GAC3B,MAAM,SAAS,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC;GACjC,OAAO,OAAO,WAAW,GAAG,IAAI,SAAS,IAAI;EAC/C;EACA,IAAI;GACF,MAAM,SAAS,IAAI,IAAI,GAAG;GAC1B,OAAO,OAAO,WAAW,OAAO;EAClC,QAAQ,CAER;CACF;CACA,OAAO,OAAO,SAAS,YAAY,OAAO,OAAO;AACnD;;;;;;;;;AChCA,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;ACUvC,MAAa,4BAA4B;;;;;;;;;AAUzC,MAAa,0BAA0B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/data/generated/timezone-country.d.ts
|
|
2
|
+
declare const TIMEZONE_COUNTRY_MAP: Readonly<Record<string, string>>;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/timezone-country.d.ts
|
|
5
|
+
interface TimezoneContradictionResult {
|
|
6
|
+
contradicted: boolean;
|
|
7
|
+
timezone: string | null;
|
|
8
|
+
networkCountry: string | null;
|
|
9
|
+
expectedCountry: string | null;
|
|
10
|
+
}
|
|
11
|
+
declare function resolveTimezoneCountry(timezone: string | null | undefined): string | null;
|
|
12
|
+
declare function checkTimezoneCountryContradiction(timezone: string | null | undefined, networkCountry: string | null | undefined): TimezoneContradictionResult;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TIMEZONE_COUNTRY_MAP as i, checkTimezoneCountryContradiction as n, resolveTimezoneCountry as r, TimezoneContradictionResult as t };
|
|
15
|
+
//# sourceMappingURL=timezone-country-B6PkDyNP.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-country-B6PkDyNP.d.mts","names":[],"sources":["../src/data/generated/timezone-country.ts","../src/timezone-country.ts"],"mappings":";cAAa,sBAAsB,SAAS;;;UCqB3B;EACf;EACA;EACA;EAEA;;iBAGc,uBAAuB;iBAsBvB,kCACd,qCACA,4CACC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/data/generated/timezone-country.d.ts
|
|
2
|
+
declare const TIMEZONE_COUNTRY_MAP: Readonly<Record<string, string>>;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/timezone-country.d.ts
|
|
5
|
+
interface TimezoneContradictionResult {
|
|
6
|
+
contradicted: boolean;
|
|
7
|
+
timezone: string | null;
|
|
8
|
+
networkCountry: string | null;
|
|
9
|
+
expectedCountry: string | null;
|
|
10
|
+
}
|
|
11
|
+
declare function resolveTimezoneCountry(timezone: string | null | undefined): string | null;
|
|
12
|
+
declare function checkTimezoneCountryContradiction(timezone: string | null | undefined, networkCountry: string | null | undefined): TimezoneContradictionResult;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TIMEZONE_COUNTRY_MAP as i, checkTimezoneCountryContradiction as n, resolveTimezoneCountry as r, TimezoneContradictionResult as t };
|
|
15
|
+
//# sourceMappingURL=timezone-country-B6PkDyNP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-country-B6PkDyNP.d.ts","names":[],"sources":["../src/data/generated/timezone-country.ts","../src/timezone-country.ts"],"mappings":";cAAa,sBAAsB,SAAS;;;UCqB3B;EACf;EACA;EACA;EAEA;;iBAGc,uBAAuB;iBAsBvB,kCACd,qCACA,4CACC"}
|