Threat Modeling & Security Mitigations
A comprehensive STRIDE-based threat modeling assessment was conducted across all client-side JavaScript components, DOM rendering interfaces, and WebAssembly memory bridges. All nine identified threat vectors were fully mitigated in code.
Full Threat Modeling Matrix (Table 4.1)
| Threat Vector | Impact & Severity | Root Cause Analysis | Code-Level Mitigation | Residual Risk |
|---|---|---|---|---|
| Uncompressed Fallback Vulnerability | Browser freeze/crash (DoS) due to millions of raw characters; large executable injection. | Legacy fallback in catch blocks reading uncompressed raw bytes if AVIF/Brotli failed. | Completely removed fallback. Any compression failure immediately halts pipeline, resets UI, and alerts user. | None |
| File Signature Bypass | Malicious payload stego-hiding via fake extensions. | Relying solely on file names and browser-reported MIME types with OR operator. | Mandatory Magic Bytes checking and strict extension validation at entry point (handleImgFileSelect). | None |
| HTML Filter Bypass (accept attribute) | Injecting unsupported files into JavaScript runtime. | Drag-and-drop or selecting "All Files" in dialog bypassing HTML accept attribute. | Enforcing programmatic byte-level validation across all input vectors before buffer allocation. | None |
| Object URL Memory Leak | Excessive RAM consumption leading to browser tab crashes during long sessions. | Failing to call URL.revokeObjectURL() on temporary preview links during repeated uploads. | Implemented clearPreviousImgUploadedFile() to immediately revoke previous preview URLs. | Very Low (Memory released on tab close) |
| DOM-Based XSS (Code Injection) | Malicious script execution, session theft, and LocalStorage exfiltration. | Injecting user hints or emoji fields into UI directly via innerHTML. | Implemented escapeHtml(hintText) and replaceChildren() to sanitize all inputs before DOM insertion. | Very Low |
| Freezing Tab UI / DOM Bloat | Browser freeze, RAM exhaustion, and tab termination from huge JSON files. | Uploading massive JSON files with thousands of hint objects creating endless DOM nodes. | Enforced strict 50 KB file limit, capped display to 40 items, and constrained field lengths (Hint ≤ 60 chars). | None |
| Data Loss & LocalStorage Corruption | Loss of hint history or disabling of the hints tab due to parse exceptions. | Overwriting LocalStorage without prior structural validation of existing data. | Wrapped all JSON operations in try-catch and called validateHints() before writing to storage. | Low (External OS crash only) |
| Logic & Integrity Tampering | Injecting malformed fields, corrupting filter tabs, or hiding crucial data. | Checking only for valid JSON syntax without validating subfield types (e.g. 'sent' vs 'received'). | Upgraded validateHints() to enforce strict element schemas and added custom security modal alerts. | Low |
| Accidental Data Deletion | Permanent accidental loss of user history due to mistaken button clicks. | Relying on browser native confirm() which is easily dismissed or triggered accidentally. | Replaced with custom confirmation modal featuring backdrop blur and danger-styled action buttons. | None (Requires conscious click) |