November 10, 2026

Access control for test inboxes: two-factor authentication, IP restrictions, and audit logs

SecurityAudit log2FATeam

Test emails are closer to real than they look

Test inboxes receive one-time passwords, password reset links, and invitation emails. If your staging environment uses a copy of production data, they may also contain real people's names and addresses.

Links and codes work for real sign-ins until they expire. Leaving a test inbox open to everyone is likely to be flagged in internal security reviews.

This post walks through three things you can set up in MailBrew:

  1. Limit who can read the inbox (two-factor authentication and roles)
  2. Limit how people and systems get in (IP restrictions and API key scopes)
  3. Record who viewed what and when (audit log)

Only owners of your organization can change these settings.

1. Limit who can read

Require two-factor authentication

On the dashboard's Security page, turn on "Require two-factor authentication". Members without two-factor authentication must set it up before they can use the dashboard.

It uses 6-digit codes from an authenticator app such as Google Authenticator. It does not rely on browser-specific features, so it also works in locked-down corporate browsers.

On the same page, turn off "Skip code entry for 30 days" to make members enter a code every time. Turning it off also cancels any skips already granted.

Separate roles

There are three roles.

Role What they can do
Owner Everything. Only owners can change security settings, API keys, webhooks, members, SMTP credentials, and billing
Member Everyday use, such as reading the inbox and managing addresses
Mailbox only Read received emails and download raw messages and attachments, nothing else

Give the "Mailbox only" role to QA staff or outside contractors who only need to check emails. They cannot touch settings or API keys.

2. Limit how people and systems get in

IP restrictions

Under "IP address restrictions" on the Security page, list allowed IP addresses or CIDR ranges, one per line. Leave it empty to disable restrictions. To prevent lockouts, the list must include the IP address you are using now.

Restrictions apply to the dashboard, the MailBrew API, and sign-in. They do not apply to receiving email over SMTP, so emails from the application under test keep arriving.

Where CI gets stuck: API key calls are restricted too. GitHub-hosted runners get a different IP address on every run, so once you turn on IP restrictions, E2E tests in CI will fail with 403. If you use IP restrictions, call the API from runners with a fixed outbound IP address, such as self-hosted runners.

Narrow API key scopes

API keys belong to your organization, and only owners can create or delete them. You choose scopes when you create a key, so give CI only what it needs.

Scope What it allows
addresses:read / addresses:write / addresses:delete List, create, and delete addresses
emails:read Read and wait for emails, extract OTPs and links, run assertions
emails:forward Forward received emails
webhooks:read / webhooks:write / webhooks:delete Manage webhooks

For example, an E2E test that creates addresses and reads emails needs only addresses:write and emails:read. Note that creating an address (addresses:write) also lets the caller set a webhook URL, so narrowing scopes does not completely stop a leaked key from sending emails elsewhere. Keep keys in your CI secrets and delete a key as soon as you suspect it leaked.

Shorten retention

Under "Email retention" on the Security page, you can keep emails for fewer days than your plan allows (7 days). Emails past the retention period are deleted every day together with their attachments and webhook delivery logs. Emails older than a newly shortened period are deleted at the next run and cannot be recovered.

3. Record who viewed what

The dashboard's Activity page shows the audit log and the API log. You can filter by period, user, and action, and export as CSV or JSON. Owners see everyone's actions; members see only their own.

The audit log records these actions with the time, user, and IP address:

  • Sign-ins, sign-outs, and failed sign-ins
  • Viewing emails, downloading raw messages or attachments, and deleting emails (with the email ID and recipient)
  • Changes to members, API keys, and security settings
  • Password and email address changes, and billing actions

The API log records, for each API key, the time, endpoint, result, IP address, and the IDs of emails returned. You can still trace a key by its name after deleting it.

Subjects and bodies are not recorded, because they may contain one-time passwords.

Audit logs are kept for 365 days and API logs for 90 days.

Access by our staff is recorded too

MailBrew staff have no way to read your emails through the dashboard or the API. If we need to look at one, for example to investigate an incident, we ask for your consent first and open emails one by one. The time, reason, and scope are recorded in your audit log.

If a member loses their authenticator

An owner can turn off two-factor authentication for a member who lost their authenticator app. When that happens, the member and the owners are notified by email automatically.

Owners cannot turn off their own two-factor authentication. With two or more owners, one can reset the other. If your organization has a single owner, contact us; we will reset it after verifying your identity, and that action is recorded in your audit log too.

Summary

Goal Where to set it
Require 2FA for everyone Security → Require two-factor authentication
Separate people who only read Members → role "Mailbox only"
Allow only your office and CI Security → IP address restrictions
Limit what the CI key can do API Keys → scopes
Delete emails sooner Security → Email retention
Check who viewed what (owners) Activity → filters and CSV export

Two-factor authentication, IP restrictions, and audit logs are available on every plan. Data location and subprocessors, which security reviews often ask about, are covered on our security page and in the FAQ.

← Back to blog