Email
Research
Email engineering guide

Security controls for a mailbox integration

Mailbox access exposes highly sensitive communications, so secure design starts with least privilege and continues through token custody, tenant isolation, content minimization, audit, incident response, and deletion.

Research surface only. This guide documents architecture and evaluation criteria; it does not describe a released DewEngine connector.
01
Authorization

Request only the capability the user can see

Separate read, modify, draft, and send permissions. Explain each scope before consent and reauthorize deliberately when the product expands; never acquire broad mailbox access for hypothetical future features.

02
Secrets

Isolate provider authorization material

Encrypt refresh tokens or protocol credentials with managed keys, limit decryption to connector workers, redact logs, and rotate credentials atomically. Browsers and analytics systems must never receive long-lived provider secrets.

  • Envelope encryption
  • Tenant-scoped access policy
  • Secret-free logs and traces
  • Rotation and revocation
03
Mailbox data

Minimize content and retention

Store metadata first, hydrate bodies only when required, scan and stream attachments safely, and enforce retention and deletion as background jobs with evidence. Google's restricted Gmail scopes can add verification and security-assessment duties.

04
Operational security

Make every sensitive action attributable

Record account ownership, requesting principal, permission decision, provider action, and result without copying message content into audit logs. Alert on unusual access, repeated auth failures, cross-tenant checks, and volume changes.

  • Immutable action audit
  • Per-tenant authorization tests
  • Rate and anomaly controls
  • Documented incident and deletion runbooks
Questions

Before you build.

Is OAuth alone enough to secure an email integration?+

No. OAuth controls provider authorization, but the application still needs tenant isolation, token encryption, product permissions, secure logging, retention, monitoring, and incident response.

Should email bodies appear in application logs?+

No. Log identifiers, sizes, states, and diagnostic codes. Message content and tokens should be excluded or tightly redacted from logs and traces.

Can I use DewEngine's email connectors today?+

Not yet. Gmail, Microsoft Graph, and IMAP/SMTP connectors are planned. This guide documents the intended architecture and the provider requirements a production release must satisfy.

Build with us

Does this match the workflow your users need?

DewEngine is in development. Real use cases decide what ships first.

Share your use case