

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Encrypting Data at Rest
incomplete
2: Key Management and Rotation
incomplete
3: Password KDFs
incomplete
4: Salts
incomplete
5: Argon2 Parameters
incomplete
6: Encrypted Files
incomplete
7: Secure Database Practices
incomplete
8: Personally Identifiable Information
incomplete
9: Financial Data
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Imagine a payroll service that stores employee tax documents as ordinary files. If an attacker copies its disk, backup, or storage snapshot, they get every document in plaintext.
If you're storing sensitive documents, encrypt them at rest.
The safest way to handle the storage sequence is:
In other words, the plaintext bytes never touch the disk, only memory. Downloads reverse the transform only after the existing authorization or signed-link checks succeed.
Give the encrypted file a random name, like a UUID with an .enc extension. Map that value back to the original filename in the database so the stored path doesn't reveal or trust a user-supplied name.
Archive imports need the same boundary. Validate each entry in memory and encrypt its contents before writing it; never extract a plaintext copy first.
Changing the write path protects new uploads, but not documents already on disk. Bearly Secure's startup migration sends those files through the same storage transform before accepting requests. Once that transform encrypts documents, the migration updates each stored path and removes the runtime plaintext.
Seed fixtures are course inputs rather than runtime uploads. Keep the sample PDF in data/fixtures and copy that directory into the container so migration can initialize the seeded document without making the fixture look like live plaintext storage.
The upload flow, archive imports, authorized downloads, and automatic migration are already wired together. Complete the two byte transforms in internal/uploads/documents.go, then move the sample fixture out of runtime storage.
With Bearly Secure still running, run and submit the CLI tests from the project root.