Skip to content

1.5.2: CASA revalidation fixes, filters, Inbox Agent, tar 8 and attachment scanning (dev into main) - #148

Merged
rcsarv merged 22 commits into
mainfrom
dev
Dec 3, 2026
Merged

rcsarv merged 22 commits into
mainfrom
dev

Conversation

@rcsarv

@rcsarv rcsarv commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Everything for release 1.5.2 (no 1.5.1 was published; the version jumps from 1.5.0 by choice). dev into main.

What's in it

CASA revalidation fixes (#147, answers to TAC's review of 25 November):

  • OpenPGP: every failure shows one message.
  • Links: a link the app did not write asks before it opens.
  • Certificates: only the certificate the user approved is trusted.
  • Accounts: a named account is that account or an error.

Merged into dev since:

  • macOS: no "Electron" Local Network prompt (fix/macos-local-network-prompt).
  • Filters:
    • "Filter messages like this" works, and the new Skip AI checks option (feature/filter-messages-like-this);
    • create a label from a filter's "Apply label" action (feature/filter-new-label).
  • Inbox Agent:
    • sends the chat's history with every question (fix/inbox-agent-chat-history);
    • counts the emails it sorted as reviewed (fix/agent-review-coverage).
  • "Draft" markers: shown in search results and category tabs (fix/draft-marker-in-list, fix/draft-marker-category-tab).
  • Dependencies: extensions are unpacked with tar 8, which clears the 1–2 December advisories that failed this PR's dependency check.
    • electron-builder and node-gyp still need tar 7, so their CVEs are accepted in SECURITY.md.
    • A guard test keeps the app's own tar at 8.0.2 or later.
    • Overrides for cross-spawn, ws and terser.
  • Security → Attachment scanning:
    • a new tab with Test connection and Set up / sign in again;
    • every blocked scan says why, instead of "scanning failed";
    • a Sarv re-sign-in is allowed only for av.sarv.com, and only after a 401.

The local dev that collected those branches had been built on 401800f, before #147 merged. ef7662ac merges origin/dev into it; the only conflict was CHANGELOG.md.

Release notes

CHANGELOG [Unreleased] holds:

  • Added: 4 entries
  • Security: 7 entries
  • Fixed: 9 entries

./scripts/release.sh 1.5.2 --pr turns them into the 1.5.2 notes word for word.

Verification (final tree)

Run on this exact tree (525a04f9):

  • Install: clean with the frozen lockfile.
  • Type-check: 9 of 9 packages.
  • Lint: 0 errors.
  • Whole suite (TURBO_FORCE=true pnpm test): core 4,871, storage 1,976, desktop 12,458 (17 skipped), site 144.
  • Dependency check: pnpm audit --audit-level=high exits 0.

Not in this release

🤖 Generated with Claude Code

On a network whose DNS server is a local address, macOS 15+ asked
'Allow "Electron" to find devices on local networks?' after the 1.5.0
update. Two causes:

- Electron enables Chromium's built-in resolver on macOS, which sends DNS
  queries straight to that server. Chromium now resolves through the OS
  (app.configureHostResolver({ enableBuiltInResolver: false }), first
  thing after ready), which needs no Local Network permission and is
  already the default on Windows and Linux.
- electron-builder brands the helper apps' file, executable, display name
  and id but leaves CFBundleName as "Electron Helper…", and the network
  service runs in a helper. afterPack now sets each helper's CFBundleName
  to its bundle name before signing, and fails the build if none is found
  or one still says Electron.

The app's own DNSBL lookups still query the network's DNS server, so the
macOS Info.plist now carries an NSLocalNetworkUsageDescription saying why.
"Filter messages like this" on an email's menu said the feature was
coming. It now opens Settings > Filters with a new filter for that
sender (From contains the address), ready to save.

Filters gain a "Skip AI checks" option (a new skipAI action, kept in
the actions JSON, so no migration). It is ticked for every new filter
and can be unticked; existing filters are unchanged. A filter may do
only this. Mail it matches is kept from every background AI path:
the per-email pipeline (marked done, so it is not retried), the bulk
categorizer, and category propagation to linked accounts. When the
rule table cannot be read, the email is neither sent nor marked done,
so it is retried. Inbox Agent can create such a filter.

Test fakes for the categorizer gain an empty getEnabledFilterRules,
the store method the new gate reads.
The agent got the earlier turns of a chat only when the question
matched a follow-up pattern, so a reply such as "find it from the email
signature" or "yes" lost track of who the user was asking about.

buildInboxAgentChatHistory now sends this chat's last 12 turns with
every question (up to the rewound exchange, if any): questions up to
600 characters, the newest 4 answers up to 1,500, older ones 400, at
most 12,000 characters in all (older answers shortened first, then the
oldest turns dropped; the newest answer is never shortened). A turn
asked over a different set of accounts sends its question only, so an
answer that drew on accounts since deselected is never sent. Search
pinning (topic, participant and source terms) still follows the
follow-up check. The privacy policy says what is sent.

Changed test: inbox-assistant-service.test.ts "keeps %s out of the next
quotation research scope" asserted that a greeting turn left no
conversation context. The behaviour changed on purpose: the greeting
is now sent as context, so the test expects "Earlier in this chat" and
the greeting in the agent's prompt.
A conversation with an unsent reply (the AI's included) showed the red
"Draft" label in the folder list but not in search results or in
category tabs such as Needs Response, which load through
SearchRepository. That query carried only the "(N)" and the senders;
the thread-wide starred / important / draft flags were appended by
EmailRepository alone.

The flags now live in threadMetaSharedSql, so list and search rows
carry the same ones. The draft flag follows draftRowSql (the rule
that keeps drafts out of the "(N)"), so a draft in the account's own
Drafts folder (INBOX.Drafts) counts, and a Sent copy with a stale
|draft| tag or a draft in Trash still does not.
A category tab such as Needs Response loads through search when a quick
filter is on, and through AIRepository's category pager when none is,
which is how it opens. The pager selected the email columns only, so its
rows carried no conversation metadata: no "Draft" label, no thread-wide
star, and a "(N)" counted from the loaded rows. It now selects
threadMetaSharedSql like the folder list and search.

Changed test: category-count-parity.test.ts builds its own minimal
emails table. It gains the from_name / from_address columns of the real
table, which the page's first/last sender subqueries read. The fake is
completed, nothing it asserts changed.
CASA 4.1.4 (TAC review of 25 Nov): a failure's text varied with its
cause and the library's reason reached app.log, so a crafted message
could learn how far decryption got.

- Every OpenPGP failure the user sees is PGP_FAILURE_MESSAGE
  (packages/core/src/pgp/failure.ts): opening, decrypting and verifying
  mail, encrypting or signing a message or draft, and every key
  operation. Our error classes carry only a code; the library's text is
  never kept, shown or logged.
- A failure is logged as context plus the error's class and code
  (logPgpFailure, errorDiagnostic). Sentinel tests prove library text,
  addresses and paths stay out of app.log.
- Only two causes reach the renderer, as prompts, never as text:
  'locked' (offer to unlock) and 'passphrase-required'.
- Sending a signed message with a locked key is refused before it is
  queued (lockedSigningKeyFor, falling back to the account's address
  when the SMTP client has no config yet). The composer reopens with the
  unlock prompt and keeps the chosen From alias. Encryption that was
  asked for but cannot be done refuses the send instead of going out in
  plain text; Undo send keeps the alias too.
- A queued message that meets a locked key says "Unlock your key in
  Settings -> Encryption, then retry." in the Outbox.
- The unlock prompt re-checks the key it needs instead of counting
  unlocked keys, so it neither dead-ends nor loops. Every reader failure
  shows the same fixed hint about importing a missing key.

Pre-existing tests changed deliberately (behaviour changed, not loosened):
keys.test.ts and pgp-mime.test.ts (the constant, no detail or cause, no
signature error/detail); pgp-reader.test.ts (no-key, unavailable and
keychain answer code 'failed'; logs carry class and code; no-key is now
logged by code); pgp-keyring.test.ts and pgp-secret-seal.test.ts
(keychain refusals are the constant; an unknown envelope throws
SealError; a locked send key gives the unlock-then-retry text with code
'locked'); pgp-outgoing.test.ts (refusals are the constant or, for a
locked key, the unlock-then-retry text); pgp-handlers.test.ts
(validation and pass-through answer flow codes only; 18 channels);
draft-encryption.test.ts, pgp-service.test.ts (lockedSigningKeyFor moved
to pgp-failure.test.ts), pgp-view-model.test.ts (unlockLockedKeys
returns nothing; failures include the hint), PgpMessageView.test.tsx,
EncryptionTab.test.tsx, saved-draft-content.test.ts (captureLogs),
ComposeEmail-account.test.tsx (usePgpCompose's new fourth argument) and
ComposeToolbar.pgp.test.tsx (downgrade field).
CASA 5.1.2 (TAC review of 25 Nov): any http/https host from a message
opened with no allowlist or warning.

- One main-process gate (openExternalUrl, external-link-gate.ts) for
  every URL the app did not write: app:openExternal (links in the
  standard and chat views, "Open link"), the navigation guards'
  external verdict, the window-open handler (installWindowOpenGuard:
  target=_blank, window.open) and the unsubscribe page. Only http,
  https and mailto pass. A source test fails if any other main-process
  file calls shell.openExternal.
- Anything that is not one of the app's own exact pages (APP_LINK_PAGES
  in app-links.ts) shows a native warning first: the host on its own
  line in punycode, the address shortened, a note for http, Cancel as
  the default, and an unticked "Don't ask again for <host>".
- Remembered hosts: exact hostnames in a core-DB blob read with readBlob,
  capped at 500; an unreadable list asks and is never overwritten.
  Security -> Trusted & blocked links shows the count and "Forget all".
- Link forwarders and proxies (Safe Links, google.com/url, Google
  Translate, t.co, lnkd.in, urldefense, Mailchimp, SendGrid, Mandrill)
  are never remembered and offer no checkbox; where the link carries its
  destination, the warning also names it. Only the clicked link opens.
- The Translate menu item asks main to build the Translate address
  itself (app:openTranslation), so the user's own choice opens without a
  warning and the window cannot pass an arbitrary URL through it.
- Logs carry the scheme, booleans and counts only; a sentinel test
  proves no host or URL reaches app.log.

Pre-existing tests changed deliberately: app-handlers-open-external
(untrusted https now asks; the scheme refusal is logged by the gate);
navigation-guards (a failed hand-off is logged with errorDiagnostic);
app-icon (the sidebar's URL comes from app-links); unsubscribe-handlers
(mocks the gate; cancelled, refused and busy report the page as not
opened). truncateMiddle moved from ai-service.ts to core.
CASA 4.1.2 (TAC review of 25 Nov): "allow self-signed" turned
certificate checking off for the account, so any certificate was
accepted for it.

- resolveTlsOptions always verifies (rejectUnauthorized: true, TLS 1.2
  floor). A password account may instead trust exactly one approved
  leaf certificate per account, transport, host and port: the approved
  PEM is the only trust anchor (ca + allowPartialTrustChain, which
  Electron's BoringSSL needs) and checkServerIdentity accepts only its
  SHA-256. Every other certificate is refused inside the handshake,
  before LOGIN or AUTH is sent. OAuth accounts never use a pin.
- Main applies the pin before every dial (imap:connect, the add-account
  probe, background sync, smtp:connect/connectFor, the Inbox Agent
  download) and always replaces any pin the window sent.
- Approval happens only in main's native dialog (subject, issuer,
  validity, SHA-256; Cancel is the default) and only for a connect the
  user just started: the form arms a review for that account and
  transport (used once, 60 s, rate-limited). Automatic reconnects and
  background sync never ask; they refuse and the banner points to
  Settings -> Accounts. The retry after approval goes to the account
  that asked, or nowhere. Wording comes from main's own records. An
  existing pin is named when a new one would replace it. Expired
  certificates cannot be approved.
- Pins live in the vault and are written with a throwing core-DB write
  (writeBlob); the vault is read with the strict read, so an unreadable
  store is an error, never an empty vault.
- Accounts saved with "allow self-signed" are refused on their next
  automatic connect and review their server's certificate once from
  Settings. The checkbox is gone; account settings show the trusted
  certificate with Remove.
- The only socket with verification off fetches a certificate to show
  it and carries no credential; a guard test fails on any other
  rejectUnauthorized, NODE_TLS_REJECT_UNAUTHORIZED or
  checkServerIdentity in product code.

Pre-existing tests changed deliberately (the old setting is retired):
tls.test.ts and smtp-client.test.ts (allowInsecureTLS no longer turns
checks off), connection-security.test.ts (transport opt-ins cover
encryption only), imapflow-client-starttls.test.ts (a certificate error
is its own refusal); secure-credential-store, vault-credentials and
helpers tests (the setting is no longer written or bound);
imap-vault-password, smtp-vault-password, imap-connect-security,
imap-oauth-host-binding and assistant-mailbox-download (old-setting
cases become verified connections; the security event carries a code);
reset-and-reconnect (its partial core mock gained the real TLS module);
connection-security-ui, EmailSetupStep and IMAPStep (no checkbox; the
probe passes an account id).
…ther

CASA 3.1.3 / 3.1.4 (found while building the IPC object-identifier
inventory for TAC's review of 25 Nov): an account that could not be
resolved fell back to the ACTIVE mailbox, and an unknown account id
could create an empty mailbox database.

- The lenient resolveAccountTarget is gone. Every handler resolves a
  renderer-named account with resolveNamedOrActiveAccountTarget: no id
  is the active account; a named one is exactly that account's runtime
  or an error. Trusting a sender, drafts by thread, labels, server
  search, quota, attachments and thread summaries (now per account) can
  no longer land in another mailbox.
- ensureAccountRuntime opens or creates a mailbox DB only for an id the
  registry lists (isRegisteredAccountId over the throwing
  readRegistryAccounts; an unreadable registry refuses). The add flow is
  the one exception: accounts:setActive {adding: true} is accepted only
  for the account main itself just verified (a single-use proof from
  imap:probeCredentials, 10 minutes), never adopts a legacy database,
  and an abandoned add's runtime is closed.
- accounts:setActive is transactional: open first, point second, and
  any failure restores the previous pointer, saved active account and
  outbox binding, so success:false means main did not move. The window
  stays on its account when main refuses; a failed add's rollback checks
  main's answer.
- Removing the active account tries the remaining accounts in turn, else
  clears to no account. A removed account gets a tombstone in main that
  account saves honour, so a stale snapshot cannot bring it back; only a
  verified add clears it.
- Compacting the active account points main back at it after reopening
  (it was left on an empty slot), and the reopen retries a transient
  registry read error.
- Panel requests check own properties only; legacy agent decisions
  validate their status and action.

Pre-existing tests changed deliberately: account-target (the fallback
test now expects a refusal; strict results include accountId),
accounts-runtime (ids must be registered; option renamed
registryChecked), draft-calendar-metadata and email-thread-ownership
(one strict resolver), connection-remove-account (selectAccount
resolves true), smtp-vault-password and smtp-oauth-host-binding
(connectFor refuses a missing runtime), db-compact (models the active
pointer), imap-oauth-host-binding (clears add proofs). Seventeen suites
only renamed the mocked resolver, and several registry mocks gained
isRegisteredAccountId or markAccountRemoved.
fix(security): CASA revalidation fixes (OpenPGP errors, link warning, certificate pinning, strict accounts)
The coverage line under an answer counted only emails opened with
read_message or returned by deep search. A run that sorted all 389 unread
emails with classify_messages (and staged changes to 102 of them) said
"0 of 389 matching messages reviewed".

Each email a classify_messages batch returned a verdict for now counts as
reviewed in its own account, once per run: a registry set shared with
read_message and deep search keeps sorting, re-sorting and reading the same
email from counting it twice. An email in a batch the provider did not
answer for is not counted.
The "Apply label" dropdown ends with "+ Create new label…", and with no
labels yet a "Create new label" button replaces the pointer to Settings →
Labels. Either opens the shared NewLabelDialog and picks the created label
for the row that asked for it. Cancelling, or a create the store refuses,
leaves the row as it was; the dropdown's entry is never saved as a value.
The local dev that collected seven branches (macOS Local Network prompt,
"Filter messages like this" and Skip AI checks, Inbox Agent chat history,
Draft markers in search and category tabs, Inbox Agent review coverage,
creating a label from a filter) was based on 401800f, before #147
merged. The only conflict was CHANGELOG.md: [Unreleased] now holds the
Added entries from dev, the Security entries from #147, and both sets of
Fixed entries.
The dependency audit failed on dev and main after advisories published on
1-2 December 2026. None came from a code change.

- tar < 8 (18 high, plus one fixed in 7.5.24): symbolic links that escape
  the extraction folder, PAX headers that rename or resize an entry, and
  archives that exhaust memory or never finish. The desktop app unpacks
  extension archives with tar (the marketplace installer, and the build's
  seed of the default extensions), so it now requires tar 8.1.0. The call
  is unchanged: tar 8 keeps x({ file, cwd, filter }) and the entry types
  the archive allowlist reads. Vite bundles it into main.
- electron-builder and node-gyp still require tar 7, even in their latest
  releases, and call its stream API. They are build-time devDependencies,
  so a tar@7 override keeps them on 7.5.24 and their 18 CVEs go into
  pnpm.auditConfig.ignoreCves, justified in SECURITY.md. That list applies
  to every path, so a new unit test (extension-archive-tar.test.ts) fails
  if the installer, the seed script or the declared range fall below
  8.0.2. It fails on the previous tree's tar 7.5.22.
- Overrides for tooling the app does not ship: cross-spawn@7 ^7.1.2
  (critical, Windows batch-file command injection), ws@7 ^7.5.14 and ws@8
  ^8.23.1 (pong flood), terser@5 ^5.51.4 (moderate).
- SECURITY.md lists the new moderates on glob, minimatch and tar 7, which
  only build and lint tools carry.

Pre-existing test changed deliberately: extension-marketplace.test.ts
builds its fixture archives with createSync, because tar 8 removed the
sync option of create. semver is a new desktop devDependency for the
guard test's version comparison.
…cked scan

Opening an attachment could say only "Download blocked: scanning failed.
Try again when the scanner is available.", whatever went wrong, and
app.log recorded nothing but `{ name: 'Error' }`. The scanner setup could
be reached only from the extension's own sidebar panel.

- Security -> Attachment scanning, shown while a scanner extension is on:
  whether scanning is set up, the scanner's address, the approved
  accounts, where the sign-in is kept, Test connection, Set up / Sign in
  again (the existing setup dialog) and the last failed scan this session.
- New IPC, main app frame only: antivirus:listScanners and
  antivirus:testConnection. The test is read-only: the saved credential
  goes only to the saved origin, nothing is written, no mail is read and
  the credential never reaches the renderer.
- Every blocked scan has a reason code and its own message (shared table
  in src/utils/attachment-scan-failures.ts): busy, sign-in-rejected (401
  only), forbidden-by-policy (403), unreachable, untrusted-connection
  (certificate or redirect; redirects are now refused with
  redirect: 'manual' and never followed), scanner-unavailable,
  scanner-error, read-failed, too-large (typed AttachmentSizeLimitError
  from core's IMAP client and sync engine), policy-changed,
  outdated-definitions, incomplete-scan, timed-out, setup-changed,
  not-set-up, setup-unreadable (also on the pre-scan setup check). One
  log line per failed scan with the code and failureCause/errorDiagnostic,
  never a file name, message id or error text. A user cancel is not a
  failure; a scan the scanner cancelled is.
- When the Sarv scanner refuses its saved credential (401) this session,
  setup offers "Sign in with Sarv again". Main allows that replacement
  only for https://av.sarv.com; a working setup, or any other scanner's,
  is never replaced.

Pre-existing tests changed deliberately (the generic message no longer
exists, and a locked or damaged saved setup now reads as
setup-unreadable): antivirus-scan-service (digest/coverage, policy
change, shared limits, locked saved sign-in, unreadable configuration,
unapproved-account proof, scan_failed verdict), attachment-handlers,
useAttachmentActions, AttachmentTransferProvider (example failure is now
"unreachable"), antivirus-transport (redirect: 'manual'), and
antivirus-handlers (mocks gained the new service methods).
@rcsarv rcsarv changed the title 1.5.1: CASA revalidation fixes (dev into main) 1.5.2: CASA revalidation fixes, filters, Inbox Agent, tar 8 and attachment scanning (dev into main) Dec 3, 2026
@rcsarv
rcsarv merged commit 56f29ff into main Dec 3, 2026
22 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