@jodetx_dev/secureshield-web 0.0.0-stage → 4.0.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/INTEGRATION_GUIDE.md +595 -0
- package/LICENSE +36 -0
- package/README.md +125 -2
- package/dist/index.cjs +8098 -0
- package/dist/index.d.cts +1421 -0
- package/dist/index.d.ts +1421 -0
- package/dist/index.mjs +7972 -0
- package/dist/secureshield.iife.min.js +43 -0
- package/dist/secureshield.iife.min.js.sri +1 -0
- package/package.json +60 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1421 @@
|
|
|
1
|
+
interface DetectorItem {
|
|
2
|
+
id: string;
|
|
3
|
+
triggered: boolean;
|
|
4
|
+
severity: number;
|
|
5
|
+
category: string;
|
|
6
|
+
event: string;
|
|
7
|
+
confidence?: number;
|
|
8
|
+
fpRiskTier?: 'LOW' | 'MEDIUM' | 'HIGH';
|
|
9
|
+
evasionDifficulty?: 'LOW' | 'MEDIUM' | 'HIGH';
|
|
10
|
+
requiresConsent?: boolean;
|
|
11
|
+
implementationCost?: 'LOW' | 'MEDIUM' | 'HIGH';
|
|
12
|
+
status?: 'PASSED' | 'FAILED' | 'INCONCLUSIVE' | 'SKIPPED_NO_CONSENT';
|
|
13
|
+
name?: string;
|
|
14
|
+
executionTimeMs?: number;
|
|
15
|
+
evidence?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
interface SecurityAuditReport {
|
|
18
|
+
scan_id: string;
|
|
19
|
+
device_id_hash: string;
|
|
20
|
+
session_id: string;
|
|
21
|
+
os_name: string;
|
|
22
|
+
os_version: string;
|
|
23
|
+
app_id: string;
|
|
24
|
+
app_version: string;
|
|
25
|
+
sdk_version: string;
|
|
26
|
+
verdict?: 'SECURE' | 'BLOCKED' | 'PENDING_BACKEND_INGESTION' | 'SKIPPED';
|
|
27
|
+
risk_score?: number;
|
|
28
|
+
risk_tier?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | 'NONE' | 'UNKNOWN';
|
|
29
|
+
decision_action?: 'ALLOW' | 'BLOCK' | 'PENDING_BACKEND_INGESTION' | 'SKIPPED' | 'PAUSED';
|
|
30
|
+
scoring_authority?: 'SERVER_AUTHORITATIVE' | 'CLIENT_LOCAL_OFFLINE' | 'NONE';
|
|
31
|
+
authoritative_verdict?: 'PENDING_BACKEND_INGESTION' | 'APPROVED' | 'REJECTED' | 'PASSED' | 'BLOCKED' | 'SECURE' | 'SKIPPED';
|
|
32
|
+
total_detectors: number;
|
|
33
|
+
passed: number;
|
|
34
|
+
failed: number;
|
|
35
|
+
tenant_id: string;
|
|
36
|
+
environment: string;
|
|
37
|
+
items: DetectorItem[];
|
|
38
|
+
}
|
|
39
|
+
declare const SDK_VERSION: string;
|
|
40
|
+
type ServerSecurityVerdict = SecurityAuditReport & {
|
|
41
|
+
status?: string;
|
|
42
|
+
verdict?: string;
|
|
43
|
+
deviceStatus?: any;
|
|
44
|
+
threatScore?: number;
|
|
45
|
+
decision_action?: string;
|
|
46
|
+
trustScore?: number;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
49
|
+
declare class TelemetrySerializer {
|
|
50
|
+
private static generateDeviceIdHash;
|
|
51
|
+
private static formatOsVersion;
|
|
52
|
+
static createReport(items: DetectorItem[], tenantId?: string, appId?: string, environment?: string, appVersion?: string): SecurityAuditReport;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface OriginValidationResult {
|
|
56
|
+
isValid: boolean;
|
|
57
|
+
currentOrigin: string;
|
|
58
|
+
currentHostname: string;
|
|
59
|
+
isFramed: boolean;
|
|
60
|
+
mismatchReason?: string;
|
|
61
|
+
}
|
|
62
|
+
declare class OriginValidator {
|
|
63
|
+
static normalizeDomain(input: string): string;
|
|
64
|
+
static matchesDomain(currentHostname: string, targetPattern: string): boolean;
|
|
65
|
+
static isLoopback(input: string): boolean;
|
|
66
|
+
static parseIPv4(ipStr: string): number[] | null;
|
|
67
|
+
static isPrivateOrRestrictedIPv4(octets: number[]): boolean;
|
|
68
|
+
static parseIPv6(ipStr: string): {
|
|
69
|
+
words: number[];
|
|
70
|
+
embeddedV4: number[] | null;
|
|
71
|
+
} | null;
|
|
72
|
+
static isPrivateOrRestrictedIPv6(parsedV6: {
|
|
73
|
+
words: number[];
|
|
74
|
+
embeddedV4: number[] | null;
|
|
75
|
+
}): boolean;
|
|
76
|
+
static isPrivateOrRestrictedHost(hostname: string): boolean;
|
|
77
|
+
static canonicalizeOrigin(input: string): string;
|
|
78
|
+
static matchesOrigin(originA: string, originB: string): boolean;
|
|
79
|
+
static isFramed(): boolean;
|
|
80
|
+
static getCurrentContext(): {
|
|
81
|
+
origin: string;
|
|
82
|
+
hostname: string;
|
|
83
|
+
};
|
|
84
|
+
static validate(allowedOrigins?: string[]): OriginValidationResult;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* RemediationManager: Over-The-Air Threat Remediation & Action Dispatcher
|
|
89
|
+
*
|
|
90
|
+
* Implements automated client-side remediation for server decision actions:
|
|
91
|
+
* - PAUSED: Dynamically suspends SDK probes and background listeners.
|
|
92
|
+
* - WIPE_LOCAL_KEYS: Purges non-exportable IndexedDB vault, session tokens, and cached credentials.
|
|
93
|
+
* - TERMINATE_APP / BLOCK_DEVICE: Performs complete lockdown (vault wipe + DOM lockout overlay + URL redirect).
|
|
94
|
+
*/
|
|
95
|
+
interface RemediationOptions {
|
|
96
|
+
blockRedirectUrl?: string | null;
|
|
97
|
+
enableDomLockoutOverlay?: boolean;
|
|
98
|
+
onRemediationTriggered?: (action: string, reason?: string) => void;
|
|
99
|
+
onWipeKeys?: () => void;
|
|
100
|
+
requireSignature?: boolean;
|
|
101
|
+
}
|
|
102
|
+
interface RemediationResult {
|
|
103
|
+
action: string;
|
|
104
|
+
enforced: boolean;
|
|
105
|
+
details?: string;
|
|
106
|
+
}
|
|
107
|
+
declare class RemediationManager {
|
|
108
|
+
private options;
|
|
109
|
+
constructor(options?: RemediationOptions);
|
|
110
|
+
/**
|
|
111
|
+
* Purges all non-exportable IndexedDB keys, session storage, and cached auth credentials.
|
|
112
|
+
*/
|
|
113
|
+
wipeLocalKeys(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Processes a server-returned decision action and applies immediate client remediation.
|
|
116
|
+
*/
|
|
117
|
+
handleDecisionAction(rawAction?: string, reason?: string, verified?: boolean): Promise<RemediationResult>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* TabBlurShield: Browser Tab Switcher & Visibility Privacy Shield
|
|
122
|
+
*
|
|
123
|
+
* Web equivalent of Android FLAG_SECURE / recent-apps snapshot masking.
|
|
124
|
+
* Automatically obscures confidential DOM data when the tab is blurred, minimized, or switched,
|
|
125
|
+
* preventing shoulder surfing, OS window switcher thumbnail leakage, and screen recording capture.
|
|
126
|
+
*/
|
|
127
|
+
interface TabBlurOptions {
|
|
128
|
+
blurFilter?: string;
|
|
129
|
+
maskMessage?: string;
|
|
130
|
+
maskSubtitle?: string;
|
|
131
|
+
listenToWindowBlur?: boolean;
|
|
132
|
+
customOverlayId?: string;
|
|
133
|
+
}
|
|
134
|
+
declare class TabBlurShield {
|
|
135
|
+
static DEFAULT_OVERLAY_ID: string;
|
|
136
|
+
private static activeOptions;
|
|
137
|
+
private static isListening;
|
|
138
|
+
private static isCurrentlyMasked;
|
|
139
|
+
private static activeSubscribers;
|
|
140
|
+
private static onVisibilityChangeHandler;
|
|
141
|
+
private static onWindowBlurHandler;
|
|
142
|
+
private static onWindowFocusHandler;
|
|
143
|
+
/**
|
|
144
|
+
* Enables automatic tab blur & visibilitychange masking.
|
|
145
|
+
*/
|
|
146
|
+
static enable(options?: TabBlurOptions): void;
|
|
147
|
+
/**
|
|
148
|
+
* Disables tab blur masking and restores DOM visibility.
|
|
149
|
+
*/
|
|
150
|
+
static disable(force?: boolean): void;
|
|
151
|
+
static isListenerActive(): boolean;
|
|
152
|
+
static getActiveSubscribers(): number;
|
|
153
|
+
/**
|
|
154
|
+
* Mounts the privacy blur shield over the viewport.
|
|
155
|
+
*/
|
|
156
|
+
static mask(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Unmasks and removes the privacy blur shield.
|
|
159
|
+
*/
|
|
160
|
+
static unmask(): void;
|
|
161
|
+
static isMasked(): boolean;
|
|
162
|
+
static isEnabled(): boolean;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* SecureUiHardening: DOM Input Hardening, Leak Mitigation & Dynamic Security Watermarking
|
|
167
|
+
*
|
|
168
|
+
* Provides client-side defense in depth against UI scraping, physical camera photo leaks,
|
|
169
|
+
* and browser form field credential caching.
|
|
170
|
+
*/
|
|
171
|
+
interface WatermarkOptions {
|
|
172
|
+
opacity?: number;
|
|
173
|
+
color?: string;
|
|
174
|
+
fontSize?: number;
|
|
175
|
+
elementId?: string;
|
|
176
|
+
}
|
|
177
|
+
declare class SecureUiHardening {
|
|
178
|
+
static DEFAULT_WATERMARK_ID: string;
|
|
179
|
+
/**
|
|
180
|
+
* Renders a non-intrusive diagonal repeating security watermark across the entire browser viewport.
|
|
181
|
+
*/
|
|
182
|
+
static renderSecurityWatermark(watermarkText?: string, options?: WatermarkOptions): void;
|
|
183
|
+
/**
|
|
184
|
+
* Removes the active security watermark from the DOM.
|
|
185
|
+
*/
|
|
186
|
+
static removeSecurityWatermark(elementId?: string): void;
|
|
187
|
+
/**
|
|
188
|
+
* Hardens form input elements against browser caching, autofill exfiltration, and spellcheck sniffing.
|
|
189
|
+
*/
|
|
190
|
+
static protectFormFields(containerSelector?: string): void;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class DevToolsDetector {
|
|
194
|
+
static scan(): DetectorItem;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare class HeadlessBrowserDetector {
|
|
198
|
+
static scan(): DetectorItem;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare class BrowserFingerprintDetector {
|
|
202
|
+
static scan(): Record<string, any>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* BrowserVersionIntegrityDetector: P4 Informational / Environment Security Detector.
|
|
207
|
+
*
|
|
208
|
+
* Cross-checks `navigator.userAgentData` (Client Hints) brands and versions against
|
|
209
|
+
* `navigator.userAgent` and engine features to identify contradictory version spoofing.
|
|
210
|
+
*
|
|
211
|
+
* CROSS-CUTTING METRICS:
|
|
212
|
+
* - Performance Cost: ~0.02ms (String extraction and regex comparison)
|
|
213
|
+
* - Execution Model: On-demand synchronous scan
|
|
214
|
+
* - Sensitive Data: None exfiltrated
|
|
215
|
+
* - Evasion Limits: If Client Hints API is entirely absent (e.g. Firefox/Safari), version audit relies on UA pattern parsing.
|
|
216
|
+
*/
|
|
217
|
+
declare class BrowserVersionIntegrityDetector {
|
|
218
|
+
static scan(): DetectorItem;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* BrowserCapabilitySpoofingDetector: P4 Informational / Environment Security Detector.
|
|
223
|
+
*
|
|
224
|
+
* Detects inconsistencies between reported browser engine claims (in userAgent/vendor)
|
|
225
|
+
* and actual Web API features supported by the underlying JavaScript rendering engine.
|
|
226
|
+
*
|
|
227
|
+
* CROSS-CUTTING METRICS:
|
|
228
|
+
* - Performance Cost: ~0.02ms (Direct property and feature checks)
|
|
229
|
+
* - Execution Model: On-demand synchronous scan
|
|
230
|
+
* - Sensitive Data: None exfiltrated
|
|
231
|
+
* - Evasion Limits: Custom Chromium forks with modified user-agents may trigger informational mismatches.
|
|
232
|
+
*/
|
|
233
|
+
declare class BrowserCapabilitySpoofingDetector {
|
|
234
|
+
static scan(): DetectorItem;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* UserAgentTamperingDetector: P4 Informational / Mandatory Baseline Detector.
|
|
239
|
+
*
|
|
240
|
+
* Audits `navigator.userAgent`, `navigator.platform`, `navigator.vendor`, and `navigator.appVersion`
|
|
241
|
+
* for property descriptor monkey-patching, userland getter overrides, and platform contradictions.
|
|
242
|
+
*
|
|
243
|
+
* CROSS-CUTTING METRICS:
|
|
244
|
+
* - Performance Cost: ~0.02ms (Property descriptor inspection & cross-audit)
|
|
245
|
+
* - Execution Model: On-demand synchronous scan
|
|
246
|
+
* - Sensitive Data: None exfiltrated
|
|
247
|
+
* - Evasion Limits: CDP (Chrome DevTools Protocol) user-agent overrides set before V8 context creation
|
|
248
|
+
* must be caught by contradiction detection against underlying engine features.
|
|
249
|
+
*/
|
|
250
|
+
declare class UserAgentTamperingDetector {
|
|
251
|
+
static scan(): DetectorItem;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare class NavigatorPropertyIntegrityDetector {
|
|
255
|
+
static scan(): Record<string, any>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* TimeManipulationDetector: P2 Medium Regulatory Baseline Detector.
|
|
260
|
+
*
|
|
261
|
+
* Compares wall-clock time (`Date.now()`) drift against monotonic high-resolution
|
|
262
|
+
* timers (`performance.now()`) and verified server timestamps to identify client
|
|
263
|
+
* system clock tampering, replay attack preparation, and token expiration bypass attempts.
|
|
264
|
+
*
|
|
265
|
+
* CROSS-CUTTING METRICS:
|
|
266
|
+
* - Performance Cost: ~0.01ms (Simple arithmetic subtraction between timestamps)
|
|
267
|
+
* - Execution Model: On-demand synchronous comparison
|
|
268
|
+
* - Sensitive Data: None read or exfiltrated
|
|
269
|
+
* - Evasion Limits: If a client's system clock was already distorted before the browser
|
|
270
|
+
* tab was opened AND no server timestamp anchor has been received yet, monotonic
|
|
271
|
+
* performance.now() only catches clock adjustments that occur WHILE the session is active.
|
|
272
|
+
* Receiving an anchor via `setServerTimeAnchor()` provides true global clock skew verification.
|
|
273
|
+
*/
|
|
274
|
+
interface TimeManipulationOptions {
|
|
275
|
+
maxAllowedDriftMs?: number;
|
|
276
|
+
}
|
|
277
|
+
declare class TimeManipulationDetector {
|
|
278
|
+
private static serverAnchorTimeMs;
|
|
279
|
+
private static serverAnchorPerfMs;
|
|
280
|
+
/**
|
|
281
|
+
* Anchors a trusted server timestamp (e.g. from backend attestation or policy response)
|
|
282
|
+
*/
|
|
283
|
+
static setServerTimeAnchor(serverTimestampMs: number): void;
|
|
284
|
+
static scan(options?: TimeManipulationOptions): DetectorItem;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare class AutomationEnvironmentDetector {
|
|
288
|
+
static scan(): Record<string, any>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare class VirtualBrowserDetector {
|
|
292
|
+
static scan(): DetectorItem;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare class ConsoleTamperingDetector {
|
|
296
|
+
static scan(): DetectorItem;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
declare class DomTamperingDetector {
|
|
300
|
+
static scan(): DetectorItem;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare class DynamicEvalDetector {
|
|
304
|
+
static scan(): DetectorItem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class RuntimeHookDetector {
|
|
308
|
+
static scan(): Record<string, any>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare class FunctionPrototypeTamperingDetector {
|
|
312
|
+
static scan(): DetectorItem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare class NativeApiOverrideDetector {
|
|
316
|
+
static scan(): DetectorItem;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class WasmIntegrityDetector {
|
|
320
|
+
static scan(): Record<string, any>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* ScriptInjectionDetector: P0 Critical Regulatory Baseline Detector.
|
|
325
|
+
*
|
|
326
|
+
* Scans the DOM for unauthorized script tags, inline scripts with encoded/eval payloads,
|
|
327
|
+
* unapproved external script origins, and DOM-based XSS injection artifacts.
|
|
328
|
+
*
|
|
329
|
+
* CROSS-CUTTING METRICS:
|
|
330
|
+
* - Performance Cost: ~0.05ms for typical DOM (<100 script tags); MutationObserver uses microtask batching
|
|
331
|
+
* - Execution Model: On-demand synchronous DOM sweep + optional continuous MutationObserver
|
|
332
|
+
* - Sensitive Data: Matched suspicious payload strings are hashed/redacted before reporting
|
|
333
|
+
* - Evasion Limits: Highly sophisticated XSS attacks using multi-stage WebSocket payloads
|
|
334
|
+
* or pure DOM property manipulation without eval/atob signatures may evade static pattern matching.
|
|
335
|
+
* This detector serves as defense-in-depth alongside strict Content-Security-Policy (CSP) headers.
|
|
336
|
+
*/
|
|
337
|
+
interface ScriptInjectionOptions {
|
|
338
|
+
allowedScriptOrigins?: string[];
|
|
339
|
+
blockInlineEvalPatterns?: boolean;
|
|
340
|
+
}
|
|
341
|
+
declare class ScriptInjectionDetector {
|
|
342
|
+
private static defaultAllowedOrigins;
|
|
343
|
+
/**
|
|
344
|
+
* Configures global allowed script origins
|
|
345
|
+
*/
|
|
346
|
+
static setAllowedOrigins(origins: string[]): void;
|
|
347
|
+
/**
|
|
348
|
+
* Initializes a background MutationObserver on document to catch runtime script injections
|
|
349
|
+
*/
|
|
350
|
+
static initObserver(options?: ScriptInjectionOptions): void;
|
|
351
|
+
/**
|
|
352
|
+
* Analyzes an individual script source & content for suspicious patterns
|
|
353
|
+
*/
|
|
354
|
+
static analyzeScript(src: string, content: string, allowedOrigins?: string[]): {
|
|
355
|
+
flagged: boolean;
|
|
356
|
+
reason: string;
|
|
357
|
+
severity: number;
|
|
358
|
+
};
|
|
359
|
+
static scan(options?: ScriptInjectionOptions): DetectorItem;
|
|
360
|
+
/**
|
|
361
|
+
* Resets recorded mutation observer injections (useful for test isolations)
|
|
362
|
+
*/
|
|
363
|
+
static clearObservedMutations(): void;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* RuntimeFunctionHookDetector: Detects dynamic function wrapping, proxying,
|
|
368
|
+
* and stealth monkey patching across critical JavaScript runtime entrypoints.
|
|
369
|
+
*
|
|
370
|
+
* CROSS-CUTTING METRICS:
|
|
371
|
+
* - Performance Cost: ~0.04ms (String signature and toString-of-toString recursion checks)
|
|
372
|
+
* - Execution Model: On-demand synchronous scan
|
|
373
|
+
* - Sensitive Data: None read or exfiltrated
|
|
374
|
+
* - Evasion Limits: A sophisticated attacker could implement a transparent Proxy that returns
|
|
375
|
+
* pristine toString results, catches all trap handler evaluations, and patches Function.prototype.toString.
|
|
376
|
+
* Note: In a pure client-side environment without multi-realm iframe isolation, an identical Proxy
|
|
377
|
+
* wrapper with perfect trap reflection cannot be 100% distinguished from native code.
|
|
378
|
+
*/
|
|
379
|
+
declare class RuntimeFunctionHookDetector {
|
|
380
|
+
static scan(): DetectorItem;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
declare class GlobalObjectTamperingDetector {
|
|
384
|
+
static scan(): Record<string, any>;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare class MemoryLeakExploitationDetector {
|
|
388
|
+
static scan(): Record<string, any>;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* DebuggerDetectionDetector: Timing-based anti-debugging and breakpoint detection probe.
|
|
393
|
+
*
|
|
394
|
+
* CROSS-CUTTING METRICS:
|
|
395
|
+
* - Performance Cost: ~0.02ms (High-resolution timer micro-benchmark)
|
|
396
|
+
* - Execution Model: On-demand synchronous scan
|
|
397
|
+
* - Sensitive Data: None read or exfiltrated
|
|
398
|
+
* - Evasion Limits: Developers who disable breakpoints or attackers stepping through with
|
|
399
|
+
* automated CDP (Chrome DevTools Protocol) without pausing will not generate timing gaps.
|
|
400
|
+
* - False Positive Considerations: Heavy CPU throttling or main thread event-loop delays
|
|
401
|
+
* could cause minor execution time spikes. The threshold is set conservatively (>100ms)
|
|
402
|
+
* and emits a low-severity informational signal (severity: 2) rather than blocking the host.
|
|
403
|
+
*/
|
|
404
|
+
declare class DebuggerDetectionDetector {
|
|
405
|
+
static scan(): DetectorItem;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* ExtensionInjectionDetector: P4 Informational / Extension Security Detector.
|
|
410
|
+
*
|
|
411
|
+
* Scans DOM `<head>` and `<body>` elements for `<script>`, `<link>`, or `<iframe>` tags
|
|
412
|
+
* loaded directly from browser extension protocol schemes (`chrome-extension://`, `moz-extension://`).
|
|
413
|
+
*
|
|
414
|
+
* CROSS-CUTTING METRICS:
|
|
415
|
+
* - Performance Cost: ~0.03ms (DOM protocol scheme query)
|
|
416
|
+
* - Execution Model: On-demand synchronous scan
|
|
417
|
+
* - Sensitive Data: None read or exfiltrated
|
|
418
|
+
* - Evasion Limits: Extensions using pure programmatic message passing without
|
|
419
|
+
* inserting DOM elements cannot be detected via DOM sweeping.
|
|
420
|
+
*/
|
|
421
|
+
declare class ExtensionInjectionDetector {
|
|
422
|
+
static scan(): DetectorItem;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
declare class MaliciousExtensionDetector {
|
|
426
|
+
static scan(): DetectorItem;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
declare class ContentScriptInjectionDetector {
|
|
430
|
+
static scan(): DetectorItem;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* ExtensionPermissionAbuseDetector: P4 Informational / Form Security Detector.
|
|
435
|
+
*
|
|
436
|
+
* Audits sensitive form fields (password, credit card, OTP, PIN) for unauthorized
|
|
437
|
+
* value reading closures, rogue event listeners, or shadow property interceptors.
|
|
438
|
+
*
|
|
439
|
+
* CROSS-CUTTING METRICS:
|
|
440
|
+
* - Performance Cost: ~0.03ms (Targeted input element selector sweep)
|
|
441
|
+
* - Execution Model: On-demand synchronous scan
|
|
442
|
+
* - Sensitive Data: Never reads or records field contents; only checks listeners and descriptor integrity
|
|
443
|
+
* - Evasion Limits: If an extension content script injects an isolated world listener that doesn't
|
|
444
|
+
* pollute the main execution realm's property descriptors, detection relies on mutation observer alerts.
|
|
445
|
+
*/
|
|
446
|
+
declare class ExtensionPermissionAbuseDetector {
|
|
447
|
+
static scan(): DetectorItem;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
declare class AdInjectionDetector {
|
|
451
|
+
static scan(): DetectorItem;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
declare class CryptoMinerDetector {
|
|
455
|
+
static scan(): Record<string, any>;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* ClipboardHijackingDetector: P4 Informational / Extension Security Detector.
|
|
460
|
+
*
|
|
461
|
+
* Audits `navigator.clipboard.writeText` and `document.execCommand` for unauthorized
|
|
462
|
+
* monkey-patching and detects rogue `copy`/`cut` event listeners replacing clipboard content.
|
|
463
|
+
*
|
|
464
|
+
* CROSS-CUTTING METRICS:
|
|
465
|
+
* - Performance Cost: ~0.02ms (Clipboard API descriptor and native inspection)
|
|
466
|
+
* - Execution Model: On-demand synchronous scan
|
|
467
|
+
* - Sensitive Data: Never reads user clipboard data directly
|
|
468
|
+
* - Evasion Limits: Native OS-level keyloggers/clipboard managers cannot be observed via Web APIs.
|
|
469
|
+
*/
|
|
470
|
+
declare class ClipboardHijackingDetector {
|
|
471
|
+
static scan(): DetectorItem;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
declare class PluginIntegrityDetector {
|
|
475
|
+
static scan(): Record<string, any>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare class WebStoragePlaintextDetector {
|
|
479
|
+
static scan(): DetectorItem;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* SessionStorageSecretsDetector: P4 Informational / Storage Security Detector.
|
|
484
|
+
*
|
|
485
|
+
* Scans sessionStorage items for unencrypted JWT tokens, private keys, API secrets,
|
|
486
|
+
* or password credentials stored in plaintext without cryptographic envelope protection.
|
|
487
|
+
*
|
|
488
|
+
* CROSS-CUTTING METRICS:
|
|
489
|
+
* - Performance Cost: ~0.02ms (Direct storage key/value regex inspection)
|
|
490
|
+
* - Execution Model: On-demand synchronous scan
|
|
491
|
+
* - Sensitive Data: Matched secret values are REDACTED/HASHED; raw tokens are never recorded in telemetry.
|
|
492
|
+
* - Evasion Limits: Encrypted payloads stored under benign key names cannot be inspected without keys.
|
|
493
|
+
*/
|
|
494
|
+
declare class SessionStorageSecretsDetector {
|
|
495
|
+
static scan(): DetectorItem;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
declare class CookiePolicyDetector {
|
|
499
|
+
static scan(): Record<string, any>;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
declare class IndexedDbIntegrityDetector {
|
|
503
|
+
static scan(): DetectorItem;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* ServiceWorkerIntegrityDetector: P4 Informational / Application Integrity Detector.
|
|
508
|
+
*
|
|
509
|
+
* Audits `navigator.serviceWorker.register` and active Service Worker registrations
|
|
510
|
+
* to identify rogue service workers registered from unapproved scopes or external scripts.
|
|
511
|
+
*
|
|
512
|
+
* CROSS-CUTTING METRICS:
|
|
513
|
+
* - Performance Cost: ~0.02ms (Registration API descriptor and scope inspection)
|
|
514
|
+
* - Execution Model: On-demand synchronous scan
|
|
515
|
+
* - Sensitive Data: None read or recorded
|
|
516
|
+
* - Evasion Limits: Service Workers already registered on different subpaths before
|
|
517
|
+
* the page load require asynchronous `navigator.serviceWorker.getRegistrations()` audit.
|
|
518
|
+
*/
|
|
519
|
+
declare class ServiceWorkerIntegrityDetector {
|
|
520
|
+
static scan(): DetectorItem;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* ManifestIntegrityDetector: P4 Informational / Application Integrity Detector.
|
|
525
|
+
*
|
|
526
|
+
* Validates Web App Manifest (`<link rel="manifest">`) link tags, checks origin
|
|
527
|
+
* conformity, and flags malicious URI schemes or untrusted third-party manifest hosts.
|
|
528
|
+
*
|
|
529
|
+
* CROSS-CUTTING METRICS:
|
|
530
|
+
* - Performance Cost: ~0.02ms (Single DOM link query)
|
|
531
|
+
* - Execution Model: On-demand synchronous scan
|
|
532
|
+
* - Sensitive Data: None read or exfiltrated
|
|
533
|
+
* - Evasion Limits: Manifests loaded dynamically via service worker fetch hooks
|
|
534
|
+
* require service worker network interceptor audits.
|
|
535
|
+
*/
|
|
536
|
+
declare class ManifestIntegrityDetector {
|
|
537
|
+
static scan(): DetectorItem;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* ClientConfigTamperingDetector: P4 Informational / Application Integrity Detector.
|
|
542
|
+
*
|
|
543
|
+
* Audits client-side global configuration stores (`window.__CONFIG__`, `window.__ENV__`, `window.SecureShieldConfig`)
|
|
544
|
+
* for unexpected runtime property mutation, prototype injection, or tampering with critical endpoint URLs.
|
|
545
|
+
*
|
|
546
|
+
* CROSS-CUTTING METRICS:
|
|
547
|
+
* - Performance Cost: ~0.02ms (Config store property audit)
|
|
548
|
+
* - Execution Model: On-demand synchronous scan
|
|
549
|
+
* - Sensitive Data: Config values are audited for structure without exfiltrating secrets
|
|
550
|
+
* - Evasion Limits: If config stores are modified before SDK initialization, baseline freezing is recommended.
|
|
551
|
+
*/
|
|
552
|
+
declare class ClientConfigTamperingDetector {
|
|
553
|
+
static scan(): DetectorItem;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare class SriComplianceDetector {
|
|
557
|
+
static scan(): Record<string, any>;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* SslValidationDetector: P4 Informational / Network Security Detector.
|
|
562
|
+
*
|
|
563
|
+
* Audits SSL/TLS transport context, verifies `window.isSecureContext` status,
|
|
564
|
+
* and checks for insecure WebSocket connections created within a secure origin.
|
|
565
|
+
*
|
|
566
|
+
* CROSS-CUTTING METRICS:
|
|
567
|
+
* - Performance Cost: ~0.01ms (Secure context flag and protocol check)
|
|
568
|
+
* - Execution Model: On-demand synchronous scan
|
|
569
|
+
* - Sensitive Data: None exfiltrated
|
|
570
|
+
* - Evasion Limits: Localhost development testing environments are granted secure context equivalence.
|
|
571
|
+
*/
|
|
572
|
+
declare class SslValidationDetector {
|
|
573
|
+
static scan(): DetectorItem;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
declare class WebCertificatePinningDetector {
|
|
577
|
+
static scan(): Record<string, any>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* HttpsEnforcementDetector: P4 Informational / Network Security Detector.
|
|
582
|
+
*
|
|
583
|
+
* Verifies that the web application is running over encrypted transport (HTTPS)
|
|
584
|
+
* and flags unencrypted HTTP sessions that expose user credentials to MITM interception.
|
|
585
|
+
*
|
|
586
|
+
* CROSS-CUTTING METRICS:
|
|
587
|
+
* - Performance Cost: ~0.01ms (Simple protocol and hostname check)
|
|
588
|
+
* - Execution Model: On-demand synchronous scan
|
|
589
|
+
* - Sensitive Data: None exfiltrated
|
|
590
|
+
* - Evasion Limits: Local loopback hosts (localhost, 127.0.0.1) are granted development exemptions.
|
|
591
|
+
*/
|
|
592
|
+
declare class HttpsEnforcementDetector {
|
|
593
|
+
static scan(): DetectorItem;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* MixedContentDetector: P4 Informational / Network Security Detector.
|
|
598
|
+
*
|
|
599
|
+
* Scans DOM resource URLs (scripts, stylesheets, iframes, images, forms) for unencrypted
|
|
600
|
+
* `http://` resources loaded within a secure HTTPS origin context (Active/Passive Mixed Content).
|
|
601
|
+
*
|
|
602
|
+
* CROSS-CUTTING METRICS:
|
|
603
|
+
* - Performance Cost: ~0.03ms (DOM resource attribute sweep)
|
|
604
|
+
* - Execution Model: On-demand synchronous scan
|
|
605
|
+
* - Sensitive Data: None exfiltrated
|
|
606
|
+
* - Evasion Limits: Mixed content fetched dynamically inside Web Workers requires CSP upgrade-insecure-requests.
|
|
607
|
+
*/
|
|
608
|
+
declare class MixedContentDetector {
|
|
609
|
+
static scan(): DetectorItem;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
declare class WebDnsManipulationDetector {
|
|
613
|
+
static scan(): Record<string, any>;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
declare class WebProxyDetector {
|
|
617
|
+
static scan(): DetectorItem;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* WebVpnDetector: P4 Informational / Network Security Detector.
|
|
622
|
+
*
|
|
623
|
+
* Audits WebRTC RTCPeerConnection interfaces and compares timezone offset consistency
|
|
624
|
+
* against navigator languages and locales to detect VPN tunneling and proxy routing nodes.
|
|
625
|
+
*
|
|
626
|
+
* CROSS-CUTTING METRICS:
|
|
627
|
+
* - Performance Cost: ~0.02ms (Timezone and WebRTC interface inspection)
|
|
628
|
+
* - Execution Model: On-demand synchronous scan
|
|
629
|
+
* - Sensitive Data: None exfiltrated
|
|
630
|
+
* - Evasion Limits: Commercial VPNs that spoof both system timezone and WebRTC routes
|
|
631
|
+
* require IP-based threat intelligence matching on the backend.
|
|
632
|
+
*/
|
|
633
|
+
declare class WebVpnDetector {
|
|
634
|
+
static scan(): DetectorItem;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* NetworkLatencyDetector: P4 Informational / Network Security Detector.
|
|
639
|
+
*
|
|
640
|
+
* Analyzes round-trip network request latency, TCP connect times, and performance timing metrics
|
|
641
|
+
* to identify proxy relay delays, throttled debugging proxies (Burp Suite, Charles), or synthetic latency injection.
|
|
642
|
+
*
|
|
643
|
+
* CROSS-CUTTING METRICS:
|
|
644
|
+
* - Performance Cost: ~0.02ms (Performance timing entry inspection)
|
|
645
|
+
* - Execution Model: On-demand synchronous scan
|
|
646
|
+
* - Sensitive Data: None exfiltrated
|
|
647
|
+
* - Evasion Limits: Fast upstream proxies with minimal latency overhead cannot be differentiated from normal network jitter without backend RTT corroboration.
|
|
648
|
+
*/
|
|
649
|
+
declare class NetworkLatencyDetector {
|
|
650
|
+
static scan(): DetectorItem;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
declare class IframeClickjackingDetector {
|
|
654
|
+
static scan(): DetectorItem;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* UiOverlayDetector: P4 Informational / UI Security Detector.
|
|
659
|
+
*
|
|
660
|
+
* Detects transparent, fixed, or absolute overlay elements (`opacity: 0`, `z-index: >1000`)
|
|
661
|
+
* layered over interactive buttons and form inputs designed for UI tapjacking or clickjacking.
|
|
662
|
+
*
|
|
663
|
+
* CROSS-CUTTING METRICS:
|
|
664
|
+
* - Performance Cost: ~0.04ms (Fixed/Absolute element geometry check)
|
|
665
|
+
* - Execution Model: On-demand synchronous scan
|
|
666
|
+
* - Sensitive Data: None read or exfiltrated
|
|
667
|
+
* - Evasion Limits: Overlays added dynamically upon hover and immediately removed
|
|
668
|
+
* after click may evade discrete polling scans.
|
|
669
|
+
*/
|
|
670
|
+
declare class UiOverlayDetector {
|
|
671
|
+
static scan(): DetectorItem;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* HiddenElementDetector: P4 Informational / UI Security Detector.
|
|
676
|
+
*
|
|
677
|
+
* Identifies hidden DOM elements, zero-width inputs, and invisible iframe overlays
|
|
678
|
+
* placed outside the viewport or with transparent opacity used in clickjacking or credential harvesting.
|
|
679
|
+
*
|
|
680
|
+
* CROSS-CUTTING METRICS:
|
|
681
|
+
* - Performance Cost: ~0.04ms (DOM input & iframe style audit)
|
|
682
|
+
* - Execution Model: On-demand synchronous scan
|
|
683
|
+
* - Sensitive Data: None read or exfiltrated
|
|
684
|
+
* - Evasion Limits: Highly dynamic opacity toggling immediately before user click
|
|
685
|
+
* requires ongoing pointer event interception.
|
|
686
|
+
*/
|
|
687
|
+
declare class HiddenElementDetector {
|
|
688
|
+
static scan(): DetectorItem;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* ScreenCaptureDetector: P4 Informational / UI Security Detector.
|
|
693
|
+
*
|
|
694
|
+
* Detects active screen capture APIs (`navigator.mediaDevices.getDisplayMedia`),
|
|
695
|
+
* screen sharing sessions, and unauthorized capture attempts during sensitive user operations.
|
|
696
|
+
*
|
|
697
|
+
* CROSS-CUTTING METRICS:
|
|
698
|
+
* - Performance Cost: ~0.02ms (API inspection and stream check)
|
|
699
|
+
* - Execution Model: On-demand synchronous scan
|
|
700
|
+
* - Sensitive Data: None read or recorded
|
|
701
|
+
* - Evasion Limits: OS-level screen capture software (OBS, native OS snipping tools)
|
|
702
|
+
* that does not invoke WebRTC `getDisplayMedia` cannot be detected directly by browser JS.
|
|
703
|
+
*/
|
|
704
|
+
declare class ScreenCaptureDetector {
|
|
705
|
+
static scan(): DetectorItem;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
declare class WindowFocusDetector {
|
|
709
|
+
static scan(): Record<string, any>;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
declare class BotBehaviorDetector {
|
|
713
|
+
static scan(): DetectorItem;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* MouseDynamicsDetector: P4 Informational / Behavioral Biometrics Detector.
|
|
718
|
+
*
|
|
719
|
+
* ⚖️ LEGAL REVIEW & PRIVACY COMPLIANCE GATE (GDPR Art. 9, CCPA, BIPA, India DPDP Act):
|
|
720
|
+
* - Requires explicit user consent before activating mouse tracking (`requiresConsent: true`).
|
|
721
|
+
* - ZERO coordinate logging in telemetry: Never transmits (x, y) coordinates or path trajectories.
|
|
722
|
+
* Only evaluates mathematical curvature entropy and acceleration delta statistics locally.
|
|
723
|
+
*
|
|
724
|
+
* CROSS-CUTTING METRICS:
|
|
725
|
+
* - Performance Cost: ~0.03ms (Curvature cross-product computation on 50-point ring buffer)
|
|
726
|
+
* - Execution Model: Event-driven ring buffer + on-demand synchronous scan
|
|
727
|
+
* - Sensitive Data: Never exfiltrates screen positions or cursor path coordinates
|
|
728
|
+
* - Evasion Limits: Sophisticated Bezier curve generation algorithms with human noise simulation.
|
|
729
|
+
*/
|
|
730
|
+
interface MouseDynamicsOptions {
|
|
731
|
+
consentGranted?: boolean;
|
|
732
|
+
}
|
|
733
|
+
declare class MouseDynamicsDetector {
|
|
734
|
+
static readonly requiresConsent = true;
|
|
735
|
+
static initListener(options?: MouseDynamicsOptions): void;
|
|
736
|
+
static removeListener(force?: boolean): void;
|
|
737
|
+
static isListenerActive(): boolean;
|
|
738
|
+
static getActiveSubscribers(): number;
|
|
739
|
+
static scan(options?: MouseDynamicsOptions): DetectorItem;
|
|
740
|
+
static recordSyntheticCollinearPoints(): void;
|
|
741
|
+
static clearPoints(): void;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* KeyboardDynamicsDetector: P4 Informational / Behavioral Biometrics Detector.
|
|
746
|
+
*
|
|
747
|
+
* ⚖️ LEGAL REVIEW & PRIVACY COMPLIANCE GATE (GDPR Art. 9, CCPA, BIPA, India DPDP Act):
|
|
748
|
+
* - Requires explicit user consent (`requiresConsent: true`).
|
|
749
|
+
* - STRICT PRIVACY ENFORCEMENT: Never reads, logs, or stores raw keystrokes, ASCII characters,
|
|
750
|
+
* or keyCode/key values. ONLY computes numerical timing intervals (inter-keystroke flight times).
|
|
751
|
+
*
|
|
752
|
+
* CROSS-CUTTING METRICS:
|
|
753
|
+
* - Performance Cost: ~0.03ms (Statistical variance calculation on sliding float window)
|
|
754
|
+
* - Execution Model: Event-driven interval logging + on-demand synchronous scan
|
|
755
|
+
* - Sensitive Data: ZERO character or key data recorded. Only interval float arrays.
|
|
756
|
+
* - Evasion Limits: Bots that inject randomized Gaussian timing delays between send_keys calls.
|
|
757
|
+
*/
|
|
758
|
+
interface KeyboardDynamicsOptions {
|
|
759
|
+
consentGranted?: boolean;
|
|
760
|
+
}
|
|
761
|
+
declare class KeyboardDynamicsDetector {
|
|
762
|
+
static readonly requiresConsent = true;
|
|
763
|
+
static initListeners(options?: KeyboardDynamicsOptions): void;
|
|
764
|
+
static removeListeners(force?: boolean): void;
|
|
765
|
+
static isListenerActive(): boolean;
|
|
766
|
+
static getActiveSubscribers(): number;
|
|
767
|
+
static scan(options?: KeyboardDynamicsOptions): DetectorItem;
|
|
768
|
+
static addFlightTimeSample(intervalMs: number): void;
|
|
769
|
+
static clearSamples(): void;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* TouchEventDetector: P4 Informational / Behavioral Biometrics Detector.
|
|
774
|
+
*
|
|
775
|
+
* ⚖️ LEGAL REVIEW & PRIVACY COMPLIANCE GATE (GDPR Art. 9, CCPA, BIPA, India DPDP Act):
|
|
776
|
+
* - Requires explicit user consent before activating persistent touch event listeners (`requiresConsent: true`).
|
|
777
|
+
* - ZERO coordinate tracking: Evaluates only touch physical properties (radiusX, radiusY, force, touchType).
|
|
778
|
+
*
|
|
779
|
+
* CROSS-CUTTING METRICS:
|
|
780
|
+
* - Performance Cost: ~0.02ms (Touch property inspection)
|
|
781
|
+
* - Execution Model: Event-driven property audit + on-demand synchronous scan
|
|
782
|
+
* - Sensitive Data: Never records touch locations or screen tap coordinates
|
|
783
|
+
* - Evasion Limits: Desktop browser emulators that simulate realistic radiusX/radiusY touch properties.
|
|
784
|
+
*/
|
|
785
|
+
interface TouchEventOptions {
|
|
786
|
+
consentGranted?: boolean;
|
|
787
|
+
}
|
|
788
|
+
declare class TouchEventDetector {
|
|
789
|
+
static readonly requiresConsent = true;
|
|
790
|
+
static initListeners(options?: TouchEventOptions): void;
|
|
791
|
+
static removeListeners(force?: boolean): void;
|
|
792
|
+
static isListenerActive(): boolean;
|
|
793
|
+
static getActiveSubscribers(): number;
|
|
794
|
+
static scan(options?: TouchEventOptions): DetectorItem;
|
|
795
|
+
static recordSyntheticTouch(isSynthetic: boolean): void;
|
|
796
|
+
static resetTouchData(): void;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* HumanInteractionDetector: P4 Informational / Behavioral Biometrics Detector.
|
|
801
|
+
*
|
|
802
|
+
* ⚖️ LEGAL REVIEW & PRIVACY COMPLIANCE GATE (GDPR Art. 9, CCPA, BIPA, India DPDP Act):
|
|
803
|
+
* - Requires explicit user consent before activating persistent biometric tracking (`requiresConsent: true`).
|
|
804
|
+
* - ZERO raw event payload logging: Only aggregate interaction counts and presence flags are evaluated.
|
|
805
|
+
*
|
|
806
|
+
* CROSS-CUTTING METRICS:
|
|
807
|
+
* - Performance Cost: ~0.02ms (Event counter inspection)
|
|
808
|
+
* - Execution Model: Event-driven counter accumulation with on-demand synchronous scan
|
|
809
|
+
* - Sensitive Data: Never records input data, cursor coordinates, or target elements
|
|
810
|
+
* - Evasion Limits: Bots that simulate fake random pointerdown events can satisfy interaction counts.
|
|
811
|
+
*/
|
|
812
|
+
interface BiometricConsentOptions {
|
|
813
|
+
consentGranted?: boolean;
|
|
814
|
+
}
|
|
815
|
+
declare class HumanInteractionDetector {
|
|
816
|
+
static readonly requiresConsent = true;
|
|
817
|
+
/**
|
|
818
|
+
* Initializes lightweight interaction listeners upon user consent
|
|
819
|
+
*/
|
|
820
|
+
static initListeners(options?: BiometricConsentOptions): void;
|
|
821
|
+
static removeListeners(force?: boolean): void;
|
|
822
|
+
static isListenerActive(): boolean;
|
|
823
|
+
static getActiveSubscribers(): number;
|
|
824
|
+
static scan(options?: BiometricConsentOptions): DetectorItem;
|
|
825
|
+
static recordSyntheticInteraction(count?: number): void;
|
|
826
|
+
static resetInteractions(): void;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
declare class WebSessionHijackDetector {
|
|
830
|
+
static scan(): Record<string, any>;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
declare class CredentialStuffingDetector {
|
|
834
|
+
static scan(): Record<string, any>;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
declare class ImpossibleNavigationDetector {
|
|
838
|
+
static scan(): Record<string, any>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* SessionAnomalyDetector: P4 Informational / Bot Intelligence & Session Detector.
|
|
843
|
+
*
|
|
844
|
+
* Audits tab duplication, multiple conflicting session IDs in the same origin,
|
|
845
|
+
* or concurrent session collision markers indicative of automated session hijacking or cloning.
|
|
846
|
+
*
|
|
847
|
+
* CROSS-CUTTING METRICS:
|
|
848
|
+
* - Performance Cost: ~0.02ms (Storage session token and lock check)
|
|
849
|
+
* - Execution Model: On-demand synchronous scan
|
|
850
|
+
* - Sensitive Data: None exfiltrated; session IDs are hashed/redacted.
|
|
851
|
+
* - Evasion Limits: Multi-tab sessions opened in isolated incognito profiles cannot be correlated locally.
|
|
852
|
+
*/
|
|
853
|
+
declare class SessionAnomalyDetector {
|
|
854
|
+
static scan(): DetectorItem;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
declare class WebglRendererVendorDetector {
|
|
858
|
+
static scan(): DetectorItem;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
declare class WebgpuSubsystemDetector {
|
|
862
|
+
static scan(): DetectorItem;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
declare class CanvasFingerprintIntegrityDetector {
|
|
866
|
+
static scan(): DetectorItem;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
declare class BatterySubsystemDetector {
|
|
870
|
+
static scan(): DetectorItem;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
declare class ScreenGeometryDetector {
|
|
874
|
+
static scan(): DetectorItem;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
declare class HardwareTopologyDetector {
|
|
878
|
+
static scan(): DetectorItem;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
declare class PrototypeChainIntegrityDetector {
|
|
882
|
+
static scan(): DetectorItem;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
declare class AutomationArtifactsDetector {
|
|
886
|
+
static scan(): DetectorItem;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
declare class LocalstorageSecretsDetector {
|
|
890
|
+
static scan(): DetectorItem;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
declare class WasmBytecodeIntegrityDetector {
|
|
894
|
+
static scan(): DetectorItem;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
declare class ClientHintsConsistencyDetector {
|
|
898
|
+
static scan(): DetectorItem;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
declare class PermissionsApiSweepDetector {
|
|
902
|
+
static scan(): DetectorItem;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
declare class WebAuthnHardwareAuthenticatorDetector {
|
|
906
|
+
static scan(): DetectorItem;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
declare class InputPointerMediaQueryDetector {
|
|
910
|
+
static scan(): DetectorItem;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
declare class IntlLocaleFingerprintDetector {
|
|
914
|
+
static scan(): DetectorItem;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
declare class ErrorStackFormatDetector {
|
|
918
|
+
static scan(): DetectorItem;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
declare class FontLoadingEnumerationDetector {
|
|
922
|
+
static scan(): DetectorItem;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
declare class MathFpPrecisionDetector {
|
|
926
|
+
static scan(): DetectorItem;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
declare class MediaCapabilitiesCodecDetector {
|
|
930
|
+
static scan(): DetectorItem;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
declare class StorageQuotaEstimateDetector {
|
|
934
|
+
static scan(): DetectorItem;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
declare class CssEngineFeatureMatrixDetector {
|
|
938
|
+
static scan(): DetectorItem;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
declare class AdblockerPresenceDetector {
|
|
942
|
+
static scan(): DetectorItem;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
declare class GlobalPrivacyControlDetector {
|
|
946
|
+
static scan(): DetectorItem;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* PayloadSecurityHelper: Web Crypto API End-to-End Encryption & Telemetry Envelope Manager
|
|
951
|
+
*
|
|
952
|
+
* Implements ephemeral ECDH (P-256/secp256r1) key agreement, RFC 5869 HKDF-SHA256 key derivation,
|
|
953
|
+
* AES-256-GCM authenticated payload encryption, and HMAC-SHA256 envelope signing.
|
|
954
|
+
*
|
|
955
|
+
* Fully aligned with Android SDK (PayloadSecurityHelper.kt) and Portal Ingest Gateway (payload_security.js).
|
|
956
|
+
*/
|
|
957
|
+
interface SecurityEnvelopeHeader {
|
|
958
|
+
signature: string;
|
|
959
|
+
timestamp: number;
|
|
960
|
+
iv: string;
|
|
961
|
+
nonce: string;
|
|
962
|
+
ephemeral_pub_key: string;
|
|
963
|
+
crypto_mode: string;
|
|
964
|
+
}
|
|
965
|
+
interface SecurityEnvelope {
|
|
966
|
+
header: SecurityEnvelopeHeader;
|
|
967
|
+
body: string;
|
|
968
|
+
}
|
|
969
|
+
declare class PayloadSecurityHelper {
|
|
970
|
+
static DEFAULT_SERVER_PUBLIC_KEY_BASE64: string;
|
|
971
|
+
static DEFAULT_HMAC_KEY_HEX: string;
|
|
972
|
+
private static serverPublicKeyBase64;
|
|
973
|
+
private static hmacKeyHex;
|
|
974
|
+
static setServerPublicKey(base64PublicKey: string): void;
|
|
975
|
+
static setHmacKey(hexHmacKey: string): void;
|
|
976
|
+
/**
|
|
977
|
+
* Helper: Resolves standard Web Crypto instance across Browser & Node environments
|
|
978
|
+
*/
|
|
979
|
+
private static getSubtleCrypto;
|
|
980
|
+
/**
|
|
981
|
+
* Helper: Fills a TypedArray buffer with zeros (best-effort JS memory scrubbing)
|
|
982
|
+
*/
|
|
983
|
+
static scrubBuffer(buffer: ArrayBufferView | ArrayBuffer): void;
|
|
984
|
+
/**
|
|
985
|
+
* Binary Encoding Utilities (Universal Web standards, no Node Buffer required)
|
|
986
|
+
*/
|
|
987
|
+
static bytesToBase64(bytes: Uint8Array): string;
|
|
988
|
+
static base64ToBytes(base64: string): Uint8Array;
|
|
989
|
+
static hexToBytes(hex: string): Uint8Array;
|
|
990
|
+
static bytesToHex(bytes: Uint8Array): string;
|
|
991
|
+
/**
|
|
992
|
+
* Generates a cryptographically random UUID v4 string without dashes
|
|
993
|
+
*/
|
|
994
|
+
static generateNonce(): string;
|
|
995
|
+
/**
|
|
996
|
+
* Encrypts and cryptographically signs raw JSON telemetry report using End-to-End
|
|
997
|
+
* ECDH-P256 Ephemeral Key Exchange + RFC 5869 HKDF-SHA256 + AES-256-GCM + HMAC-SHA256.
|
|
998
|
+
*
|
|
999
|
+
* @param rawJsonStr The raw JSON string containing the security audit report
|
|
1000
|
+
* @param customServerPubKeyBase64 Optional override for Server Public Key SPKI
|
|
1001
|
+
* @param customHmacKeyHex Optional override for HMAC Key Hex
|
|
1002
|
+
* @returns JSON string representing the full SecurityEnvelope
|
|
1003
|
+
*/
|
|
1004
|
+
static encryptAndSignPayload(rawJsonStr: string, customServerPubKeyBase64?: string, customHmacKeyHex?: string): Promise<string>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Constructs the structured SecurityEnvelope object
|
|
1007
|
+
*/
|
|
1008
|
+
static createSecurityEnvelope(rawJsonStr: string, customServerPubKeyBase64?: string, customHmacKeyHex?: string): Promise<SecurityEnvelope>;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* IndexedDbLeaseVault: Non-Exportable Cryptographic Vault & Offline Session Lease Manager
|
|
1013
|
+
*
|
|
1014
|
+
* Implements hardware-adjacent browser key storage using standard IndexedDB + Web Crypto API.
|
|
1015
|
+
* The master encryption key is generated with extractable=false (non-exportable), meaning raw key bytes
|
|
1016
|
+
* never enter userland JavaScript memory and cannot be exfiltrated via devtools or script injection.
|
|
1017
|
+
*
|
|
1018
|
+
* Provides offline session grace lease caching mirroring Android KeyStore / EncryptedSharedPreferences.
|
|
1019
|
+
*/
|
|
1020
|
+
interface SignedLeaseEnvelope {
|
|
1021
|
+
protected: string;
|
|
1022
|
+
payload: string;
|
|
1023
|
+
signature: string;
|
|
1024
|
+
public_key_jwk?: any;
|
|
1025
|
+
}
|
|
1026
|
+
interface CachedLeasePayload {
|
|
1027
|
+
appId: string;
|
|
1028
|
+
tenantId: string;
|
|
1029
|
+
origin: string;
|
|
1030
|
+
policy?: any;
|
|
1031
|
+
sessionToken?: string;
|
|
1032
|
+
deviceToken?: string;
|
|
1033
|
+
leaseExpiryMs: number;
|
|
1034
|
+
cachedAt: number;
|
|
1035
|
+
lastSeenTimestamp?: number;
|
|
1036
|
+
signedEnvelope?: SignedLeaseEnvelope;
|
|
1037
|
+
}
|
|
1038
|
+
interface EncryptedLeaseRecord {
|
|
1039
|
+
id: string;
|
|
1040
|
+
iv: string;
|
|
1041
|
+
ciphertext: string;
|
|
1042
|
+
timestamp: number;
|
|
1043
|
+
}
|
|
1044
|
+
interface LeaseVerificationResult {
|
|
1045
|
+
isValid: boolean;
|
|
1046
|
+
lease?: CachedLeasePayload;
|
|
1047
|
+
reason?: string;
|
|
1048
|
+
needsOnlineRefresh?: boolean;
|
|
1049
|
+
}
|
|
1050
|
+
declare class IndexedDbLeaseVault {
|
|
1051
|
+
static DB_NAME: string;
|
|
1052
|
+
static DB_VERSION: number;
|
|
1053
|
+
static STORE_KEYS: string;
|
|
1054
|
+
static STORE_LEASES: string;
|
|
1055
|
+
static MASTER_KEY_ID: string;
|
|
1056
|
+
static LEASE_RECORD_ID: string;
|
|
1057
|
+
private static memoryKeyStore;
|
|
1058
|
+
private static memoryLeaseStore;
|
|
1059
|
+
/**
|
|
1060
|
+
* Helper: Resolves standard Web Crypto instance
|
|
1061
|
+
*/
|
|
1062
|
+
private static getSubtleCrypto;
|
|
1063
|
+
/**
|
|
1064
|
+
* Helper: Checks if native browser IndexedDB is accessible
|
|
1065
|
+
*/
|
|
1066
|
+
private static isIndexedDbAvailable;
|
|
1067
|
+
/**
|
|
1068
|
+
* Opens or initializes the IndexedDB database instance
|
|
1069
|
+
*/
|
|
1070
|
+
private static openDatabase;
|
|
1071
|
+
/**
|
|
1072
|
+
* Retrieves existing non-exportable CryptoKey or generates a new one.
|
|
1073
|
+
* Key is generated with extractable=false so raw bytes cannot be exported.
|
|
1074
|
+
*/
|
|
1075
|
+
static getOrCreateMasterKey(): Promise<CryptoKey>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Encrypts and persists a verified session lease in the vault.
|
|
1078
|
+
*/
|
|
1079
|
+
static saveLease(payload: CachedLeasePayload): Promise<void>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Decrypts and retrieves the cached session lease from the vault.
|
|
1082
|
+
*/
|
|
1083
|
+
static getLease(): Promise<CachedLeasePayload | null>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Verifies if an active, non-expired offline grace lease exists for the current appId and origin.
|
|
1086
|
+
*/
|
|
1087
|
+
static verifyOfflineLease(appId: string, currentOrigin: string, clockOffsetMs?: number, customKeys?: Record<string, JsonWebKey>, isProduction?: boolean, strictBindings?: boolean): Promise<LeaseVerificationResult>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Completely clears all keys and leases from the vault (used during remote threat remediation / WIPE_LOCAL_KEYS).
|
|
1090
|
+
*/
|
|
1091
|
+
static clearVault(): Promise<void>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Universal Base64 Helpers
|
|
1094
|
+
*/
|
|
1095
|
+
private static bytesToBase64;
|
|
1096
|
+
private static base64ToBytes;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* SecurityLockoutOverlay: DOM Lockout & Threat Remediation Screen Overlay
|
|
1101
|
+
* Renders an un-dismissible, high-contrast security lockout shield over the DOM.
|
|
1102
|
+
* Fortified with MutationObservers against DOM tampering, removal, or CSS suppression (N-9).
|
|
1103
|
+
*/
|
|
1104
|
+
declare class SecurityLockoutOverlay {
|
|
1105
|
+
static OVERLAY_ELEMENT_ID: string;
|
|
1106
|
+
private static readonly EVTS;
|
|
1107
|
+
private static isCapturingEvents;
|
|
1108
|
+
private static isLockoutEnforced;
|
|
1109
|
+
private static isMutating;
|
|
1110
|
+
private static bodyObserver;
|
|
1111
|
+
private static overlayObserver;
|
|
1112
|
+
private static lastTitle;
|
|
1113
|
+
private static lastMessage;
|
|
1114
|
+
private static lastIncidentId?;
|
|
1115
|
+
private static eventSuppressor;
|
|
1116
|
+
static renderLockoutOverlay(title?: string, message?: string, incidentId?: string): void;
|
|
1117
|
+
private static attachObservers;
|
|
1118
|
+
private static ensureOverlayStyles;
|
|
1119
|
+
static dismissLockoutOverlay(): void;
|
|
1120
|
+
static isLockoutActive(): boolean;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* SecureClipboard: Timed Auto-Wipe & Sensitive Input Exfiltration Shield
|
|
1125
|
+
*
|
|
1126
|
+
* Web equivalent of Android KeyStore clipboard data scrubbing.
|
|
1127
|
+
* Allows applications to place sensitive data (OTP codes, private keys, credit cards)
|
|
1128
|
+
* on the system clipboard with an automated time-to-live (TTL) auto-wipe timer.
|
|
1129
|
+
*/
|
|
1130
|
+
interface ClipboardCopyResult {
|
|
1131
|
+
success: boolean;
|
|
1132
|
+
wipeAfterMs: number;
|
|
1133
|
+
cancelWipe: () => void;
|
|
1134
|
+
}
|
|
1135
|
+
declare class SecureClipboard {
|
|
1136
|
+
private static activeWipeTimer;
|
|
1137
|
+
private static lastCopiedSensitiveHash;
|
|
1138
|
+
/**
|
|
1139
|
+
* Writes sensitive text to the clipboard and starts an automatic wipe countdown timer.
|
|
1140
|
+
*/
|
|
1141
|
+
static copy(text: string, wipeAfterMs?: number): Promise<ClipboardCopyResult>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Immediately clears/overwrites the system clipboard.
|
|
1144
|
+
*/
|
|
1145
|
+
static wipeNow(): Promise<boolean>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Cancels any pending auto-wipe countdown timer.
|
|
1148
|
+
*/
|
|
1149
|
+
static cancelActiveWipe(): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Hardens designated sensitive input elements against unauthorized cut/copy/drag exfiltration.
|
|
1152
|
+
*/
|
|
1153
|
+
static protectSensitiveInputs(selector?: string): void;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* MemoryScrubber: Best-Effort TypedArray & Buffer Memory Zeroing Engine
|
|
1158
|
+
*
|
|
1159
|
+
* Web equivalent of native C/C++ memset_s / explicit_bzero.
|
|
1160
|
+
* While JavaScript strings are immutable and garbage-collected, binary memory
|
|
1161
|
+
* represented by TypedArrays (Uint8Array, ArrayBuffer, DataView) can and must be explicitly
|
|
1162
|
+
* sanitized to reduce plaintext credential exposure in heap snapshots and memory dumps.
|
|
1163
|
+
*/
|
|
1164
|
+
declare class MemoryScrubber {
|
|
1165
|
+
/**
|
|
1166
|
+
* Performs a multi-pass cryptographic overwrite and zeroing on any TypedArray or ArrayBuffer.
|
|
1167
|
+
*/
|
|
1168
|
+
static zero(target: ArrayBufferView | ArrayBuffer | null | undefined): void;
|
|
1169
|
+
/**
|
|
1170
|
+
* Recursively traverses an object or array and wipes all contained TypedArrays / ArrayBuffers.
|
|
1171
|
+
*/
|
|
1172
|
+
static scrubObject(obj: any, maxDepth?: number): void;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* SecureMemoryBuffer: RAII-style scoped memory wrapper that guarantees
|
|
1176
|
+
* automatic buffer scrubbing upon scope exit (even during errors).
|
|
1177
|
+
*/
|
|
1178
|
+
declare class SecureMemoryBuffer {
|
|
1179
|
+
/**
|
|
1180
|
+
* Allocates or wraps a buffer, executes the provided consumer closure,
|
|
1181
|
+
* and guarantees that the buffer is completely zeroed upon exit.
|
|
1182
|
+
*/
|
|
1183
|
+
static use<R>(buffer: Uint8Array | ArrayBuffer, action: (buf: Uint8Array) => R | Promise<R>): Promise<R>;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
interface StorageLeakItem {
|
|
1187
|
+
storage: 'localStorage' | 'sessionStorage';
|
|
1188
|
+
key: string;
|
|
1189
|
+
reason: string;
|
|
1190
|
+
namespace?: string;
|
|
1191
|
+
category?: 'token' | 'key' | 'password' | 'credential' | 'secret';
|
|
1192
|
+
}
|
|
1193
|
+
interface StorageLeakReport {
|
|
1194
|
+
leaksFound: number;
|
|
1195
|
+
leakingKeys: StorageLeakItem[];
|
|
1196
|
+
inspectedCount: number;
|
|
1197
|
+
}
|
|
1198
|
+
declare class StorageScrubber {
|
|
1199
|
+
static readonly UUID_REGEX: RegExp;
|
|
1200
|
+
static readonly JWT_REGEX: RegExp;
|
|
1201
|
+
static readonly BEARER_REGEX: RegExp;
|
|
1202
|
+
static readonly PEM_REGEX: RegExp;
|
|
1203
|
+
static readonly HEX64_REGEX: RegExp;
|
|
1204
|
+
static readonly API_KEY_REGEX: RegExp;
|
|
1205
|
+
static readonly SENSITIVE_KEY_REGEX: RegExp;
|
|
1206
|
+
static readonly SAFE_KEY_REGEX: RegExp;
|
|
1207
|
+
static scanForPlaintextLeaks(): StorageLeakReport;
|
|
1208
|
+
static purgePlaintextLeaks(whitelistKeys?: string[]): StorageLeakReport;
|
|
1209
|
+
static wipeVolatileStorage(): void;
|
|
1210
|
+
static evaluatePotentialLeak(key: string, value: string): string | null;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* RuntimeIntegrityGuardian: Prototype Hardening, Proxy Traps & Native API Integrity Guardian
|
|
1215
|
+
*
|
|
1216
|
+
* Web equivalent of Android native code integrity verification and syscall bootstrapping.
|
|
1217
|
+
* Protects JavaScript runtime intrinsics from monkey-patching, prototype pollution,
|
|
1218
|
+
* and rogue extension injection while maintaining pristine, unpoisonable function pointers.
|
|
1219
|
+
*/
|
|
1220
|
+
interface TamperedApiItem {
|
|
1221
|
+
apiName: string;
|
|
1222
|
+
isNative: boolean;
|
|
1223
|
+
reason: string;
|
|
1224
|
+
}
|
|
1225
|
+
interface RuntimeIntegrityReport {
|
|
1226
|
+
isClean: boolean;
|
|
1227
|
+
tamperedCount: number;
|
|
1228
|
+
tamperedApis: TamperedApiItem[];
|
|
1229
|
+
auditedCount: number;
|
|
1230
|
+
}
|
|
1231
|
+
declare class RuntimeIntegrityGuardian {
|
|
1232
|
+
private static NATIVE_CODE_REGEX;
|
|
1233
|
+
/**
|
|
1234
|
+
* Exposes cached pristine intrinsics for internal SDK use
|
|
1235
|
+
*/
|
|
1236
|
+
static pristine: {
|
|
1237
|
+
toString: () => string;
|
|
1238
|
+
defineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
|
|
1239
|
+
freeze: {
|
|
1240
|
+
<T extends Function>(f: T): T;
|
|
1241
|
+
<T extends {
|
|
1242
|
+
[idx: string]: U | null | undefined | object;
|
|
1243
|
+
}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;
|
|
1244
|
+
<T>(o: T): Readonly<T>;
|
|
1245
|
+
};
|
|
1246
|
+
getOwnPropertyDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined;
|
|
1247
|
+
stringify: {
|
|
1248
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
1249
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
1250
|
+
};
|
|
1251
|
+
now: () => number;
|
|
1252
|
+
};
|
|
1253
|
+
/**
|
|
1254
|
+
* Evaluates whether a given function is a genuine C++ browser native function
|
|
1255
|
+
* rather than a userland wrapper, proxy, or closure.
|
|
1256
|
+
*/
|
|
1257
|
+
static isNativeFunction(fn: any): boolean;
|
|
1258
|
+
/**
|
|
1259
|
+
* Recursively seals and freezes target ECMAScript built-in prototypes to block prototype pollution.
|
|
1260
|
+
*/
|
|
1261
|
+
static freezePrototypes(targets?: any[]): {
|
|
1262
|
+
frozenCount: number;
|
|
1263
|
+
errors: string[];
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* Wraps a sensitive SDK object or configuration in strict Proxy traps to prevent runtime mutation
|
|
1267
|
+
* from external userland scripts while allowing internal methods to operate on the raw instance.
|
|
1268
|
+
*/
|
|
1269
|
+
static createTamperProofProxy<T extends object>(target: T, name?: string, onTamper?: (action: string, prop: string) => void): T;
|
|
1270
|
+
/**
|
|
1271
|
+
* Performs an active runtime audit of critical browser primitives to detect hooks and overrides.
|
|
1272
|
+
*/
|
|
1273
|
+
static auditRuntimeIntegrity(): RuntimeIntegrityReport;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
declare class DeviceFingerprintEngine {
|
|
1277
|
+
static scan(): DetectorItem;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
declare function isServerEnvironment(): boolean;
|
|
1281
|
+
interface SecureShieldConfig {
|
|
1282
|
+
tenantId?: string;
|
|
1283
|
+
appId?: string;
|
|
1284
|
+
appVersion?: string;
|
|
1285
|
+
appToken?: string;
|
|
1286
|
+
enableDeviceFingerprinting?: boolean;
|
|
1287
|
+
headerKey?: string;
|
|
1288
|
+
encryptionKey?: string;
|
|
1289
|
+
initializationKey?: string;
|
|
1290
|
+
serverUrl?: string;
|
|
1291
|
+
publicKeyPem?: string;
|
|
1292
|
+
serverPublicKeyBase64?: string;
|
|
1293
|
+
hmacKeyHex?: string;
|
|
1294
|
+
enableE2eeEncryption?: boolean;
|
|
1295
|
+
allowedOrigins?: string[];
|
|
1296
|
+
offlineGracePeriodMs?: number;
|
|
1297
|
+
skipHandshake?: boolean;
|
|
1298
|
+
blockRedirectUrl?: string | null;
|
|
1299
|
+
enableDomLockoutOverlay?: boolean;
|
|
1300
|
+
onRemediationTriggered?: (action: string, reason?: string) => void;
|
|
1301
|
+
onWipeKeys?: () => void;
|
|
1302
|
+
enableTabBlurShield?: boolean;
|
|
1303
|
+
tabBlurOptions?: TabBlurOptions;
|
|
1304
|
+
enableWatermark?: boolean;
|
|
1305
|
+
watermarkText?: string;
|
|
1306
|
+
watermarkOptions?: WatermarkOptions;
|
|
1307
|
+
defaultClipboardWipeTimeoutMs?: number;
|
|
1308
|
+
enableStorageLeakScrubber?: boolean;
|
|
1309
|
+
storageWhitelistKeys?: string[];
|
|
1310
|
+
enablePrototypeFreezing?: boolean;
|
|
1311
|
+
enableRuntimeIntegrityWatchdog?: boolean;
|
|
1312
|
+
onTamperDetected?: (api: string, details: string) => void;
|
|
1313
|
+
autoIngest?: boolean;
|
|
1314
|
+
environment?: 'production' | 'staging' | 'development';
|
|
1315
|
+
consent?: {
|
|
1316
|
+
behavioralBiometrics?: boolean;
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* @deprecated Use `consent: { behavioralBiometrics: true }` to explicitly grant consent under GDPR/DPDP.
|
|
1320
|
+
*/
|
|
1321
|
+
enableBehavioralBiometrics?: boolean;
|
|
1322
|
+
/**
|
|
1323
|
+
* Optional custom public keys to verify remote policy signatures against (enterprise key pinning or test overrides).
|
|
1324
|
+
*/
|
|
1325
|
+
customPolicyKeys?: Record<string, JsonWebKey>;
|
|
1326
|
+
/**
|
|
1327
|
+
* Optional custom public keys to verify offline grace leases against (enterprise key pinning or test overrides).
|
|
1328
|
+
*/
|
|
1329
|
+
customLeaseKeys?: Record<string, JsonWebKey>;
|
|
1330
|
+
/**
|
|
1331
|
+
* @deprecated N-12: appToken transmission via URL query string has been completely removed.
|
|
1332
|
+
* appToken is now transmitted strictly via the x-app-token header.
|
|
1333
|
+
* This option is retained as a no-op for backward compatibility.
|
|
1334
|
+
*/
|
|
1335
|
+
preferHeaderAppToken?: boolean;
|
|
1336
|
+
disabledDetectors?: string[];
|
|
1337
|
+
/**
|
|
1338
|
+
* Gates strict cryptographic lease binding enforcement (NEW-1).
|
|
1339
|
+
* When true (default), leases lacking signed app_id, origin, iat, or exp are rejected fail-closed.
|
|
1340
|
+
* When false (staged rollout / migration mode), incomplete leases are treated as requiring
|
|
1341
|
+
* an online refresh with an operational warning, without falling back to unsigned data.
|
|
1342
|
+
* Default: true.
|
|
1343
|
+
*/
|
|
1344
|
+
strictLeaseBindingEnforcement?: boolean;
|
|
1345
|
+
}
|
|
1346
|
+
declare function normalizeEnvironment(env?: unknown): 'production' | 'staging' | 'development';
|
|
1347
|
+
declare function getBaseApiUrl(u: string): string;
|
|
1348
|
+
declare class SecureShield {
|
|
1349
|
+
#private;
|
|
1350
|
+
private tenantId;
|
|
1351
|
+
private appId;
|
|
1352
|
+
private appToken?;
|
|
1353
|
+
private appVersion;
|
|
1354
|
+
private headerKey?;
|
|
1355
|
+
private encryptionKey?;
|
|
1356
|
+
private initializationKey?;
|
|
1357
|
+
private sessionToken?;
|
|
1358
|
+
private deviceToken?;
|
|
1359
|
+
private serverUrl;
|
|
1360
|
+
private publicKeyPem?;
|
|
1361
|
+
private serverPublicKeyBase64?;
|
|
1362
|
+
private hmacKeyHex?;
|
|
1363
|
+
private enableE2eeEncryption;
|
|
1364
|
+
private allowedOrigins?;
|
|
1365
|
+
private offlineGracePeriodMs;
|
|
1366
|
+
private remediationManager;
|
|
1367
|
+
private autoIngest;
|
|
1368
|
+
private isHandshakeApproved;
|
|
1369
|
+
private isOfflineMode;
|
|
1370
|
+
private hasBiometricConsent;
|
|
1371
|
+
private preferHeaderAppToken;
|
|
1372
|
+
private strictLeaseBindingEnforcement;
|
|
1373
|
+
private customPolicyKeys?;
|
|
1374
|
+
private customLeaseKeys?;
|
|
1375
|
+
private enableDeviceFingerprinting;
|
|
1376
|
+
private isDestroyed;
|
|
1377
|
+
private hasTabBlurShield;
|
|
1378
|
+
private constructor();
|
|
1379
|
+
static readonly OriginValidator: typeof OriginValidator;
|
|
1380
|
+
static validateProductionServerUrl(serverUrl?: string): void;
|
|
1381
|
+
static init(config?: SecureShieldConfig): Promise<SecureShield>;
|
|
1382
|
+
getHandshakeUrl(): string;
|
|
1383
|
+
getSdkInitializeUrl(): string;
|
|
1384
|
+
initializeWithKeys(isRetry?: boolean): Promise<boolean>;
|
|
1385
|
+
getSessionToken(): string | undefined;
|
|
1386
|
+
getDeviceToken(): string | undefined;
|
|
1387
|
+
isInitialized(): boolean;
|
|
1388
|
+
clearSession(): Promise<void>;
|
|
1389
|
+
executeSdkHandshake(isRetry?: boolean): Promise<boolean>;
|
|
1390
|
+
private checkOfflineGraceLease;
|
|
1391
|
+
isApproved(response?: any): boolean;
|
|
1392
|
+
isHandshakeActive(): boolean;
|
|
1393
|
+
getLatestAuditReport(): SecurityAuditReport | null;
|
|
1394
|
+
grantConsent(category: 'behavioralBiometrics'): void;
|
|
1395
|
+
revokeConsent(category: 'behavioralBiometrics'): void;
|
|
1396
|
+
hasConsent(category: 'behavioralBiometrics'): boolean;
|
|
1397
|
+
private initBiometricListeners;
|
|
1398
|
+
private teardownBiometricListeners;
|
|
1399
|
+
isOperatingOffline(): boolean;
|
|
1400
|
+
getIngestUrl(): string;
|
|
1401
|
+
getPolicyUrl(): string;
|
|
1402
|
+
fetchSignedRemotePolicy(): Promise<void>;
|
|
1403
|
+
private getFailClosedDefaultPolicy;
|
|
1404
|
+
evaluateSecurityState(): Promise<SecurityAuditReport & {
|
|
1405
|
+
trustScore: number;
|
|
1406
|
+
}>;
|
|
1407
|
+
ingestTelemetry(reportPayload?: SecurityAuditReport): Promise<any>;
|
|
1408
|
+
isPaused(): boolean;
|
|
1409
|
+
setPaused(paused: boolean): void;
|
|
1410
|
+
getRemediationManager(): RemediationManager;
|
|
1411
|
+
destroy(): void;
|
|
1412
|
+
runScan(options?: {
|
|
1413
|
+
ingest?: boolean;
|
|
1414
|
+
}): SecurityAuditReport;
|
|
1415
|
+
scan(options?: {
|
|
1416
|
+
ingest?: boolean;
|
|
1417
|
+
}): SecurityAuditReport;
|
|
1418
|
+
getDetailedDeviceSecurityScan(): string;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
export { AdInjectionDetector, AdblockerPresenceDetector, AutomationArtifactsDetector, AutomationEnvironmentDetector, BatterySubsystemDetector, type BiometricConsentOptions, BotBehaviorDetector, BrowserCapabilitySpoofingDetector, BrowserFingerprintDetector, BrowserVersionIntegrityDetector, type CachedLeasePayload, CanvasFingerprintIntegrityDetector, ClientConfigTamperingDetector, ClientHintsConsistencyDetector, type ClipboardCopyResult, ClipboardHijackingDetector, ConsoleTamperingDetector, ContentScriptInjectionDetector, CookiePolicyDetector, CredentialStuffingDetector, CryptoMinerDetector, CssEngineFeatureMatrixDetector, DebuggerDetectionDetector, type DetectorItem, DevToolsDetector, DeviceFingerprintEngine, DomTamperingDetector, DynamicEvalDetector, type EncryptedLeaseRecord, ErrorStackFormatDetector, ExtensionInjectionDetector, ExtensionPermissionAbuseDetector, FontLoadingEnumerationDetector, FunctionPrototypeTamperingDetector, GlobalObjectTamperingDetector, GlobalPrivacyControlDetector, HardwareTopologyDetector, HeadlessBrowserDetector, HiddenElementDetector, HttpsEnforcementDetector, HumanInteractionDetector, IframeClickjackingDetector, ImpossibleNavigationDetector, IndexedDbIntegrityDetector, IndexedDbLeaseVault, InputPointerMediaQueryDetector, IntlLocaleFingerprintDetector, KeyboardDynamicsDetector, type KeyboardDynamicsOptions, type LeaseVerificationResult, LocalstorageSecretsDetector, MaliciousExtensionDetector, ManifestIntegrityDetector, MathFpPrecisionDetector, MediaCapabilitiesCodecDetector, MemoryLeakExploitationDetector, MemoryScrubber, MixedContentDetector, MouseDynamicsDetector, type MouseDynamicsOptions, NativeApiOverrideDetector, NavigatorPropertyIntegrityDetector, NetworkLatencyDetector, type OriginValidationResult, OriginValidator, PayloadSecurityHelper, PermissionsApiSweepDetector, PluginIntegrityDetector, PrototypeChainIntegrityDetector, RemediationManager, type RemediationOptions, type RemediationResult, RuntimeFunctionHookDetector, RuntimeHookDetector, RuntimeIntegrityGuardian, type RuntimeIntegrityReport, SDK_VERSION, ScreenCaptureDetector, ScreenGeometryDetector, ScriptInjectionDetector, type ScriptInjectionOptions, SecureClipboard, SecureMemoryBuffer, SecureShield, type SecureShieldConfig, SecureUiHardening, type SecurityAuditReport, type SecurityEnvelope, type SecurityEnvelopeHeader, SecurityLockoutOverlay, type ServerSecurityVerdict, ServiceWorkerIntegrityDetector, SessionAnomalyDetector, SessionStorageSecretsDetector, type SignedLeaseEnvelope, SriComplianceDetector, SslValidationDetector, type StorageLeakItem, type StorageLeakReport, StorageQuotaEstimateDetector, StorageScrubber, type TabBlurOptions, TabBlurShield, type TamperedApiItem, TelemetrySerializer, TimeManipulationDetector, type TimeManipulationOptions, TouchEventDetector, type TouchEventOptions, UiOverlayDetector, UserAgentTamperingDetector, VirtualBrowserDetector, WasmBytecodeIntegrityDetector, WasmIntegrityDetector, type WatermarkOptions, WebAuthnHardwareAuthenticatorDetector, WebCertificatePinningDetector, WebDnsManipulationDetector, WebProxyDetector, WebSessionHijackDetector, WebStoragePlaintextDetector, WebVpnDetector, WebglRendererVendorDetector, WebgpuSubsystemDetector, WindowFocusDetector, SecureShield as default, getBaseApiUrl, isServerEnvironment, normalizeEnvironment };
|