feat: secure notes + password history + custom fields + quick-win bundle
Big feature trio
- Secure notes (kind='login'|'note') reusing the encrypted_password+iv
pipeline for the body. New sidebar entry, slideover variant (title +
multiline body), distinct card / table-view rendering, badge in name
column, copy-content button replacing the password copy on note rows.
- Password history: entries_password_history table keeps up to 20 prior
ciphertexts per entry. HandleUpdateEntry pushes the pre-update
encrypted_password into history ONLY when it actually differs from
the incoming one (JS reuses originalEncrypted bit-for-bit when the
plaintext is unchanged — avoids spamming history on title/folder edits).
GET /entries/{id}/history endpoint. Slideover modal lists versions
with mask/reveal/copy/revert. Master-pw rotation wipes history (old
ciphertext can't be decrypted with the new key).
- Custom fields: per-entry encrypted JSON array of {label, value,
is_secret}. Same crypto pipeline as the password. Slideover row UI
with label/value inputs, secret toggle (eye), copy, delete. Re-
encryption flows through bulk-import, change-master-password, and
duplicate.
Quick wins
- Cheatsheet overlay (press '?' or topbar button or Ctrl+K). Lists all
hotkeys + global / tray / card actions. SVG icons inline so the
cheatsheet matches the actual app glyphs (no emoji mismatch).
- Open URL button on entry cards: ShellExecute via cmd://app/open-url,
http(s) only, validates entry.site looks like a real hostname.
- Trash auto-purge: setting "Empty trash after N days" (never/7/30/90).
DELETE /entries/trash/old?days=N called at every unlock.
Favicon strategy
- Subdomains (chat.deepseek.com, app.X.com…) now try the SLD first
(deepseek.com.ico) before the full host. DDG often returns a generic
placeholder for subdomains that passes the byte threshold; the SLD-first
switch surfaces the real brand icon.
- Cap bumped 64 KB → 256 KB on all three sides (Delphi fetch, server
endpoint, JS upload). DDG sometimes serves the full-res asset.
UX polish
- Click-outside-slideover: stopPropagation everywhere it bites. Custom
fields buttons (add / delete / secret toggle / copy / eye) all stop
the click bubble so the document-level "close on outside click" handler
doesn't fire when rerender() detaches the target from the DOM.
- Native search-cancel button restyled: cyan accent X via mask-image,
cursor: pointer, breathing room before the Ctrl+K kbd chip.
- Password history modal: scrollable body, multiline wrapped passwords,
hover border highlight.
- Cheatsheet panel widened (560 → 720 px) so the descriptions no longer
ellipsis-clip.
- "+ New" topbar splits into a small dropdown: New login / New note.
- Notes show a "note" badge in table-view name column, italic
"Encrypted note" placeholder in the username column.
Internals
- duplicateEntry copies kind + custom_fields too (one-line forgotten
earlier).
- entries_password_history dropped on master-pw rotation — the old
ciphertexts are unrecoverable with the new key.
- bulk-import re-encryption path includes custom_fields.
CLAUDE.md
- "Entry payload — call sites à toucher ensemble" lists the 6 spots
to update when adding a new (en)crypted field. Notes the historical
miss of kind in duplicateEntry and custom_fields in the rotation +
duplicate.
Repo hygiene
- .gitattributes forces CRLF on Delphi sources (RAD Studio refuses LF).
text=auto for web frontend / docs, binary for .res / .exe / images.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -918,6 +918,7 @@ begin
|
||||
'UPDATE vault_entries SET ' +
|
||||
' encrypted_password = :ep, iv = :iv, ' +
|
||||
' totp_secret = :ts, totp_iv = :tiv, ' +
|
||||
' custom_fields = :cf, custom_fields_iv = :cfiv, ' +
|
||||
' updated_at = CURRENT_TIMESTAMP ' +
|
||||
'WHERE id = :id AND user_id = :uid';
|
||||
|
||||
@@ -929,6 +930,8 @@ begin
|
||||
LIv := LEntry.GetValue<string>('iv', '');
|
||||
LTotpSec := LEntry.GetValue<string>('totp_secret', '');
|
||||
LTotpIv := LEntry.GetValue<string>('totp_iv', '');
|
||||
var LCf := LEntry.GetValue<string>('custom_fields', '');
|
||||
var LCfIv := LEntry.GetValue<string>('custom_fields_iv', '');
|
||||
if (LEntryId <= 0) or (LEncPwd = '') or (LIv = '') then
|
||||
raise Exception.CreateFmt('Invalid entry payload at index %d', [I]);
|
||||
|
||||
@@ -936,18 +939,31 @@ begin
|
||||
LQ.ParamByName('uid').AsInteger := LUserId;
|
||||
LQ.ParamByName('ep').AsString := LEncPwd;
|
||||
LQ.ParamByName('iv').AsString := LIv;
|
||||
// TOTP fields are optional per entry — clear when empty so
|
||||
// existing-NULL rows don't get stomped with empty strings.
|
||||
LQ.ParamByName('ts').DataType := ftString;
|
||||
LQ.ParamByName('tiv').DataType := ftString;
|
||||
if LTotpSec.IsEmpty then
|
||||
LQ.ParamByName('ts').Clear
|
||||
else
|
||||
LQ.ParamByName('ts').AsString := LTotpSec;
|
||||
// TOTP / custom_fields are optional per entry — clear when
|
||||
// empty so existing-NULL rows don't get stomped with empty strings.
|
||||
LQ.ParamByName('ts').DataType := ftString;
|
||||
LQ.ParamByName('tiv').DataType := ftString;
|
||||
LQ.ParamByName('cf').DataType := ftString;
|
||||
LQ.ParamByName('cfiv').DataType := ftString;
|
||||
if LTotpSec.IsEmpty then LQ.ParamByName('ts').Clear
|
||||
else LQ.ParamByName('ts').AsString := LTotpSec;
|
||||
if LTotpIv = '' then LQ.ParamByName('tiv').Clear
|
||||
else LQ.ParamByName('tiv').AsString := LTotpIv;
|
||||
if LCf = '' then LQ.ParamByName('cf').Clear
|
||||
else LQ.ParamByName('cf').AsString := LCf;
|
||||
if LCfIv = '' then LQ.ParamByName('cfiv').Clear
|
||||
else LQ.ParamByName('cfiv').AsString := LCfIv;
|
||||
LQ.ExecSQL;
|
||||
end;
|
||||
// Password history is encrypted with the OLD vault key — we
|
||||
// don't ship the plaintext server-side to re-encrypt it under
|
||||
// the new key. Drop the history rows so a future "Show history"
|
||||
// doesn't surface undecryptable garbage. The user accepts this
|
||||
// as a consequence of rotating their master password.
|
||||
LQ.SQL.Text :=
|
||||
'DELETE FROM entries_password_history WHERE user_id = :uid';
|
||||
LQ.ParamByName('uid').AsInteger := LUserId;
|
||||
LQ.ExecSQL;
|
||||
finally
|
||||
LQ.Free;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user