How to Configure MongoDB Atlas Encryption at REST

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up mongodb atlas encryption at rest by linking your cloud key service to your cluster. The storage engine then encrypts all data files, indexes, and backups on disk. Teams often stop at disk encryption and grant broad database roles to staff. When a user logs in with wide permissions, the database decrypts the data for them. Disk encryption alone cannot stop an authorized user from reading sensitive records. How mongodb atlas encryption at rest works with roles Storage encryption prot

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up mongodb atlas encryption at rest by linking your cloud key service to your cluster. The storage engine then encrypts all data files, indexes, and backups on disk. Teams often stop at disk encryption and grant broad database roles to staff. When a user logs in with wide permissions, the database decrypts the data for them. Disk encryption alone cannot stop an authorized user from reading sensitive records.

How mongodb atlas encryption at rest works with roles

Storage encryption protects your physical disks and cloud volumes from theft or leaks. The database engine encrypts every record before writing it to the storage volume. When an authorized user runs a query, the engine reads the encrypted blocks. It decrypts those blocks in memory and returns the plain text to the user.

Because the engine decrypts data on read, role management becomes your next defense. MongoDB grants permissions through role-based rules that apply to a specific database. A role gives a user the right to run actions on defined resources. These roles can grant permissions down to a single collection.

MongoDB Atlas database users have different built-in roles than self-hosted database users. Both sets of roles use the same core privilege actions. You must pair disk encryption with tight user roles to keep data safe.

Why storage encryption and built-in roles leave a runtime gap

Storage encryption only protects data while it sits on the disk. Once a developer or app logs in, the database relies on roles. The built-in read role lets a user read all non-system collections in a database. It allows actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream. It blocks write actions like insert, update, remove, and dropCollection.

The readWrite role includes everything in the read role plus data change rights. It allows insert, update, remove, createCollection, createIndex, dropIndex, and dropCollection actions. These roles decide who can log in and which collections they can touch. Still, collection-level roles cannot filter individual fields inside a document.

Encryption at Rest + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If a support engineer has the read role on a customer collection, they get full documents. The database decrypts the disk blocks and sends every field back to the client. That query result might hold emails, phone numbers, card numbers, or national IDs. Disk encryption and collection roles do not inspect or mask individual queries in flight.

Controlling live queries beyond disk and role settings

To close this gap, teams need controls that work on live database sessions. You should separate disk security from how engineers run day-to-day queries. Start by giving users the smallest role needed for their job. Avoid giving out readWrite permissions when a user only needs to check data.

Next, look at what happens after the database decrypts data for a valid user. You need a way to check each command before it runs on the cluster. You also need a way to rewrite matched fields in query results. Masking emails, phone numbers, and card numbers in flight keeps raw data safe during debugging.

Check MongoDB commands and documents on the wire

MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB, inline in the MongoDB wire protocol. On every command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13, or hold risky commands for approval. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents in memory, and every verdict is logged. See the open-source code on GitHub.

Frequently asked questions

Does mongodb atlas encryption at rest hide data from database users?

No, storage encryption only protects data on physical disks and backups. When an authenticated user runs a query, the database decrypts the data by default. Anyone with a valid read role receives plain text results.

How granular are built-in MongoDB roles for limiting data exposure?

MongoDB roles apply to a database and can limit actions down to the collection level. They cannot restrict or mask specific fields inside a collection's documents. A user with the read role on a collection can read every field in it.

What is the difference between the read and readWrite roles?

The read role lets users run find, listCollections, listIndexes, and stats commands on non-system collections. The readWrite role adds actions that change data, such as insert, update, remove, and dropCollection. Neither role rewrites sensitive fields like card numbers or national IDs in query results.

The query runs. The emails stay hidden.