Commit Graph

622 Commits

Author SHA1 Message Date
r-zakarya d9cadf2cac fix(android): create the top-aligned controls in reverse so they appear in order
FMX stacks Align=Top controls in reverse creation order, so the URL field ended up under the buttons.
2026-08-14 23:41:41 +01:00
r-zakarya 8796bb341d feat(android): HTTP client for the sync endpoint, with ETag reuse
Fetches the opaque container and the ETag; a 304 skips both the download and the 4-second derivation, which is the whole point of keeping the tag between calls. Redirects are not followed - one to another host would send the bearer token there.

Local testing goes through adb reverse tcp:8080 tcp:80, which makes the phone reach the PC as 127.0.0.1 and satisfies the endpoint's loopback exemption. That needs usesCleartextTraffic in the manifest, marked for removal before shipping.
2026-08-14 23:37:06 +01:00
r-zakarya c684d9073f feat(android): adopt the platform PBKDF2, record the timing and what follows from it
Measured on device: Android derives the same key as WebCrypto on a non-ASCII password, so PBEKeySpec does encode as UTF-8 - the doubt that justified the Pascal implementation was unfounded. It is barely faster though, 3869 ms against 4139 ms: PBKDF2 gets no hardware acceleration.

So 4 seconds per container is incompressible, and the iteration count belongs to the desktop format. The answer is not to speed up the derivation but to stop repeating it: derive once per snapshot, then keep the vault locally under an Android Keystore key. Written up in android-client/README.md.
2026-08-14 23:30:15 +01:00
r-zakarya 307bbeae83 chore: ignore the generated project resource too 2026-08-14 23:23:28 +01:00
r-zakarya ffe203a1ef chore: untrack the Android build output
The APK, the .o files and the dex are rebuilt on every compile; versioning them adds 12 MB per build and nothing else.
2026-08-14 23:23:16 +01:00
r-zakarya 4cc79a5216 fix(android): declare KeySpec so the native PBKDF2 call resolves, and report why it fails
generateSecret takes a KeySpec; passing a JObject made the bridge emit a signature no method matches, and the call failed at runtime. Swallowed as 'unavailable', which hid my own mistake for a full test round - the failure now carries its exception message.

Measured on device: the Pascal PBKDF2 takes 6651 ms, unusable per unlock. AES-GCM through JNI works, plaintext and hash match the vector, so the container format is validated end to end.
2026-08-14 23:22:56 +01:00
r-zakarya c607e26c4a feat(android): measure the native PBKDF2 against the vector instead of guessing
The Pascal loop takes 1736 ms on a desktop CPU, so several seconds on a phone - too slow for every unlock. SecretKeyFactory is native and roughly an order of magnitude faster, but PBEKeySpec takes a char[] and the provider picks the encoding, which was the reason for avoiding it.

The non-ASCII vector settles it on a real device: same key means the provider uses UTF-8 and we adopt it; a different key means the Pascal implementation stays. DecryptContainer keeps using the Pascal one until that measurement says otherwise.
2026-08-14 18:33:56 +01:00
r-zakarya 386bf74a2a feat(android): crypto self-test harness on the new FMX project
Two stages tested separately, because a global failure says nothing about where: PBKDF2 against the known derived key - which also runs on Win64, so that stage validates in seconds without deploying to a phone - then AES-GCM against the plaintext hash, Android only.

The vector is embedded as a unit rather than read from a file: no network, no deployment, so a first-run failure can only come from the decryption itself. Work runs on a thread; 600k HMAC rounds on the UI thread would have Android kill the app for not responding.
2026-08-14 18:29:12 +01:00
r-zakarya 02d89c58d2 feat(android): container crypto unit plus a known-answer test vector
PBKDF2 is implemented in Pascal rather than through javax.crypto SecretKeyFactory: PBEKeySpec takes a char[] and the provider decides how those chars become bytes, so a non-ASCII sync password would derive a different key than the browser and fail as 'wrong password'. AES-GCM does go through JNI - one call, hardware-backed, and WebCrypto's tag-appended layout is exactly what Cipher expects.

