mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
The last item of docs/Compliance/README.md's P3 list, on the maintainer's decision: while ATTACHMENTS_PASSPHRASE is set (at least 16 characters), a site administrator gets Admin Panel / Attachments / Encrypt, which encrypts or decrypts every attachment on this server's disk in the background with progress, and turns on encryption of new attachments. - AES-256-CTR (server/lib/attachmentEncryption.js), so a download can start anywhere: the counter for any byte is the IV plus its block. The key is stretched from the passphrase with scrypt once per salt and kept in memory. Each file starts with WKATT1, the salt and its own IV; a file without the header is plain and read as before. - Every read goes through FileStoreStrategyFilesystem.getReadStream, which decrypts - byte ranges included - so every address, preview, export and storage move is unchanged; the board export and the WebDAV move, which read the file directly, use the same decrypting read. - New uploads are encrypted after their validation and indexing, which need the plain file; imports, e-mail to card and the REST API by an hourly sweep. Each changed attachment's meta.updatedAt is set, so the filesystem integrity scan sees the change explained. The runs and the switch are in the Audit log. - On every platform, the snap and the Helm chart (from a Secret). Tested against a live server (tests/playwright/specs/attachment-encryption.e2e.js): an attachment encrypted on disk downloads at the same address, whole and as a byte range, and decrypts back to the same bytes. Seven new strings, translated in every language. Low confidence: ace, ak, ay, bi, bm, bo, bua, chr, csb, dz, ee, ff, fj, gn, gv, haw, iu, kl, kok, ks, kw, lg, lld, nah, nap, nd, nso, fur, mg, tlh, tig, ti, wal, om, ve-PP, ve-CC, rup, zgh, uz-AR, sah, vo, wuu-Hans, se, qu, to, sm, ss, ts, ve, ny, rn, tn, st, wa, sc, scn. Thanks to xet7 !
3.2 KiB
3.2 KiB
Admin Panel / Attachments / Encrypt
What it is
The attachments stored on this server's disk, encrypted by WeKan itself, at
/admin/attachments/encrypt. The pane is in the menu only while the server
has ATTACHMENTS_PASSPHRASE set (at least 16 characters), and only for site
administrators. Encrypted attachments keep their addresses: they are decrypted
as they are read, a download that starts in the middle (a video, a large PDF)
included, so links in cards, exports and previews work as before.
Read more
- Running WeKan under GDPR, HIPAA, NIS2, ISO 27001 and SOC 2 - encryption at rest, and when disk encryption is enough.
- Security settings -
ATTACHMENTS_PASSPHRASEandBACKUP_PASSPHRASE. - Block cipher mode of operation: counter (CTR) on Wikipedia.
How to use it
- Set
ATTACHMENTS_PASSPHRASEon the server (Snap:sudo snap set wekan attachments-passphrase='...') and restart. Keep the passphrase somewhere other than this server: without it, encrypted attachments cannot be read. - Open Admin Panel → Attachments → Encrypt.
- Tick Encrypt new attachments: each new upload is encrypted once it has been checked (file type, virus scanner), and attachments that arrive another way - imports, e-mail to card, the REST API - are encrypted by an hourly sweep.
- Click Encrypt all attachments to encrypt the ones already there. The pane shows how many are done; it can be left while it runs.
- To go back, click Decrypt all attachments, then untick Encrypt new attachments, and only then remove the passphrase.
How the numbers are calculated
- Encrypted / Not encrypted / File missing: each attachment's original file on the disk, by whether it starts with WeKan's encryption header.
- Only files on this server's disk are encrypted. Attachments in GridFS or cloud storage are not touched; cloud storage has its own server-side encryption.
- Backups: a backup holds the attachments decrypted, and is encrypted itself
when
BACKUP_PASSPHRASEis set. A restored attachment is plain until the next sweep or Encrypt all.
How it works in WeKan
- server/lib/attachmentEncryption.js -
AES-256-CTR, the key stretched from the passphrase with scrypt; the header
WKATT1, the salt and the IV are at the start of each file; a plain file is read as before. - models/lib/fileStoreStrategy.js
FileStoreStrategyFilesystem.getReadStreamdecrypts every read, byte ranges included. - server/lib/attachmentEncryptionRun.js -
the pane's methods, the background runs, new uploads and the hourly sweep;
each changed attachment's
meta.updatedAtis set, so the filesystem integrity scan sees the change explained. The runs and the switch are in the Audit log. - Tested by tests/attachmentEncryption.test.cjs and tests/playwright/specs/attachment-encryption.e2e.js.