Data protection and secrets management
Three classes of data, three protection strategies, from public to AWS only ever seeing ciphertext.
Casefile, a fictional legal-tech company storing law firms' case documents.
KMSS3SSE-KMSSecrets ManagerParameter StoreLambdaAWS Encryption SDK
Read the write-upThe architecture falls out of one question: what kind of data is this, and who should be able to read it? Three classes, three different answers, built side by side so the difference is concrete rather than theoretical.
Architecture
What I built
- 1Public assets in a bucket that is internet-readable on purpose, scoped narrowly to GetObject only.
- 2Confidential case documents with SSE-KMS, a customer-managed key, TLS enforced and the encryption key enforced.
- 3Restricted settlement records encrypted client-side before upload, so AWS never holds a readable byte.
- 4Envelope encryption built by hand first, to see what SSE-KMS does silently.
- 5Secrets Manager against Parameter Store, with a rotation function written from scratch.
- 6A misconfiguration lab: six real exposure patterns reproduced and diagnosed.
The numbers
- < $5
- Whole build cost, over about two weeks
What broke and how I fixed it
- A KMS key policy is the sole authority on its key. A role with no IAM policy at all encrypted successfully because the key policy named it. A different role holding kms:* on Resource * was refused.
- A Secrets Manager resource policy behaves the opposite way: it only adds access on top of IAM. Same vocabulary, genuinely different mechanics.
- Making a public object private does not protect its old versions. With versioning on, the previous version stayed readable.
- A rotation broken on purpose at its verification step left the old password working, because promotion happens last.