Updated the documentation set to reflect the current architecture and status:
This commit is contained in:
+7
-5
@@ -9,14 +9,15 @@ This project has a layered architecture: a desktop Electron shell, a browser-ren
|
|||||||
- `desktop/main.cjs` is the privileged process.
|
- `desktop/main.cjs` is the privileged process.
|
||||||
- It owns account storage, mail sync, IMAP/SMTP connectivity, DAV sync, and OpenPGP key handling.
|
- It owns account storage, mail sync, IMAP/SMTP connectivity, DAV sync, and OpenPGP key handling.
|
||||||
- It can show native dialogs, notifications, and system prompts. On Windows, its notification-area tray icon uses the packaged multi-resolution application icon and provides Open and Quit actions. Packaged startup repairs an existing per-user Start Menu shortcut to target the launched app and use its icon, keeping taskbar pins associated with the matching AppUserModelID.
|
- It can show native dialogs, notifications, and system prompts. On Windows, its notification-area tray icon uses the packaged multi-resolution application icon and provides Open and Quit actions. Packaged startup repairs an existing per-user Start Menu shortcut to target the launched app and use its icon, keeping taskbar pins associated with the matching AppUserModelID.
|
||||||
- `desktop/preload.cjs` exposes a minimal API to the renderer through `window.daybreakMail` and `window.pgpPrepareSend`.
|
- `desktop/preload.cjs` exposes the narrow platform API through `window.daybreakMail`. Renderer-to-renderer contracts are grouped under `window.epMailState`, `window.epMailShell`, and `window.epMailFeatures`.
|
||||||
|
|
||||||
### Renderer UI
|
### Renderer UI
|
||||||
|
|
||||||
The browser UI is rendered from the web assets in the root and `www/` folders:
|
The browser UI is rendered from canonical web assets in the repository root; `www/` is generated for Capacitor:
|
||||||
|
|
||||||
- `index.html` and the shared shell files define the layout and global state.
|
- `index.html` defines the classic-script bootstrap order. `renderer-state.js` exposes shared state as `window.epMailState` without legacy unnamespaced aliases.
|
||||||
- `app.js`, `mail-ui.js`, `account-ui.js`, `dav-ui.js`, `pgp-ui.js`, and `pgp-mail-ui.js` handle page flow, compose/read views, account setup, and encryption UX.
|
- `app.js` publishes `window.epMailShell`; the mail, productivity, DAV, and PGP mail modules publish explicit APIs under `window.epMailFeatures`. PGP key management extends the productivity Preferences UI through that API.
|
||||||
|
- Renderer feature implementations are locally scoped. The ordered classic-script bootstrap remains a compatibility constraint for desktop and Capacitor, and is covered by bootstrap and combined-script tests.
|
||||||
- The renderer is intentionally thin: it requests actions and displays data, while mail-protocol and cryptographic network work stays in the main process. The reader makes direct HTTPS image requests only after explicit per-message approval.
|
- The renderer is intentionally thin: it requests actions and displays data, while mail-protocol and cryptographic network work stays in the main process. The reader makes direct HTTPS image requests only after explicit per-message approval.
|
||||||
|
|
||||||
### Android client
|
### Android client
|
||||||
@@ -70,6 +71,7 @@ The current architecture takes a strict trust split:
|
|||||||
This boundary is important for encryption and safety checks:
|
This boundary is important for encryption and safety checks:
|
||||||
|
|
||||||
- OpenPGP key selection and trust updates are confirmed in the main process.
|
- OpenPGP key selection and trust updates are confirmed in the main process.
|
||||||
|
- Replacement-key operations are also confirmed in the main process; tests assert cancellation does not update the contact key.
|
||||||
- Key-server lookup results never elevate trust; only the public key is sent during a separately confirmed publication.
|
- Key-server lookup results never elevate trust; only the public key is sent during a separately confirmed publication.
|
||||||
- Send-time downgrade checks happen in the main process rather than only in UI logic.
|
- Send-time downgrade checks happen in the main process rather than only in UI logic.
|
||||||
- External links open only after a native confirmation dialog.
|
- External links open only after a native confirmation dialog.
|
||||||
@@ -83,7 +85,7 @@ The OpenPGP implementation is split into focused modules:
|
|||||||
- `desktop/pgp-keystore.cjs` stores contacts, trust, key material, and settings.
|
- `desktop/pgp-keystore.cjs` stores contacts, trust, key material, and settings.
|
||||||
- `desktop/pgp-mail.cjs` handles message detection, decryption, verification, encryption, and signature checks.
|
- `desktop/pgp-mail.cjs` handles message detection, decryption, verification, encryption, and signature checks.
|
||||||
- `desktop/pgp-keyservers.cjs` implements bounded HTTPS lookup and publication for VKS and HKP-compatible servers.
|
- `desktop/pgp-keyservers.cjs` implements bounded HTTPS lookup and publication for VKS and HKP-compatible servers.
|
||||||
- `desktop/main.cjs` bridges those services into the Electron IPC API.
|
- `desktop/ipc/pgp.cjs` bridges those services into the Electron IPC API; `desktop/main.cjs` wires the services and registrars together.
|
||||||
|
|
||||||
This keeps the cryptographic logic separate from the UI and gives the app a single place to enforce trust rules, passphrase checks, and recipient validation.
|
This keeps the cryptographic logic separate from the UI and gives the app a single place to enforce trust rules, passphrase checks, and recipient validation.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Encryption plan: OpenPGP mail encryption for ep-mail
|
# Encryption plan: OpenPGP mail encryption for ep-mail
|
||||||
|
|
||||||
Status: **Phases 1–3 and the desktop parts of 4–6 are implemented.** Android support and an independent security review are still open; see [TODO.md](./TODO.md).
|
Status: **Phases 1–3 and the desktop parts of 4–6 are implemented.** Android OpenPGP support and an independent human security review are still open. Automated review findings and their fixes are documented in [SECURITY_REVIEW.md](./SECURITY_REVIEW.md); see [TODO.md](./TODO.md) for follow-up work.
|
||||||
|
|
||||||
## 1. Format: OpenPGP with PGP/MIME (RFC 3156)
|
## 1. Format: OpenPGP with PGP/MIME (RFC 3156)
|
||||||
|
|
||||||
|
|||||||
+18
-9
@@ -31,7 +31,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
|
|
||||||
## Steps and acceptance criteria
|
## Steps and acceptance criteria
|
||||||
|
|
||||||
### 1. Baseline and guardrails — in progress
|
### 1. Baseline and guardrails — complete
|
||||||
|
|
||||||
- [x] Record the current test baseline.
|
- [x] Record the current test baseline.
|
||||||
- [x] Confirm the current root/`www/` web assets match.
|
- [x] Confirm the current root/`www/` web assets match.
|
||||||
@@ -98,7 +98,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
|
|
||||||
**Result:** OpenPGP, mail/account, and DAV handler groups now register through the same sender and payload validation wrapper. Registration/schema tests cover all feature modules.
|
**Result:** OpenPGP, mail/account, and DAV handler groups now register through the same sender and payload validation wrapper. Registration/schema tests cover all feature modules.
|
||||||
|
|
||||||
### 6. Modularize renderer incrementally — in progress
|
### 6. Modularize renderer incrementally — complete
|
||||||
|
|
||||||
- [x] Introduce a namespaced shared renderer-state module with transitional classic-script accessors (`renderer-state.js`).
|
- [x] Introduce a namespaced shared renderer-state module with transitional classic-script accessors (`renderer-state.js`).
|
||||||
- [x] Extract mail HTML sanitization and remote-image approval checks into a dedicated renderer API (`mail-content-security.js`).
|
- [x] Extract mail HTML sanitization and remote-image approval checks into a dedicated renderer API (`mail-content-security.js`).
|
||||||
@@ -127,17 +127,24 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
- [x] Register content security helpers under the shared feature namespace instead of a standalone global (`mail-content-security.js`, `app.js`).
|
- [x] Register content security helpers under the shared feature namespace instead of a standalone global (`mail-content-security.js`, `app.js`).
|
||||||
- [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations.
|
- [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations.
|
||||||
- [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts.
|
- [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts.
|
||||||
- [ ] Migrate remaining mail-related consumers and remove transitional global dependencies.
|
- [x] Migrate remaining mail-related consumers and remove legacy/transitional global dependencies.
|
||||||
- Replace hidden globals and script-order dependencies with imports or passed dependencies.
|
- [x] Make cross-feature dependencies explicit through namespaced APIs and test the required classic-script load order.
|
||||||
- Keep root web assets canonical and generated copies out of hand-edited workflows.
|
- [x] Keep root web assets canonical and verify generated `www/` parity.
|
||||||
- Preserve CSP, HTML sanitization, and per-message remote-image approval behavior.
|
- [x] Preserve CSP, HTML sanitization, and per-message remote-image approval behavior with regression coverage.
|
||||||
|
|
||||||
**Acceptance:** both desktop and Android builds include the intended modules and existing user-visible flows still work.
|
**Acceptance:** both desktop and Android builds include the intended modules and existing user-visible flows still work.
|
||||||
|
|
||||||
### 7. Security regression coverage and review
|
**Result:** renderer features are locally scoped behind `epMailState`, `epMailShell`, and `epMailFeatures` APIs. The classic-script bootstrap remains intentionally ordered for desktop/Capacitor compatibility, with that order covered by tests. The user has confirmed successive built artifacts work.
|
||||||
|
|
||||||
- Add coverage for HTML sanitization, remote images, DAV URL/object handling, send downgrade decisions, and OpenPGP trust/replacement paths.
|
**Deferred follow-up:** migrate the renderer from classic scripts to native ES modules; this is not required to complete the incremental modularization step above.
|
||||||
- Review pending items from `SECURITY_REVIEW.md`, including key-store/IPC/signature UI review, dependency audit, and Android encryption limitations.
|
|
||||||
|
### 7. Security regression coverage and review — in progress
|
||||||
|
|
||||||
|
- [x] Cover HTML sanitization and remote-image validation/approval gating.
|
||||||
|
- [x] Cover DAV URL/object validation and current ETag binding.
|
||||||
|
- [ ] Add direct IPC-handler coverage for main-process plaintext-send downgrade confirmation (the confirmation behavior exists; its critical accept/cancel branch is not directly tested yet).
|
||||||
|
- [x] Cover native OpenPGP trust elevation and replacement-key confirmation, including cancellation behavior.
|
||||||
|
- [ ] Complete the human review and remaining items in `SECURITY_REVIEW.md` (dependency audit/version pinning and Android encryption limitations included).
|
||||||
|
|
||||||
**Acceptance:** security-sensitive behaviors have regression tests, and unresolved risks are documented rather than silently treated as fixed.
|
**Acceptance:** security-sensitive behaviors have regression tests, and unresolved risks are documented rather than silently treated as fixed.
|
||||||
|
|
||||||
@@ -194,5 +201,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
- Step 6 at version `0.4.36` consolidates the HTML sanitization and remote-image policy API under `window.epMailFeatures.contentSecurity`.
|
- Step 6 at version `0.4.36` consolidates the HTML sanitization and remote-image policy API under `window.epMailFeatures.contentSecurity`.
|
||||||
- Step 7 at version `0.4.37` adds focused sanitizer coverage for dangerous DOM nodes/attributes and verifies that remote images remain data-only pending explicit loading.
|
- Step 7 at version `0.4.37` adds focused sanitizer coverage for dangerous DOM nodes/attributes and verifies that remote images remain data-only pending explicit loading.
|
||||||
- Step 7 at version `0.4.38` tests main-process native confirmation for OpenPGP key replacement and trust elevation; cancellation must not mutate stored key state.
|
- Step 7 at version `0.4.38` tests main-process native confirmation for OpenPGP key replacement and trust elevation; cancellation must not mutate stored key state.
|
||||||
|
- Step 7 coverage status: sanitizer/remote-image, DAV reference/ETag, and OpenPGP trust/replacement paths have regression coverage. A direct plaintext-send IPC confirmation test and the documented human/security review remain open.
|
||||||
|
- Renderer modularization step 6 is complete: feature modules are scoped, legacy renderer-state aliases are removed, public cross-feature interfaces are namespaced, and root/`www/` parity plus classic-script ordering are tested. Native ES module conversion remains a deferred follow-up.
|
||||||
- The current IPC/DAV validation changes pass the full suite: 108 tests.
|
- The current IPC/DAV validation changes pass the full suite: 108 tests.
|
||||||
- While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved.
|
- While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved.
|
||||||
|
|||||||
+15
-6
@@ -4,12 +4,14 @@ Date: 2026-10-08
|
|||||||
Version reviewed: 0.3.2 (working tree, uncommitted changes included)
|
Version reviewed: 0.3.2 (working tree, uncommitted changes included)
|
||||||
Type: automated review by an AI security-review agent. It is not a substitute for a human review.
|
Type: automated review by an AI security-review agent. It is not a substitute for a human review.
|
||||||
|
|
||||||
|
> **Current status (2026-10-16, ep-mail 0.4.38):** The entries below are a historical review record. The replacement-key and trust-elevation confirmations are implemented in the main process and now have IPC regression tests for cancel/confirm behavior. The send-time plaintext downgrade check is enforced in the main process. The user confirms the current built artifact works. A direct IPC test for the plaintext-send confirmation branch and an independent human review remain open; Android OpenPGP support is not implemented.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
- `desktop/pgp-keystore.cjs`: key store, `safeStorage` wrapping, contacts, trust
|
- `desktop/pgp-keystore.cjs`: key store, `safeStorage` wrapping, contacts, trust
|
||||||
- `desktop/pgp-mail.cjs`: detect, decrypt, verify, build PGP/MIME, passphrase cache
|
- `desktop/pgp-mail.cjs`: detect, decrypt, verify, build PGP/MIME, passphrase cache
|
||||||
- `pgp:*` IPC handlers in `desktop/main.cjs` and `desktop/preload.cjs`
|
- `pgp:*` IPC handlers, now registered in `desktop/ipc/pgp.cjs`, plus the plaintext-send check in `desktop/ipc/mail.cjs`; the original review predates this IPC extraction.
|
||||||
- Renderer: `pgp-mail-ui.js`, `pgp-ui.js`, the `pgpPrepareSend` hook in `mail-ui.js`
|
- Renderer: `pgp-mail-ui.js`, `pgp-ui.js`, and the `window.epMailFeatures.pgp.prepareSend` feature hook used by `mail-ui.js`.
|
||||||
- Design reference: [ENCRYPTION_PLAN.md](./ENCRYPTION_PLAN.md)
|
- Design reference: [ENCRYPTION_PLAN.md](./ENCRYPTION_PLAN.md)
|
||||||
|
|
||||||
Focus areas: secret leaks (disk, logs, outbox, renderer), IPC abuse by a compromised renderer, HTML injection from key user IDs and decrypted content, signature status spoofing, key matching by fingerprint, silent downgrade to plaintext, malformed or oversized input, passphrase cache lifetime.
|
Focus areas: secret leaks (disk, logs, outbox, renderer), IPC abuse by a compromised renderer, HTML injection from key user IDs and decrypted content, signature status spoofing, key matching by fingerprint, silent downgrade to plaintext, malformed or oversized input, passphrase cache lifetime.
|
||||||
@@ -25,19 +27,19 @@ No critical or high severity issues were reported.
|
|||||||
|
|
||||||
## Fixes applied
|
## Fixes applied
|
||||||
|
|
||||||
1. **Send-time check:** `pgpPrepareSend` now checks recipient keys when you press Send. If keys exist for all recipients and you did not change the Encrypt box yourself, it asks before sending unencrypted. Unticking Encrypt on purpose still sends without a prompt.
|
1. **Send-time check:** the renderer checks recipient keys when you press Send. If keys exist for all recipients and you did not change the Encrypt box yourself, it asks before sending unencrypted. Unticking Encrypt on purpose still sends without a prompt. This renderer hook is now exposed as `window.epMailFeatures.pgp.prepareSend`.
|
||||||
2. **Trusted confirmation:** the `pgp:set-trust` handler in the main process shows a native dialog with the contact and fingerprint before raising trust. A cancelled dialog aborts the change. The renderer's own prompt may appear as well, so users can see two confirmations.
|
2. **Trusted confirmation:** the `pgp:set-trust` handler in the main process shows a native dialog with the contact and fingerprint before raising trust. A cancelled dialog aborts the change. The renderer's own prompt may appear as well, so users can see two confirmations.
|
||||||
|
|
||||||
## Verification
|
## Verification at the original review time
|
||||||
|
|
||||||
- `npm test`: 20 passed, 0 failed (includes the GnuPG interoperability tests).
|
- `npm test`: 20 passed, 0 failed (includes the GnuPG interoperability tests).
|
||||||
- `node --check` on the edited files.
|
- `node --check` on the edited files.
|
||||||
- The fixes were not exercised in the running app.
|
- The fixes were not exercised in the running app.
|
||||||
|
|
||||||
## Remaining work
|
## Remaining work recorded after the first review (2026-10-08)
|
||||||
|
|
||||||
- Human review of the key store, the IPC boundary and the signature UI.
|
- Human review of the key store, the IPC boundary and the signature UI.
|
||||||
- Replacement-key confirmation in the main process when a new key arrives for an address that already has a contact. The review suggested it, and only the trust confirmation was added.
|
- Replacement-key confirmation in the main process when a new key arrives for an address that already has a contact. This was still open at the time; see the later review pass below.
|
||||||
- Run `npm audit` and pin the OpenPGP.js version.
|
- Run `npm audit` and pin the OpenPGP.js version.
|
||||||
- Re-run the GnuPG interoperability tests after dependency updates.
|
- Re-run the GnuPG interoperability tests after dependency updates.
|
||||||
- Android has no encryption support yet, so it was not reviewed.
|
- Android has no encryption support yet, so it was not reviewed.
|
||||||
@@ -56,3 +58,10 @@ Applied fixes:
|
|||||||
- #3: native confirmation showing both fingerprints when a key overlaps existing contacts, and the add-contact flow aborts if the replacement is not confirmed.
|
- #3: native confirmation showing both fingerprints when a key overlaps existing contacts, and the add-contact flow aborts if the replacement is not confirmed.
|
||||||
- #4: the main process checks recipient keys before allowing a plaintext send and shows a trusted confirmation dialog.
|
- #4: the main process checks recipient keys before allowing a plaintext send and shows a trusted confirmation dialog.
|
||||||
- #5: Linux now rejects the insecure `basic_text` safeStorage backend and asks the user to switch to a secure system keyring before storing mail or PGP secrets.
|
- #5: Linux now rejects the insecure `basic_text` safeStorage backend and asks the user to switch to a secure system keyring before storing mail or PGP secrets.
|
||||||
|
|
||||||
|
## Current follow-up
|
||||||
|
|
||||||
|
- Replacement-key and trust-elevation confirmation are enforced in `desktop/ipc/pgp.cjs`. `tests/pgp-ipc-registration.test.cjs` verifies both cancellation and confirmation paths for those changes.
|
||||||
|
- Main-process plaintext-send confirmation is implemented in `desktop/ipc/mail.cjs`; direct regression coverage for that dialog's accept/cancel branches remains open.
|
||||||
|
- Human cryptography/security review, dependency audit and OpenPGP.js version pinning remain outstanding. GnuPG interoperability tests are in the current test suite and should be rerun after dependency changes.
|
||||||
|
- Android has no OpenPGP implementation and is outside the reviewed desktop scope.
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
## Mail security
|
## Mail security
|
||||||
|
|
||||||
- [ ] Add support for encrypting and decrypting mail with OpenPGP (PGP/MIME). See [ENCRYPTION_PLAN.md](./ENCRYPTION_PLAN.md).
|
- [x] Add desktop support for encrypting and decrypting mail with OpenPGP (PGP/MIME). Android support remains open; see [ENCRYPTION_PLAN.md](./ENCRYPTION_PLAN.md).
|
||||||
- [x] Phase 1: foundation — OpenPGP.js, passphrase-protected key store (desktop), generate/import/export/delete keys, revocation certificate, tests, Settings UI.
|
- [x] Phase 1: foundation — OpenPGP.js, passphrase-protected key store (desktop), generate/import/export/delete keys, revocation certificate, tests, Settings UI.
|
||||||
- [x] Phase 2: receive — detect PGP/MIME and inline PGP mail, decrypt on open, verify signatures, show encryption/signature status, handle missing keys and wrong passphrases.
|
- [x] Phase 2: receive — detect PGP/MIME and inline PGP mail, decrypt on open, verify signatures, show encryption/signature status, handle missing keys and wrong passphrases.
|
||||||
- [x] Phase 3: send — public-key keyring and key import from contacts/messages, encrypt and sign when composing, encrypted copy in Sent, warn instead of silently downgrading.
|
- [x] Phase 3: send — public-key keyring and key import from contacts/messages, encrypt and sign when composing, encrypted copy in Sent, warn instead of silently downgrading.
|
||||||
@@ -36,7 +36,8 @@
|
|||||||
- [x] Phase 5 (GnuPG): automated interoperability tests with GnuPG 2.5 (both directions: PGP/MIME, inline, clear-signed, detached signatures).
|
- [x] Phase 5 (GnuPG): automated interoperability tests with GnuPG 2.5 (both directions: PGP/MIME, inline, clear-signed, detached signatures).
|
||||||
- [x] Phase 6: documentation and release.
|
- [x] Phase 6: documentation and release.
|
||||||
- [x] Manual interoperability check with Thunderbird.
|
- [x] Manual interoperability check with Thunderbird.
|
||||||
- [x] Independent security review of the encryption code before relying on it.
|
- [x] Address findings from the automated OpenPGP security reviews (see [SECURITY_REVIEW.md](./SECURITY_REVIEW.md)).
|
||||||
|
- [ ] Complete an independent human security review of the encryption code before relying on it.
|
||||||
|
|
||||||
## Appearance and settings
|
## Appearance and settings
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user