Skip to content

Release 1.5.0: search freeze, keyboard shortcuts, extension restart, sync and log privacy fixes - #143

Merged
rcsarv merged 15 commits into
mainfrom
dev
Nov 25, 2026
Merged

rcsarv merged 15 commits into
mainfrom
dev

Conversation

@rcsarv

@rcsarv rcsarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Brings everything merged into dev since release PR #141 into main, so the unpublished v1.5.0 tag can be moved onto it and pushed. Users get one release, not two.

Folded into the 1.5.0 notes:

The changelog's 1.5.0 section is dated 2026-11-25 and holds all of the above.

Tested: the whole suite passes on the merged dev (TURBO_FORCE=true pnpm test): core 4,682, storage 1,964, desktop 11,808 (17 skipped), site 144.

After merge: the v1.5.0 tag moves to the merge commit and is pushed, which starts release.yml.

🤖 Generated with Claude Code

GitHub withdrew both advisories held in pnpm.auditConfig.ignoreCves
(http-cache-semantics on 2026-10-28, braces on 2026-10-23), and on
2026-11-18 the picomatch advisory (GHSA-fc5q-39xc-vjpf) that had been
failing the audit gate on main. pnpm audit --audit-level=high now exits 0
with no ignore list, so the list is removed.

fast-xml-parser, which the desktop app ships to read text from office
attachments, goes from 5.11.2 to 5.12.1 for GHSA-474x-hrwr-fgx4 (low). The
app configures no stop nodes, so the affected code was never reached.

SECURITY.md records the 2026-11-19 review: no high or critical advisory,
and two moderate ones in build tools with no fix those tools accept.
…est under the app's heap cap