The vector is generated with WebCrypto itself and uses a non-ASCII password on purpose; an ASCII-only vector would have hidden that bug. It records the derived key separately from the plaintext so a failure points at one stage instead of the whole chain.
2026-08-14 18:04:39 +01:00
r-zakarya 90ac75525a fix(sync-php): read Authorization via getallheaders and tolerate ETag forms
Apache commonly strips Authorization before PHP sees it, so every request looked unauthenticated on a stock XAMPP and answered 404.

If-None-Match is now compared on the bare hash: a validator that lost its quotes, or a weak W/ tag, would never match and each request would silently re-download the whole snapshot - expensive on mobile data and invisible in the logs, a 200 looking perfectly normal.
2026-08-14 17:58:48 +01:00
r-zakarya ec4fa433a9 feat(sync): read-only PHP endpoint serving the encrypted snapshot
Alternative to WebDAV, and the base for an Android client. The server never decrypts: it stores and serves opaque bytes, so a compromise yields ciphertext plus size and mtime.

GET only for now, with a strong ETag and If-None-Match; PUT answers 405 explicitly so a client fails loudly rather than believing it wrote. A bad token answers 404 like a missing snapshot, so an unauthenticated caller learns nothing. HTTPS is required - the bearer token rides a header on every call.
2026-08-14 17:41:34 +01:00
r-zakarya c74b708b39 fix(import): count the trash when deduplicating by uuid
The map was built from state.entries only, so a container entry whose uuid existed just in the trash looked fresh and inserted a second row sharing that uuid - the identity the sync engine relies on. Same blind spot as the resurrection bug in applyRemoteSnapshot.

Also documents F9 and warns that emptying the trash is the wrong way to clean duplicate uuids: the tombstone would kill the live twin on the other device.
2026-08-07 17:35:40 +01:00
r-zakarya ebcd75fd2e feat(backup): include the trash in exports and auto-backups
A backup that silently drops the trash is not a backup: export, empty the vault, import, and the trashed entries were gone for good with nothing said. Both containers now carry state.trashed with deleted/deleted_at, and deleted_at is preserved so a restore resumes the auto-purge clock instead of restarting it - hence its addition to the GET echo.

The sync snapshot deliberately does NOT: the trash is device-local, and re-publishing deleted rows is what produced the duplicate-uuid bug. The two identical export loops were folded into buildBackupEntry first, so the trash handling exists once.
2026-08-07 15:04:41 +01:00
r-zakarya 125cb11756 docs(tests): mark I6 validated — every scenario now passes 2026-08-07 14:55:47 +01:00
r-zakarya afe47259d7 fix(unlock): focus the username first when it is empty, on the quick-search path too
The autofill hotkey already picked whichever field still needed filling; quick search forced the password, so a first unlock or one without a remembered username landed the cursor in the second field.
2026-08-07 14:53:36 +01:00
r-zakarya 476d6660ad fix(hotkeys): a locked vault must not hand the foreground back
Both locked-vault paths cancelled the autofill with the default refocus, which returns the foreground to the captured target - right after Delphi had raised our window. Ctrl+Shift+Q flashed for a frame then Notepad took over; Ctrl+Shift+L moved the window twice because focusApp had to take it back.
2026-08-07 14:48:12 +01:00
r-zakarya d242f09c53 docs(tests): mark F1/F3/F4 validated, section F complete 2026-08-07 12:50:14 +01:00
r-zakarya c3c6bce406 fix(sync): a trashed entry is no longer resurrected as a duplicate
The trash is a soft delete: no tombstone is written and the rows are absent from state.entries, so the merge read their uuids as missing locally and POSTed them back as fresh live entries. Trashing 30 entries then syncing produced 30 live duplicates alongside the trashed originals - two rows sharing one uuid.

