Typescript Sensitive Information Indexeddb
Description
This detector identifies potential security risks when sensitive information is stored in IndexedDB without proper protection. IndexedDB data is stored locally on the client-side and can be accessed by other scripts or malicious extensions, potentially exposing sensitive data.
Detection Strategy
• Scans TypeScript/JavaScript code for usage of IndexedDB APIs
• Identifies calls to IndexedDB methods like open(), transaction(), objectStore(), add(), put()
• Flags locations where data is being stored to IndexedDB that may contain sensitive information
• Reports vulnerabilities when sensitive data storage patterns are detected in client-side code
Vulnerable code example
function storeUserCredentials(): void {
const password: string = document.referrer; // External data source
const request: IDBOpenDBRequest = indexedDB.open("userDB", 1);
request.onsuccess = function (): void {
const db: IDBDatabase = request.result;
const tx: IDBTransaction = db.transaction("users", "readwrite");
const store: IDBObjectStore = tx.objectStore("users");...✅ Secure code example
function storeUserCredentials(): void {
const userInput: string = document.referrer; // External data source
const request: IDBOpenDBRequest = indexedDB.open("userDB", 1);
request.onsuccess = function (): void {
const db: IDBDatabase = request.result;
const tx: IDBTransaction = db.transaction("users", "readwrite");
const store: IDBObjectStore = tx.objectStore("users");...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.