A follow-up to the OS-sandboxed extension renderer (#107, CASA item 15),
which brought the sandbox-escape harness, its out-of-memory probe and the
automatic restart after a crash.

The "Extension sandbox escape test (macos-latest)" CI job failed about one
run in six, never on Linux or Windows. Right after the probe ran out of
memory, reloading it threw "The extension sandbox did not load" (15 s).

Cause: the harness did not run Electron with the app's V8 flags. main.ts
sets --js-flags=--max-old-space-size=2048 and Chromium hands it on to every
renderer, extension sandboxes included. Without it the probe filled about
3.6 GB on a 7 GB runner (Heap: used=3586MB limit=3680MB in every failing
run), and the next sandbox start took 1.6 to 14.8 s even in passing runs: a
continuous tail against the 15 s timeout, not a hang.

That exposed a product gap: if the restart planned after a crash was slow,
its failure was only logged and recovery ended there. The extension stayed
off until the app was restarted.

- electron/v8-flags.ts: appJsFlags() is the one source of the heap cap, used
  by main.ts and the harness.
- extension-host: a restart after a crash whose sandbox start timed out
  counts as one attempt and plans the next (2 s, 15 s, 60 s). A refused
  start, a first start, or extension code that timed out is not retried.
  The problem card is held while an attempt is pending and shown once when
  every attempt has failed.
- Harness: after the out-of-memory crash it waits for the app's own restart
  (bounded by the delays and both timeouts) instead of racing a reload
  against it. New check "out of memory: it comes back by itself". run.mjs's
  kill timer goes from 240 s to 360 s to cover that wait. This changes what
  the harness checks there, deliberately.
- Tests: five scripted-start cases in extension-sandbox-boundary.test.ts
  (retry after a slow start, give up after the bounded attempts with one
  card, no retry on refusal, on an extension-code timeout, or of a first
  start) and v8-flags.test.ts (main.ts and the harness both use the helper).
- Docs: the project conventions file lists appJsFlags; docs/TESTING.md notes
  why the harness uses it; CHANGELOG Fixed entry.

With the cap, the probe now stops at used=2052.6MB limit=2144.0MB locally.
The harness passes all three scenarios (159 checks) and the escapes
scenario passed 4 of 4 repeated runs.
Merging main after the 1.4.12 release put this branch's entry inside the
released 1.4.12 section, next to the entry it was written beside. Move it
back under Unreleased. The 1.4.12 section is again byte-identical to the
one in the v1.4.12 tag.
….log

The rest of the app.log privacy work. The earlier fixes took mail text and
correspondents' addresses out of the log. This takes out what still named the
user, and makes crash reports and token requests carry less:

- Account ids spell out the owner's address (`acct-<local>-<domain>--<host>`).
  They are now written as `accountLogLabel(id)`, a short stable hash.
- Folders, Gmail labels, keywords and AI categories the user created are now
  written as `folderLogLabel` / `labelLogLabel` / `categoryLogLabel`. System
  folders keep their names. The helpers are in
  packages/core/src/utils/log-labels.ts.
- Absolute paths no longer name the user through the home folder:
  `logPath` / `withoutHomeDir` in main, `pathForLog` / `redactHomeDir` in core.
  As a backstop, the release file logger and the crash-report scrubber rewrite
  the home folder as `~` and redact any account id they find.
- Failures that could quote mail or a server's answer are logged by their kind
  (`errorDiagnostic` / `failureCause`), not by the error.
- Crash reports:
  - The user id is a random `crashReportInstallId()` kept in userData, no
    longer a shortened hash of the address, which anyone guessing the address
    could confirm.
  - Request query strings are dropped.
  - The secret scrubber also removes sign-in codes, keys, passphrases and
    `Basic` passwords.
- Token refreshes and the profile fetch after sign-in use `redirect: 'error'`,
  so a refresh token is never sent again to an address a redirect names.
- The token refresher's error keeps a non-JSON response body in `detail`, not
  in its message. Callers log the message, and such a body can be a token in
  another encoding.
- `apps/desktop/test/helpers/core-log-helpers.ts` gives desktop tests that mock
  `@sarvinbox/core` partially the real log helpers.
- The CHANGELOG [Unreleased] Security section, privacy policy §2 and §4.2, and
  the shared-helpers list in the project conventions file all describe this.

Pre-existing tests changed on purpose, because the log lines changed:
- Their expectations now use the account and folder labels and the failure
  kind instead of the id, name or message. Files: body-reheal-scheduler,
  unified-pipeline-service-gmail-token, useFirstEmailSplit, first-split
  job/store, sync-slice, emails-slice, startup-thread-repair, update-service,
  sender-identity-service, file-logger, oauth-loopback, folder-classification.
- token-refresher now checks the body in `detail` and not in the message.
- Partial `@sarvinbox/core` mocks spread the real log helpers.
- sentry-privacy and telemetry-scrub cover the new user id, the query strings
  and the wider scrubbing.

Each changed expectation carries a "Changed deliberately (log privacy)"
comment. None was loosened.
FolderSyncer.syncFolder saved the server's UIDNEXT before fetching anything.
Later syncs read that value to skip a folder as unchanged, and the periodic
background sync always does. So one failed fetch (a timeout, a dropped
connection) left the folder looking up to date: every later sync skipped it,
and the new mail stayed on the server until something else arrived there.

- The message count is still written up front (the list counter and "load
  more" read it). UIDNEXT is written only after a pass that downloaded
  everything up to it.
- A failed pass clears the saved UIDNEXT, so the next sync checks the folder
  again. Clearing, rather than keeping the older value, also covers a pass that
  failed while syncing flags or deletions.
- A full sync with a failed batch counts as incomplete.
- fetchNewestMessagesWindowed reports `interrupted` when a lower batch fails
  after newer mail arrived, and that pass counts as incomplete too.
- A flags-only pass downloads no new mail, so it leaves the value alone.
- A pass that stops at its message or time limit still counts as caught up:
  the drain job fills the rest. Marking it incomplete would re-download the
  same newest mail on every sync.

skip-unchanged-after-failure.test.ts covers, against the fake IMAP server:
- a one-off failure and a repeating one;
- a recovery that inserts nothing twice;
- a failed full-sync batch;
- an interrupted fetch;
- a flags-only pass;
- two accounts;
- the reset write itself failing.

All 8 fail with the old folder-syncer.ts. incremental-fetch.test.ts covers the
`interrupted` flag. CHANGELOG [Unreleased] → Fixed has the entry.

Pre-existing test changed on purpose: folder-name-log-privacy.test.ts re-ran
the sync with skipUnchanged forced off to get around this bug. It now uses the
default sync, which picks the folder up again.
A search built the whole record of every match before ORDER BY ... LIMIT
threw all but one page away. In the full-text path that meant, for every
match, its body through email_bodies and the search index's own stored
copy of its text: the join named emails_fts.email_id, and fts5 can only
hand out a stored column by loading that row's whole stored text,
decrypted page by page. A common word matches thousands of messages, so
on a real mailbox one 61-row search for "meeting" froze the main process
for 25 seconds, and an Inbox Agent question that ran 48 such searches
hung the app for 219 seconds (2026-11-24, seen in app.log and a stack
sample: sqlite3_step -> fts5ColumnMethod -> ChaCha20 page decryption).

Search now chooses its page from narrow rows (rowid, date, sort key,
score) and hydrates only the page's members. The index joins emails by
rowid, which it already holds equal to the emails rowid (the rowid
contract from migration 84); count, the doesntHave exclusion and the
conversation search join the same way. The LIKE fallback shares the same
page query. Ties now break on date, then rowid, so a page boundary is the
same row every time.

Measured on the same mailbox and question: 219 s -> 44 s for the whole
answer, longest freeze 32 s -> 1.9 s.

Tests: bodies read only for the page (a counting view over email_bodies,
by date, relevance, exclusion, filter-only and the LIKE fallback); the
join uses the rowid, not the stored email_id; paging through equal dates
neither repeats nor skips; page order and relevance scores survive the
split; VACUUM keeps the index's rowids on their own emails. Five of these
fail on the old code; the filter-only and fallback cases already deferred
their reads there and guard the shared page query.
…il body

A mail body renders in a sandboxed iframe (the standard reader and every
chat-view bubble), which is a document of its own. Clicking in it, a link
above all, made that frame the focused frame, and Chromium then delivered
every keydown to the frame's document. The shortcut listeners are on the
app's document, so j/k, e, #, / and Escape went dead until the user clicked
outside the body. Returning from the browser a link opened in did not help:
the window-focus restore leaves an already-focused element alone, and the
frame is that element.

Keydowns in a frame that runs no script (sandboxed without allow-scripts,
i.e. the mail bodies) are now replayed on the iframe element in the app's
document, attached when focus enters the frame (window blur with the frame
active) and re-attached when the frame loads a new document. If an app
listener handles the replay, the original is prevented too. Focus stays in
the frame, so copying a selection there keeps working; keys typed into a
field in the mail and IME composition are not forwarded; extension panels
(which run script) are left alone. No sandbox or CSP change.

The shortcut hook now uses the shared, realm-agnostic typing-target check,
and its go-to console.log lines move to the shared logger without the key.
# Conflicts:
#	CHANGELOG.md
#	CLAUDE.md
…nce it was cut

The 1.5.0 tag was never pushed, so the search freeze, keyboard shortcut,
extension restart, folder sync and log privacy fixes and the XML reader
update ship in 1.5.0 instead of a separate release.
} as any);

// Whether this pass fetched everything up to boxStatus.uidNext.
let caughtUp = true;
@rcsarv
rcsarv merged commit 2bd55b9 into main Nov 25, 2026
23 checks passed
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.

2 participants