Skip to content

fix: hardening from the code review - #51

Merged
jewei merged 7 commits into
mainfrom
fix/hardening
Oct 8, 2026
Merged

jewei merged 7 commits into
mainfrom
fix/hardening

Conversation

@jewei

@jewei jewei commented Oct 8, 2026

Copy link
Copy Markdown
Owner

What changes

Fixes from an outside code review (ChatGPT, at f6bb1e1), after checking each finding against the code. One commit per fix:

Review finding Fix Test
F1: a failed note save is not retried The note stays unsaved after a failure, so leaving it or closing the card saves again; the error stays until a save works Launcher test: first save fails, the next blur saves the same text
F2: clipboard images are cached for an hour Copied images are served with Cache-Control: no-store; icons keep max-age=3600 Unit test of both headers
F3: the Linux card read has no owner check clipboard_text() drops both GTK replies when the clipboard owner changes between them, as capture does CI compile only (GTK main thread)
F4: weather A → B → A race Each download gets a number; only the latest stores its result or ends the busy state Unit test of WeatherAttempt::start
F6: database permissions "fail open" Kept open (losing pins and snippets would be worse), but the failure now shows as a launcher warning that says what to do, not only in the log Opening a fresh database gives no warning

Not done on purpose:

  • F5 (launcher position saves out of order): Center clears the drag flag first, and the post-drag save runs within milliseconds of hiding. The race needs the launcher reopened and Center chosen inside that time.
  • F7 (README and weather): fixed in feat(currency): keep rates off until the user turns them on #48.
  • Signing the update manifest: each update file is already verified against TinyDash's key, so a changed manifest cannot install foreign code.

A related issue the review missed is fixed in #48: a rates download that ended after rates were turned off saved them again.

Commands run

Command Result
bun run verify Pass: 129 frontend tests, build OK, 153 Rust tests

jewei added 7 commits October 8, 2026 15:23
A failed save cleared the unsaved mark, so leaving the field never tried
again and quitting could lose the text. The note now stays unsaved until
a save works.
Clipboard images were served with the one-hour cache of icons, so the
webview could keep a deleted or hidden image on disk. They are now
no-store; icons keep their cache.
The card read checked secret markers and then read the text in two GTK
requests; a newer copy between them could show text whose markers were
not checked. Both replies now need the owner they started with.
An older download for the same city (A, then B, then A again) could end
the newer one's busy state. Each download now has a number, and only the
latest may store its result.
A failure to restrict tinydash.db to the user only reached the log. It
now shows as a launcher warning that says what to do; the data still
opens.
@jewei
jewei merged commit dd4f5eb into main Oct 8, 2026
6 checks passed
@jewei
jewei deleted the fix/hardening branch October 8, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant