Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.5.0] - 2026-11-24
## [1.5.0] - 2026-11-25

### Added
- **Inbox Agent works through a request step by step.** It now decides for
Expand Down Expand Up @@ -108,6 +108,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
goes to the agent like any other request, which finds the emails it means
and prepares a card.

### Fixed
- **Keyboard shortcuts keep working after you click inside a message.**
Clicking a link in an email (or anywhere in its text) moved the keyboard into
the message, and every shortcut — next and previous mail, archive, delete,
search, Escape — stopped responding until you clicked somewhere outside it.
Shortcuts now work straight away, in the standard view and in chat view,
while copying text you selected in the message and typing into a field in it
work as before.
- **Searching for a common word no longer freezes the app.** A search used to
read the full text of every email that matched before showing the first
page, so a word found in thousands of emails (such as "meeting") could stop
the whole app for half a minute, and an Inbox Agent question that ran many
searches could hang it for minutes. Search now picks the page of results
first and reads only those emails.
- **A crashed extension comes back even when the computer is slow to
recover.** When an extension crashes, for example by running out of memory,
the app starts it again, up to three times. If the first of those starts was
slow because the computer was still freeing the memory the crash had used,
that one slow start ended the recovery: the extension stayed off until the
app was restarted. A start that is too slow now counts as one attempt and
the next one follows. You are told only once every attempt has failed.
- **New mail no longer stops arriving in a folder after one failed sync.** If
fetching a folder's new mail failed once (a timeout, a dropped connection, a
busy server), the app still noted the folder as up to date, and the regular
background sync then skipped it as unchanged. The missed mail stayed on the
server until something else arrived in that folder or you refreshed it by
hand. A folder is now noted as up to date only once its new mail has really
been downloaded, so the next sync picks up what the failed one missed.

