StoicBuilder

HandbookXIV the VallumEncryption at rest and in transit

XIVthe Vallum, Defend it

Encryption at rest and in transit

1 min readUpdated 28 November

In plain words

Encryption in transit, using TLS, protects data moving between machines, and encryption at rest protects data stored on disks and in backups; each guards against different threats, and neither stops someone with a valid login.

Where you see it

A large customer's security questionnaire asks Harbor both: is traffic encrypted between services, and are databases and backups encrypted at rest? The database volumes and S3 buckets turn out to be encrypted, but the workers connect to Postgres without TLS.

.envconfig
DATABASE_URL=postgres://app@db.internal:5432/harbor?sslmode=verify-full&sslrootcert=/etc/ssl/db-ca.pem
sslmode=require encrypts the connection. verify-full also checks the certificate belongs to the server you meant to reach.

What goes wrong

  1. Expecting disk encryption to stop attackers in your app

    Encryption at rest protects against a stolen disk or backup file. It does nothing against SQL injection or a stolen app password, because the database decrypts for anyone who connects legitimately.

  2. TLS only at the edge

    HTTPS ends at the load balancer, and traffic inside the network travels in plain text. Encrypt service-to-service and database connections too, especially across networks you don't fully control.

  3. Keys stored next to the data

    An encryption key in the same database, bucket or repo as the data it protects adds little. Keep keys in a key management service, such as AWS KMS, with access limited and logged.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Check every connection this app makes, from browser to load balancer to services, database, Redis and queues, and tell me which use TLS with certificate verification. Then list where data is stored, including the database, backups, file storage and logs, whether each is encrypted at rest and who holds the keys. Fix the gaps, starting with database connections.

Quick check

Sign in to earn +10 XP for it

Harbor's database disk is encrypted at rest. An attacker gets the app's database password from a leaked .env file. What does the disk encryption protect?

Got a prompt that touches encryption at rest and in transit?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.