What happened?
With an app lock configured, on the web or desktop, on first app load, everything is encrypted correctly. After you unlock the app, and the app re-locks, the connection to the database is not unloaded properly, and your notes can still be queried.
I would expect an app lock would truly lock + unload.
Steps to reproduce the problem
To verify on first load that notes are encrypted/nothing retrievable:
- Load up fresh/Ctrl+Shift+R a logged in session, with app lock enabled
- Open dev console of your browser and run:
(async () => {
const dbs = await indexedDB.databases();
console.log("IndexedDB databases present:", dbs.map(d => d.name));
// Dump the KeyStore's own secret store — this is where `databaseKey`,
// `userEncryptionKey`, and `lockAfter` are kept (apps/web/src/interfaces/key-store.ts).
const req = indexedDB.open("KeyChain-secrets");
req.onsuccess = () => {
const db = req.result;
const tx = db.transaction("secrets", "readonly");
const getAll = tx.objectStore("secrets").getAll();
const getKeys = tx.objectStore("secrets").getAllKeys();
getAll.onsuccess = () => {
getKeys.onsuccess = () => {
getKeys.result.forEach((k, i) => {
console.log(`secret "${k}":`, getAll.result[i]);
});
};
};
};
})();
- Result should be all unreadable bytes. Unlock, then go Dev Tools -> sources
- Open
wa-sqlite-kysely-drivers.ts and set a breakpoint on line 315 (currently - it's the executeQuery function of WaSqliteWorkerConnection)
- Do something like open a note to trigger the breakpoint
- Go to scope panel -> right click on variable "this" and store it as a global variable - like "temp1" or similar
- Resume app + remove breakpoint if needed
- Lock app
- In the console, run:
await temp1.worker.run("query", "select id, noteId, data, locked, dateEdited from content limit 5", [])
- See all your notes/attachments data returned
Version
3.4.5-b5140d9-web
Platform/OS
Chrome/Chromium
Relevant log output
What happened?
With an app lock configured, on the web or desktop, on first app load, everything is encrypted correctly. After you unlock the app, and the app re-locks, the connection to the database is not unloaded properly, and your notes can still be queried.
I would expect an app lock would truly lock + unload.
Steps to reproduce the problem
To verify on first load that notes are encrypted/nothing retrievable:
wa-sqlite-kysely-drivers.tsand set a breakpoint on line 315 (currently - it's the executeQuery function of WaSqliteWorkerConnection)await temp1.worker.run("query", "select id, noteId, data, locked, dateEdited from content limit 5", [])Version
3.4.5-b5140d9-web
Platform/OS
Chrome/Chromium
Relevant log output