### Security
- **The XML reader used for office attachments is updated to 5.12.** It fixes a
low-severity slowdown on malformed tags
([GHSA-474x-hrwr-fgx4](https://github.com/advisories/GHSA-474x-hrwr-fgx4)).
Sarv Inbox never used the affected feature, so earlier versions were not
exposed.
- **The log file no longer names your accounts, folders or user folder.**
Every line about an account carried its internal id, which spells out the
email address, and lines about syncing named your folders, labels and AI
categories. These are now written as short codes (system folders such as
Inbox and Sent keep their names), file locations are written without your
home folder, and failures that could quote mail or a server's answer are
recorded by their kind only.
- **Crash reports carry less about you.** A report no longer identifies you by
a shortened hash of your email address, which anyone guessing your address
could confirm; it uses a random code made on your computer instead. Web
requests in a report no longer keep their query string (which can hold keys
and search words), and sign-in codes, keys, passphrases and `Basic`
passwords are removed from reports and the log file wherever they appear.
- **Sign-in tokens are never resent to a redirected address.** If an email
provider's token service answered a refresh with a redirect, the app would
have sent your refresh token again to wherever it pointed. It now refuses
the redirect and retries later, and the same goes for fetching your profile
after sign-in.


## [1.4.12] - 2026-11-24

### Fixed
Expand Down
33 changes: 33 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ lands in `app.log` consistently:
field NAMES (`setFieldNamesForLog`), a URL's scheme (`urlSchemeForLog`) and
`errorDiagnostic(error)` instead of the error, whose message can quote any of
those. Prove it with a sentinel test (`captureLogs`).
- **Names that belong to the user are labels in a log line.** An account id
spells out its owner's address (`acct-<local part>-<domain>--<host>`):
write `accountLogLabel(id)`. A folder, Gmail label, keyword or AI category
the user created is text they typed: `folderLogLabel(path)` (system folders
stay readable), `labelLogLabel(name)`, `categoryLogLabel(slug, isSystem)`.
An absolute path names the user through their home folder: `logPath(p)` in
main (`<userData>/…`, `~/…`), `pathForLog` / `basename` elsewhere. The file
logger rewrites the home folder as `~` and, in a release, account ids it
finds, and crash reports get the same — a backstop, not a licence.

## Native modules: better-sqlite3 has TWO ABIs — never flip it by hand

Expand Down Expand Up @@ -422,12 +431,36 @@ Established shared helpers (extend this list as you add more):
user's approval (or within the "Approve for me" cap), each row at most once,
protected rows only when ticked, Undo only for rows still as the set left them.
A new agent write tool stages through it; never call a mail action from a tool.
- `accountLogLabel(id, missing?)` / `folderLogLabel(path)` / `labelLogLabel(name)` /
`categoryLogLabel(slug, system)` / `redactAccountIds(text)` —
`packages/core/src/utils/log-labels.ts` (renderer: `@sarvinbox/core/log-labels`).
The stand-ins a log line uses for the account (`acct#1a2b3c4d`), a folder,
label or AI category the user named: a short stable hash, so lines still
match and grep. `redactAccountIds` is the backstop the release file logger
and the crash-report scrubber run over every line.
- `pathForLog(path, { userData, home })` / `redactHomeDir(text, home)` —
`packages/core/src/utils/log-paths.ts` (Node only); in main, `logPath(path)` /
`withoutHomeDir(text)` — `apps/desktop/electron/utils/log-path.ts`, rooted at
this app's data folder and the user's home. A path for a log line without the
home folder (and the user's name in it).
- `crashReportInstallId()` — `apps/desktop/electron/services/crash-report-pref.ts`.
The crash reports' user id: a random UUID kept in userData, never anything
derived from an address.
- `apps/desktop/test/helpers/core-log-helpers.ts` — the REAL core log helpers
(`errorDiagnostic`, the log labels, `pathForLog`) for a desktop test that mocks
`@sarvinbox/core` partially. Spread it first in the mock factory; a mock
without them fails at the first log line the code under test writes.
- `createAssistantHarness()` — `apps/desktop/test/helpers/assistant-harness.ts`.
The real Inbox Agent end to end for tests (real databases, history store and
provider call path; scripted network). Use it instead of hand-wiring
`InboxAssistantServiceDeps` when a test asks the agent a question. The
evaluation in `apps/desktop/test/eval/assistant/` is built on it; see
[docs/TESTING.md](docs/TESTING.md), "Inbox Agent evaluation".
- `appJsFlags(extra?)` / `V8_MAX_OLD_SPACE_MB` — `apps/desktop/electron/v8-flags.ts`.
The app's V8 flags. Chromium passes `--js-flags` to every renderer, the extension
sandboxes included, so this 2 GB heap cap is also how much an extension can
take. Use it wherever Electron is launched with `js-flags`, the sandbox-escape
harness included, so a test runs under the cap that ships.

## Prefer a mature library over hand-rolled / regex logic

Expand Down
77 changes: 50 additions & 27 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,33 +125,56 @@ A handful cannot be fixed that way. Those are listed in
pnpm 8 offers — and every entry must be justified here. An undocumented entry is
a bug: the point of the gate is that nothing high-severity is silently carried.

Reviewed 2026-10-12 (`pnpm audit --audit-level=high` exits 0; the full report
without the ignore list shows 2 high, both below, and 3 moderate, noted after
the table). Neither high advisory has a fixed version that an override could
reach, so both exceptions stay:

| CVE | Package | Why it is accepted | Removed when |
| --- | --- | --- | --- |
| [CVE-2026-93748](https://github.com/advisories/GHSA-ch52-4w7c-c8xp) | `http-cache-semantics` <= 4.2.0 | Cross-user response disclosure requires a shared HTTP cache accepting attacker-controlled `max-stale` directives. The dependency is reached only through the desktop **build tool** `electron-builder` → `app-builder-lib` → `@electron/get` → `got` → `cacheable-request`. Inbox does not use this chain to handle mail, OAuth, scanner requests, or shared user caches. **No patched release exists.** 4.3.0 (2026-10-04) is not one: it fixes a different advisory (CVE-2026-93750, `Vary` matching) and leaves `max-stale` handling unchanged. Because the advisory's range stops at 4.2.0, `pnpm audit` would nonetheless report this CVE as gone on 4.3.0, so do not read a clean audit after such a bump as a fix. This is a temporary exception for that reviewed tooling scope, not a vulnerability fix. | A release that actually changes `max-stale` handling ships (check its diff, not the advisory range), the build tool drops it, or a runtime/shared-cache path appears (reassess before shipping). |
| [CVE-2026-93687](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm) | `braces` <= 3.0.3 | Stack exhaustion requires deeply nested glob patterns. All dependency paths are **tooling**: ESLint/globby, Tailwind/chokidar/fast-glob, and Metro/Jest. These tools process project patterns, not mail bodies, attachments, or user-supplied runtime patterns. **No patched release exists** (3.0.3 is the latest published version). The remaining build-tool risk is accepted temporarily; the package itself remains vulnerable. | A patched release becomes available, the tooling drops it, or an untrusted runtime-pattern path appears (reassess before shipping). |

Moderate, no fixed version (below the gate, so not in `ignoreCves`; listed so
the full report holds no surprises):

- [CVE-2026-97058](https://github.com/advisories/GHSA-hp3w-g68c-fv3c),
`sprintf-js` <= 1.1.3 (denial of service through unbounded precision
specifiers). 1.1.3 is the latest release. Reached only by dev and build
tooling: 1.0.3 via `packages/ui-primitives` → `react-native` (an optional
peer) → `babel-jest` → … → `js-yaml@3` → `argparse@1`, and 1.1.3 via
`electron-builder` → `@electron/get` → `global-agent` → `roarr`. Neither is
in the shipped app.
- [CVE-2026-104844](https://github.com/advisories/GHSA-rj75-hqrm-r3gf),
`postcss-selector-parser` < 7.1.6 (quadratic parsing of flat selectors).
Fixed only in 7.1.6. 6.1.4, the last 6.x release, comes from Tailwind CSS 3
(`tailwindcss` and its `postcss-nested`), a devDependency that requires the
6.x line. Forcing 7.x on it would be an incompatible major-version override.
It runs at build time over the app's own stylesheets and never parses email
or user CSS.
Reviewed 2026-11-19: `pnpm audit --audit-level=high` exits 0 with **no ignore
list**, and the full report shows no high or critical advisory. The list was
emptied because GitHub withdrew both advisories it held, so there is nothing
left to accept:

- [CVE-2026-93748](https://github.com/advisories/GHSA-ch52-4w7c-c8xp),
`http-cache-semantics` <= 4.2.0, withdrawn 2026-10-28. It was reached only
through the build tool `electron-builder`.
- [CVE-2026-93687](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm),
`braces` <= 3.0.3, withdrawn 2026-10-23. It was reached only through
tooling (ESLint, Tailwind, Metro, Jest).

[GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf)
(`picomatch` <= 4.0.7, high, no fixed version) failed the gate until GitHub
withdrew it on 2026-11-18, so no entry was added for it. If a withdrawn advisory
is ever reinstated, the gate fails again and it is reviewed here like any other.

The one advisory in a package the app ships was fixed by upgrading:
[GHSA-474x-hrwr-fgx4](https://github.com/advisories/GHSA-474x-hrwr-fgx4)
(low, quadratic CPU when scanning unterminated stop-node tags) in
`fast-xml-parser` <= 5.11.2, which reads the text of office attachments for the
Inbox Agent. The app configures no stop nodes, so 1.4.11 and earlier never ran
the affected code; the dependency and its override now require 5.12.0 or later.

Moderate, no fixed version these tools accept (below the gate, so not in
`ignoreCves`; listed so the full report holds no surprises):

- [CVE-2026-118773](https://github.com/advisories/GHSA-3g3m-2fjr-6pw4),
`glob` 9.0.0 to 14.0.1 (an aborted walk can keep reading the filesystem
after its `AbortSignal` fires). Fixed only in 14.0.2. 13.0.6 comes from
`@electron/asar` and `@sentry/vite-plugin`, both desktop devDependencies used
while packaging. They walk the project's own build output and never cancel a
walk to bound untrusted input.
- [CVE-2026-118764](https://github.com/advisories/GHSA-g3hv-75wg-m249),
`minimatch` 7.0.0 to 11.0.0 (denial of service through globparts
amplification). Fixed only in 11.0.1. 9.0.9 comes from `@typescript-eslint`
6 (lint) and `electron-builder` → `@electron/universal`; 10.2.6 from
`@electron/asar`, `electron-builder` → `app-builder-lib` and
`@sentry/bundler-plugins`. Every pattern is one the project's own build or
lint configuration supplies; none comes from mail or the user.

Forcing either onto its new major line would be an incompatible major-version
override on those tools. Neither package is in the shipped app.

The 2026-10-12 review also listed two moderates that are now gone:
[CVE-2026-97058](https://github.com/advisories/GHSA-hp3w-g68c-fv3c)
(`sprintf-js`) was withdrawn on 2026-10-22, and
[CVE-2026-104844](https://github.com/advisories/GHSA-rj75-hqrm-r3gf)
(`postcss-selector-parser`) gained a 6.x fix, 6.1.5, which the
`postcss-selector-parser@6` override already requires.

The previous Vite exception (`CVE-2026-53571`) was removed: the desktop now
uses Vite 8. The two `image-size` exceptions (`CVE-2025-71329` and
Expand Down
9 changes: 4 additions & 5 deletions apps/desktop/electron/ipc/accounts-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* is active on launch, so no account can grab the primary's database.
*/
import type { EmailRecord, SearchQuery, ViewFilter } from '@sarvinbox/core';
import { createLogger, errorDiagnostic } from '@sarvinbox/core';
import { accountLogLabel, createLogger, errorDiagnostic, redactAccountIds } from '@sarvinbox/core';
import { ipcMain } from 'electron';


import { settleRevocation, type AccountRevocation } from '../services/account-revocation';
import {
listRegistryAccounts,
Expand Down Expand Up @@ -197,7 +196,7 @@ export function registerAccountsHandlers(): void {
try {
keepAccountIds = readRegistryAccounts().map((a) => a.id);
const removed = cleanupOrphanedAccountDbs({ keepAccountIds, staleAfterMs: 0 });
if (removed.length) logger.info(`[Accounts] removal swept ${removed.length} orphan file(s):`, removed.join(', '));
if (removed.length) logger.info(`[Accounts] removal swept ${removed.length} orphan file(s):`, redactAccountIds(removed.join(', ')));
} catch (e) {
logger.warn('[Accounts] orphan DB sweep after removal failed or was skipped:', (e as Error).message);
}
Expand Down Expand Up @@ -360,7 +359,7 @@ export function registerAccountsHandlers(): void {
]);
return { emails: emails.map((e) => ({ ...e, accountId })), total };
} catch (e) {
logger.warn('[Accounts] unifiedInbox: skipping account', accountId, (e as Error).message);
logger.warn('[Accounts] unifiedInbox: skipping account', accountLogLabel(accountId), (e as Error).message);
return { emails: [], total: 0 };
}
}),
Expand Down Expand Up @@ -449,7 +448,7 @@ export function registerAccountsHandlers(): void {
return { emails: emails.map((e) => ({ ...e, accountId })), total };
} catch (e) {
// Class and code only: a search error can name the query's words.
logger.warn('[Accounts] unifiedSearch: skipping account', accountId, errorDiagnostic(e));
logger.warn('[Accounts] unifiedSearch: skipping account', accountLogLabel(accountId), errorDiagnostic(e));
return { emails: [], total: 0 };
}
}),
Expand Down
6 changes: 3 additions & 3 deletions apps/desktop/electron/ipc/agent-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { UserActionType, ActionSource } from '@sarvinbox/core';
import { createLogger, setEmailReadFlag } from '@sarvinbox/core';
import { accountLogLabel, createLogger, setEmailReadFlag } from '@sarvinbox/core';
import { ipcMain } from 'electron';

import { openAccountStorages, requireNamedOrActiveStorage, requireTargetAccountId } from '../services/account-target';
Expand Down Expand Up @@ -97,9 +97,9 @@ function runBackfillForNewAccounts(limit: number): void {
const n = (store as any).getRepositories().agent.requeueRecentInboxForAgent(limit);
done.push(id);
changed = true;
logger.info(`[Agent] AI Assist on — re-queued ${n} existing Inbox emails for account ${id}`);
logger.info(`[Agent] AI Assist on — re-queued ${n} existing Inbox emails for account ${accountLogLabel(id)}`);
} catch (e) {
logger.error(`[Agent] backfill re-queue failed for account ${id}:`, e);
logger.error(`[Agent] backfill re-queue failed for account ${accountLogLabel(id)}:`, e);
}
}
if (changed) saveAgentConfig({ backfillRequeuedAccounts: done });
Expand Down
Loading
Loading