@corbado/observe 1.7.2 → 1.8.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/dist/analysis/client.mjs +1851 -0
- package/dist/analysis/config-manager.mjs +83 -0
- package/dist/analysis/config.mjs +216 -0
- package/dist/analysis/device-info-manager.mjs +153 -0
- package/dist/analysis/device.mjs +562 -0
- package/dist/analysis/index.mjs +118 -0
- package/dist/analysis/logger.mjs +50 -0
- package/dist/analysis/low-events/capture-sequence.mjs +11 -0
- package/dist/analysis/low-events/ceremony-initiator.mjs +26 -0
- package/dist/analysis/low-events/form-input-binding.mjs +46 -0
- package/dist/analysis/low-events/grouped-input-tracker.mjs +133 -0
- package/dist/analysis/low-events/input-change-recorder.mjs +200 -0
- package/dist/analysis/low-events/input-paste-observer.mjs +91 -0
- package/dist/analysis/low-events/input-tracker.mjs +223 -0
- package/dist/analysis/low-events/otp-input-binding.mjs +67 -0
- package/dist/analysis/low-events/shared-window-observer.mjs +225 -0
- package/dist/analysis/low-events/sink.mjs +0 -0
- package/dist/analysis/low-events/viewport-batcher.mjs +42 -0
- package/dist/analysis/low-events/window-tracker.mjs +40 -0
- package/dist/analysis/queue.mjs +887 -0
- package/dist/analysis/readers/device.mjs +73 -0
- package/dist/analysis/readers/meta.mjs +18 -0
- package/dist/analysis/readers/password-manager-dom.mjs +112 -0
- package/dist/analysis/readers/password-manager-extensions.mjs +247 -0
- package/dist/analysis/readers/private-mode.mjs +9 -0
- package/dist/analysis/storage/index.mjs +197 -0
- package/dist/analysis/storage/migration.mjs +56 -0
- package/dist/analysis/store/event-store.mjs +114 -0
- package/dist/analysis/transport.mjs +0 -0
- package/dist/analysis/transports/fetch.mjs +108 -0
- package/dist/analysis/types.mjs +25 -0
- package/dist/analysis/utils/appconfirmation-operation-full.mjs +19 -0
- package/dist/analysis/utils/blocked-user-agents.mjs +37 -0
- package/dist/analysis/utils/captcha-operation-full.mjs +17 -0
- package/dist/analysis/utils/email-link-continuity.mjs +50 -0
- package/dist/analysis/utils/email-link-operation-full.mjs +142 -0
- package/dist/analysis/utils/email-otp-operation-full.mjs +39 -0
- package/dist/analysis/utils/form-operation-full.mjs +81 -0
- package/dist/analysis/utils/key-operation-full.mjs +38 -0
- package/dist/analysis/utils/normalize-error.mjs +29 -0
- package/dist/analysis/utils/operation-full-provide-identifier-with-cui.mjs +46 -0
- package/dist/analysis/utils/operation-full.mjs +235 -0
- package/dist/analysis/utils/passkey-deletion-operation-full.mjs +17 -0
- package/dist/analysis/utils/passkey-enrollment-operation-full.mjs +32 -0
- package/dist/analysis/utils/passkey-login-operation-full.mjs +34 -0
- package/dist/analysis/utils/password-enrollment-operation-full.mjs +27 -0
- package/dist/analysis/utils/password-login-operation-full.mjs +61 -0
- package/dist/analysis/utils/password-manager-sampler.mjs +130 -0
- package/dist/analysis/utils/provide-data-operation-full.mjs +28 -0
- package/dist/analysis/utils/serialize-raw-error.mjs +205 -0
- package/dist/analysis/utils/sms-otp-operation-full.mjs +39 -0
- package/dist/analysis/utils/social-operation-login.mjs +17 -0
- package/dist/analysis/utils/source-path.mjs +39 -0
- package/dist/analysis/utils/sso-operation-login.mjs +37 -0
- package/dist/analysis/utils/totp-operation-full.mjs +35 -0
- package/dist/analysis/utils/trusted-device-operation-full.mjs +100 -0
- package/dist/analysis/utils/web-lock.mjs +52 -0
- package/dist/analysis/utils/webauthn-payloads.mjs +101 -0
- package/dist/analysis/version.mjs +7 -0
- package/dist/cdn/script.global.js +4 -4
- package/dist/index.d.mts +156 -4
- package/dist/index.d.ts +156 -4
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +7 -2
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// src/utils/webauthn-payloads.ts
|
|
2
|
+
var BLACKLIST = {
|
|
3
|
+
creationOptions: ["/user/name", "/user/displayName"],
|
|
4
|
+
creationResponse: ["/clientExtensionResults/prf/results"],
|
|
5
|
+
requestOptions: [],
|
|
6
|
+
assertionResponse: ["/response/signature", "/clientExtensionResults/prf/results"]
|
|
7
|
+
};
|
|
8
|
+
function sanitizeCreationOptions(value, projectors) {
|
|
9
|
+
return sanitize(value, "creationOptions", projectors);
|
|
10
|
+
}
|
|
11
|
+
function sanitizeCreationResponse(value, projectors) {
|
|
12
|
+
return sanitize(value, "creationResponse", projectors);
|
|
13
|
+
}
|
|
14
|
+
function sanitizeRequestOptions(value) {
|
|
15
|
+
return sanitize(value, "requestOptions");
|
|
16
|
+
}
|
|
17
|
+
function sanitizeAssertionResponse(value, projectors) {
|
|
18
|
+
return sanitize(value, "assertionResponse", projectors);
|
|
19
|
+
}
|
|
20
|
+
function sanitize(input, kind, projectors = {}) {
|
|
21
|
+
try {
|
|
22
|
+
const value = typeof input === "string" ? JSON.parse(input) : input;
|
|
23
|
+
if (!isRecord(value)) return void 0;
|
|
24
|
+
const blocked = new Set(BLACKLIST[kind]);
|
|
25
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
26
|
+
const clone = (item, path, depth = 0) => {
|
|
27
|
+
if (blocked.has(path)) return void 0;
|
|
28
|
+
if (kind === "creationOptions" && path === "/user/id" || (kind === "creationResponse" || kind === "assertionResponse") && path === "/response/userHandle") {
|
|
29
|
+
if (item === null) return null;
|
|
30
|
+
if (!projectors.userId) return void 0;
|
|
31
|
+
const identifier = typeof item === "string" ? item : item instanceof ArrayBuffer || ArrayBuffer.isView(item) ? base64url(item) : void 0;
|
|
32
|
+
if (identifier === void 0) return void 0;
|
|
33
|
+
try {
|
|
34
|
+
const output = projectors.userId(identifier);
|
|
35
|
+
return typeof output === "string" || output === null ? output : void 0;
|
|
36
|
+
} catch {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (item === null || typeof item === "string" || typeof item === "boolean") return item;
|
|
41
|
+
if (typeof item === "number") return Number.isFinite(item) ? item : null;
|
|
42
|
+
if (typeof item !== "object") return void 0;
|
|
43
|
+
if (item instanceof ArrayBuffer || ArrayBuffer.isView(item)) return base64url(item);
|
|
44
|
+
if (depth > 64 || ancestors.has(item)) throw new TypeError("Invalid telemetry payload");
|
|
45
|
+
ancestors.add(item);
|
|
46
|
+
try {
|
|
47
|
+
if (Array.isArray(item)) {
|
|
48
|
+
return item.map((entry, i) => clone(entry, `${path}/${i}`, depth + 1));
|
|
49
|
+
}
|
|
50
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
51
|
+
for (const key in item) {
|
|
52
|
+
const childPath = `${path}/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
53
|
+
if (blocked.has(childPath) || key === "toJSON") continue;
|
|
54
|
+
const child = clone(item[key], childPath, depth + 1);
|
|
55
|
+
if (child !== void 0) result[key] = child;
|
|
56
|
+
}
|
|
57
|
+
const source = item;
|
|
58
|
+
const readMethod = (method, field) => {
|
|
59
|
+
if (result[field] !== void 0 || typeof source[method] !== "function") return;
|
|
60
|
+
const childPath = `${path}/${field}`;
|
|
61
|
+
const child = clone(
|
|
62
|
+
Reflect.apply(source[method], item, []),
|
|
63
|
+
childPath,
|
|
64
|
+
depth + 1
|
|
65
|
+
);
|
|
66
|
+
if (child !== void 0) result[field] = child;
|
|
67
|
+
};
|
|
68
|
+
if (path === "" && (kind === "creationResponse" || kind === "assertionResponse")) {
|
|
69
|
+
readMethod("getClientExtensionResults", "clientExtensionResults");
|
|
70
|
+
}
|
|
71
|
+
if (path === "/response" && kind === "creationResponse") {
|
|
72
|
+
readMethod("getTransports", "transports");
|
|
73
|
+
readMethod("getAuthenticatorData", "authenticatorData");
|
|
74
|
+
readMethod("getPublicKey", "publicKey");
|
|
75
|
+
readMethod("getPublicKeyAlgorithm", "publicKeyAlgorithm");
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
} finally {
|
|
79
|
+
ancestors.delete(item);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return JSON.stringify(clone(value, ""));
|
|
83
|
+
} catch {
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function isRecord(value) {
|
|
88
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof ArrayBuffer) && !ArrayBuffer.isView(value);
|
|
89
|
+
}
|
|
90
|
+
function base64url(value) {
|
|
91
|
+
const bytes = value instanceof ArrayBuffer ? new Uint8Array(value) : new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
92
|
+
let binary = "";
|
|
93
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
94
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
sanitizeAssertionResponse,
|
|
98
|
+
sanitizeCreationOptions,
|
|
99
|
+
sanitizeCreationResponse,
|
|
100
|
+
sanitizeRequestOptions
|
|
101
|
+
};
|