Skip to content

Flag external senders, multi-select, and combine signed docs with their certificate - #137

Merged
AlaqmarG merged 6 commits into
mainfrom
feat/mail-external-warnings-and-doc-cert
Sep 15, 2026
Merged

AlaqmarG merged 6 commits into
mainfrom
feat/mail-external-warnings-and-doc-cert

Conversation

@AlaqmarG

@AlaqmarG AlaqmarG commented Sep 15, 2026

Copy link
Copy Markdown
Member

Description

  • Mail: badge/warn on messages from outside brockcsc.ca, in the web UI and (via a Stalwart DATA-stage Sieve script) in any mail client
  • Mail: a "Details" toggle on the open message for reply-to, bcc, timing and raw headers
  • Mail: checkboxes and a bulk mark read/unread, star, archive, delete bar
  • Documents: checkboxes and a bulk "Download selected" on the library list
  • Documents: a signed request's stamped PDF and its Certificate of Completion can now download as one merged PDF, on both the exec view and the external signer's page
  • Auth: login now requests an offline Keycloak refresh token so the mail session survives as long as the portal login does, instead of expiring after ~30 minutes idle; falls back safely if the client isn't configured for it

Checklist

  • npm run typecheck, npm run lint, npm run format:check and npm run build pass
  • Schema changes have a committed migration (npm run db:generate) — n/a, no schema changes
  • New env vars added to .env.example, .env.local.example, deploy/docker-compose.yml and komodo/deploy-context.mjs — n/a, no new env vars (the Sieve install script's own knobs have defaults)
  • Admin-only routes gated with requireAdmin / requireApprover
  • Tested on the branch's preview deploy, in light and dark themes
  • No secrets, internal hostnames or IPs committed

Testing Evidence

Logged into the preview deploy and confirmed live:

  • External badge + warning banner on a real external message, "Details" toggle showing reply-to/timing/raw headers
  • Multi-select on the inbox: bulk Mark read/Mark unread round-tripped correctly (POST /api/mail/messages/bulk/flags → 200)
  • Multi-select on the document library: checkbox count and "Download selected" action
  • Login succeeded with the new offline-token request, confirming it doesn't break auth

Not exercised live: the combined signed+certificate download button. This preview's document library has real signed/certificate PDF versions (synced from prod), but the signing-request records themselves are deliberately excluded from preview/uat data (no signing PII), so there was nothing to attach the button to. Verified buildCombinedPdf instead with a standalone local test (merges a 3-page + 2-page PDF, reloads the result, confirms 5 pages).

Two things worth flagging before merge:

  • deploy/mail/** changed, which triggers Deploy Mail and restarts the live Stalwart stack (destroy_before_deploy: true) even though the Sieve script itself still needs a manual install-external-banner.sh run on the VPS to take effect.
  • The offline-refresh-token change assumes the brockcsc-web Keycloak client has "Offline Access" as an assigned client scope. Login succeeding on the preview confirms it didn't break anything, but confirming it actually got an offline token (vs. quietly falling back) needs a look at server logs.

…be multi-selected

Sender rows and the open message now badge and warn on anything from
outside brockcsc.ca, a "Details" toggle surfaces reply-to/bcc/timing/raw
headers, and messages get checkboxes with a bulk mark read/unread, star,
archive and delete bar backed by two new batched JMAP routes.
…hes every mail client

The webmail badge alone never shows up in Thunderbird, Outlook or a
phone's mail app. install-external-banner.sh installs
external-sender-banner.sieve as Stalwart's system script (same
x:.../set pattern as refresh-cert.sh), stamping the warning into the
body and an X-BrockCSC-External header for anything not from
brockcsc.ca, no matter what reads it. Idempotent; run by hand like the
cert script, nothing here runs it automatically.
Checkboxes plus a select-all, with a "Download selected" action that
saves each picked document's current version in turn.
Merges the stamped document and Certificate of Completion on the fly
with pdf-lib rather than storing a third copy. Added to both the exec
document view and the external signer's completed-envelope page.
Login now asks Keycloak for an offline refresh token, governed by its
own much longer idle timeout instead of the 30-minute SSO session idle
that was expiring mail mid-session whenever the keepalive heartbeat
missed a gap (backgrounded tab, sleep). Falls back to a plain token if
the client isn't set up for offline access, so this can't break login.
Also fires the heartbeat immediately on mount/focus instead of only
every 10 minutes.
@AlaqmarG AlaqmarG added feature New capability for the people using the site security Access control, data exposure or dependency risk area: mail Mailboxes, the mail client, sending or delivery area: admin The admin portal: analytics, users, events area: identity Keycloak, roles, sign-up and permissions labels Sep 15, 2026
@AlaqmarG
AlaqmarG merged commit ad98162 into main Sep 15, 2026
12 checks passed
@AlaqmarG
AlaqmarG deleted the feat/mail-external-warnings-and-doc-cert branch September 15, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: admin The admin portal: analytics, users, events area: identity Keycloak, roles, sign-up and permissions area: mail Mailboxes, the mail client, sending or delivery feature New capability for the people using the site security Access control, data exposure or dependency risk

Development

Successfully merging this pull request may close these issues.

1 participant