applyRemoteSnapshot now loads the trash and skips any uuid found there. Emptying the trash is what writes the tombstone that propagates the delete.
2026-08-07 12:38:07 +01:00
r-zakarya b9b098fe12 fix(editor): fire an input event when the generator fills the password
Assigning .value fires nothing, and the code called soDirtyCheck by hand - so the strength bar, which listens to input, stayed frozen on the previous password. Dispatching the event covers every listener on the field instead of one named handler.
2026-08-07 12:03:42 +01:00
r-zakarya 485dd3631e docs(tests): E5 validated by code inspection, distinguish it from E9
Web storage and process memory are different artefacts; the dump scan says nothing about the former. Also flags the removeItem('cryptoKey') cleanup as deliberate, not dead code.
2026-08-07 11:46:18 +01:00
r-zakarya c1e5d14eac docs(tests): mark H2-H6 validated 2026-08-07 11:02:05 +01:00
r-zakarya af1157f3b0 docs(tests): note that the trash is silently excluded from every backup path 2026-08-03 00:41:15 +01:00
r-zakarya 5236aa8b98 fix(busy): gate the document-level shortcuts too
inert removes elements from focus and hit testing, but shortcuts are listened for on the document and never traverse an element. Ctrl+A still selected every entry under the overlay, Ctrl+K would open the palette behind it, j/k moved the cursor - and Delete ran a batch delete while a sync was writing to the same rows.
2026-08-03 00:04:56 +01:00
r-zakarya a36164174e docs(tests): record the four secret-consuming paths and how to test them
Includes the authenticated WsgiDAV recipe (Basic only, digest off) and the change-event race that can produce a misleading 401.
2026-08-03 00:02:27 +01:00
r-zakarya c8518c806d docs(tests): mark F2 validated, note that the file existing proves nothing
A backup encrypted with an empty password looks perfectly valid on disk; only a successful import proves the stored password reached the encryption.
2026-08-02 23:55:04 +01:00
r-zakarya f8e78f6940 docs(tests): add E9, the renderer memory check that caught the backup password
Records the staging, how to pick the renderer (the GPU child is bigger and holds no JavaScript, so scanning it proves nothing), the soState validity marker, and the measured before/after.
2026-08-02 23:37:07 +01:00
r-zakarya 5ce18e7ab5 fix(prefs): stop pulling secret prefs into the renderer just to render the UI
A renderer dump taken after a quick-unlock, with nothing opened, contained the auto-backup password in cleartext - inside an ExecuteJavaScript string and in the DevTools protocol buffers - and it survived the auto-lock that wipes the vault key.

