Fix PGP security review items and add architecture docs

- Harden key replacement in the Electron main process with a confirmation dialog showing the old and new fingerprints before accepting a replacement.
- Enforce plaintext-send checks in the main process before allowing a message to be sent without encryption when recipient keys exist.
- Reject the insecure Linux safeStorage basic_text backend before writing mail credentials or OpenPGP keys.
- Update the security review findings to reflect the fixes and mark the related TODO item as complete.
- Add a project architecture overview and link it from the main README.
This commit is contained in:
2026-10-10 19:34:25 +03:00
parent 20d58feb9c
commit a9c52e7868
5 changed files with 183 additions and 10 deletions
+7 -7
View File
@@ -48,11 +48,11 @@ Fresh review of the same scope after the first round of fixes. Tests: 20 passed,
| # | Severity | File | Issue | Confidence | Status |
|---|----------|------|-------|------------|--------|
| 3 | 🟡 MEDIUM | `desktop/pgp-keystore.cjs`, `desktop/main.cjs` | `pgp:add-contact` adds a key for an address that already has one without a main-process confirmation. At equal trust the newest key wins recipient selection, so an added key can take over outgoing encryption. The trust dialog does not cover replacement. | 9/10 | Open |
| 4 | 🟡 MEDIUM | `desktop/main.cjs`, `desktop/preload.cjs` | The send-time downgrade check exists only in the renderer. `mail:send` sends plaintext when `pgp` is omitted, so a compromised renderer can bypass the warning. | 9/10 | Open |
| 5 | 🟡 MEDIUM | `desktop/main.cjs` | `safeStorage` is used without checking the backend. On Linux the `basic_text` backend uses a hardcoded password, so a copied store would expose account credentials and mail data. PGP private keys stay protected by their own passphrases. | 8/10 | Open |
| 3 | 🟡 MEDIUM | `desktop/pgp-keystore.cjs`, `desktop/main.cjs` | `pgp:add-contact` adds a key for an address that already has one without a main-process confirmation. At equal trust the newest key wins recipient selection, so an added key can take over outgoing encryption. The trust dialog does not cover replacement. | 9/10 | Fixed |
| 4 | 🟡 MEDIUM | `desktop/main.cjs`, `desktop/preload.cjs` | The send-time downgrade check exists only in the renderer. `mail:send` sends plaintext when `pgp` is omitted, so a compromised renderer can bypass the warning. | 9/10 | Fixed |
| 5 | 🟡 MEDIUM | `desktop/main.cjs` | `safeStorage` is used without checking the backend. On Linux the `basic_text` backend uses a hardcoded password, so a copied store would expose account credentials and mail data. PGP private keys stay protected by their own passphrases. | 8/10 | Fixed |
Suggested fixes:
- #3: native confirmation showing both fingerprints when a key overlaps existing contacts, and do not select the new key until confirmed.
- #4: make the main process decide on plaintext sends when recipient keys exist, with a trusted confirmation.
- #5: on Linux, reject or warn on `basic_text`, or add independent encryption.
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.
- #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.