New prefs/has answers set-or-not without moving the value. The settings panel uses that; only the paths that encrypt a backup, test the WebDAV connection or run a sync fetch the secrets themselves.
2026-08-02 23:21:03 +01:00
r-zakarya 3c14836b15 docs(tests): add D6 for the sticky header spacing 2026-08-02 00:11:06 +01:00
r-zakarya 7074e7ff93 fix(list): keep the header gap constant when it sticks
offsetHeight feeds --hdr-h, where the sticky pagination parks, and it ignores margins - so the 20px gap under the title vanished as soon as the header stuck. Turned into padding: measured and painted, so the spacing stays constant and opaque.
2026-08-02 00:09:33 +01:00
r-zakarya ecaa226354 docs(tests): record that D5 needs checking in all three view modes 2026-08-02 00:06:09 +01:00
r-zakarya 4c734de266 fix(list): give the content header a fixed height
min-height still let a child grow the row, and a couple of stray pixels from the selection bar pushed the grid down in table and list view. A fixed height makes overflow purely visual - nothing inside can move what follows.
2026-08-02 00:04:52 +01:00
r-zakarya 8c633b69de docs(tests): mark D5 validated 2026-08-02 00:03:02 +01:00
r-zakarya a12f3a2c91 fix(list): toggle a checkbox in place instead of rebuilding the grid
renderGrid replaces every card, so the scroll container jumped back to the top: ticking a card near the bottom of a long list threw the user back to the first row. Only the affected card and the selection bar are updated now.
2026-08-01 23:59:53 +01:00
r-zakarya 29ba069659 fix(list): pin the selection bar to the height the header reserves
It was a few pixels taller than the reservation, so selecting anything pushed the whole grid down - the shift moving the bar into the header was supposed to remove.
2026-08-01 23:56:15 +01:00
r-zakarya cb0a366e52 docs(tests): mark B19 validated 2026-08-01 23:53:08 +01:00
r-zakarya 69b0e84f63 fix(editor): whitelist the bar controls, not the whole bars
content-header and pagination were exempt from click-away in full, so their large empty areas were dead: clicking beside the title or next to the page buttons left the editor open. Only the actual controls are exempt now.
2026-08-01 23:48:54 +01:00
r-zakarya dc7b18736e fix(dnd): drop targets only light up for our own entry drags
They accepted any drag then looked for ids in text/plain: dragging text selected in a cell produced NaN, filtered out, so the target invited a drop that could do nothing. Entry drags now carry application/x-pm-entries, mirroring the folder MIME, and all four targets check it before accepting.
2026-08-01 23:32:47 +01:00
r-zakarya 2027d9b820 docs(tests): mark G6 validated 2026-08-01 23:25:00 +01:00
r-zakarya 69a62994b4 fix(views): drop the selection whenever the view changes
Checked ids belong to the view they were made in. Carried into the trash they were LIVE entries while the trash bar offers Delete forever, so a purge could destroy rows that had never been trashed. The checkbox-less views were the visible symptom of the same problem; one rule replaces the special case.
2026-08-01 23:14:31 +01:00
r-zakarya 9e5c5945f9 fix(views): clear the selection when entering a view without checkboxes
The batch bar survived into vault health, the authenticator grid and the audit log, none of which render checkboxes - it kept offering Delete, Move to folder and Add tag on entries the user could no longer see selected.
2026-08-01 22:49:42 +01:00
r-zakarya fb65f4b7d6 fix(hibp): put the progress pill in the toast stack, bottom right
Free-floating it either covered the cards or the sidebar navigation. Inside .toast-container it shares the corner with the toasts, and column-reverse keeps it above them.
2026-08-01 22:41:34 +01:00
r-zakarya 961d77534f fix(hibp): move the progress pill off the sidebar and abort the scan on toggle-off
The pill was pinned to the left edge and covered the navigation, hiding Trash. It also kept counting after Breach check disabled, the workers carrying on with one network round-trip per entry.
2026-08-01 20:12:09 +01:00
r-zakarya fd03c1da25 fix(list): keep the sticky bars above the row checkboxes
The pagination bar and the table header sat at or below the checkbox z-index, and at equal values the later DOM element wins - the cards come after both, so checkboxes of rows scrolling underneath were painted over them. Layers are now explicit: check 2, table header 3, pagination 4, content header 12.
2026-08-01 20:05:51 +01:00
r-zakarya c9068a6732 feat(hibp): show a progress pill while the breach scan runs
Bottom-left, out of the way of the toasts, with a live count. Deliberately not the busy overlay: the scan is network-bound and can take a while, and there is no reason to lock the vault while it runs.
2026-08-01 19:58:16 +01:00
r-zakarya e80703d2c4 fix(health): invalidate the cache when HIBP results change
The dashboard reads its pwned column from state.hibpResults but its cache was computed before the scan finished, so enabling the breach check from the health view showed 0 pwned while the entry cards already carried the flag. Disabling had the mirror problem: results cleared, dashboard still counting them.
2026-08-01 19:49:07 +01:00
r-zakarya 6bee69eb1a feat(health): show the per-category breakdown under the score
Each category is capped, so past the cap fixing one more password leaves the total unchanged and the work looks wasted. The breakdown lists count and points per category, marks a capped deduction with (max), and explains in a tooltip why the score is standing still.
2026-08-01 19:32:37 +01:00
r-zakarya 2436825ed6 docs(tests): G2 is unreachable by design, document the health score steps
G3 invalidates the cache on every mutation, so a stale health list can no longer be staged. Also records why the score moves in steps of 10 and the per-category caps that can make early fixes invisible.
2026-08-01 19:29:40 +01:00
r-zakarya 254bbc3bca docs(tests): mark B14 validated 2026-08-01 19:19:18 +01:00
r-zakarya eaadc06daa docs(tests): mark B18 validated 2026-08-01 19:15:01 +01:00
r-zakarya dca98dde9b fix(busy): swallow the scrolling keys while a blocking operation runs
inert removes the controls from focus but not the document scroll: Space, PageUp/Down, Home/End and the arrows scroll without any focused element, so the page still moved under the overlay.
2026-08-01 19:12:36 +01:00