dcg

Careful Company: Outbound Email

careful_company_running_windows.email

Blocks sending email from the workstation: `Send-MailMessage`, `System.Net.Mail.SmtpClient`, Outlook COM automation, Microsoft Graph `sendMail`, transactional mail-API send endpoints (SendGrid/Mailgun/Postmark/Resend/SparkPost/Brevo/Mailjet), `aws ses send-email`, and SMTP CLI tools (`blat`, `swaks`, `msmtp`, `curl --mail-rcpt`).

  • 9blocking rules
  • 2safe patterns
  • 1Critical
  • 8High
~/.config/dcg/config.toml
[packs]
enabled = ["careful_company_running_windows.email"]

Evaluated when a command contains Send-MailMessage, send-mailmessage, SEND-MAILMESSAGE, SmtpClient, smtpclient, SMTPCLIENT, MailMessage, mailmessage, Net.Mail, net.mail.

Blocking rules

Each rule ID is careful_company_running_windows.email:<name>. Use it in allowlists and [policy.rules].

  1. mail-forwarding-rule

    Critical

    A mailbox forwarding rule keeps sending mail outward long after the command finishes.

    Explanation
    `New-InboxRule -ForwardTo`, `Set-Mailbox -ForwardingSmtpAddress`, and `New-TransportRule -BlindCopyTo` redirect mail automatically and indefinitely. Unlike a single send, this survives the session, needs no further commands, and is invisible to the mailbox owner — which is exactly why it is a standard business-email-compromise step rather than an administrative convenience. Safer alternatives: - `Get-InboxRule` / `Get-Mailbox | Select ForwardingSmtpAddress` to audit existing rules - Have a mail administrator make any forwarding change, with a change record
  2. aws-ses-send

    High

    aws ses send-email delivers email to arbitrary recipients from the CLI.

    Explanation
    `aws ses send-email` / `send-raw-email` sends mail using the machine's AWS credentials. `send-raw-email` accepts a complete MIME message, so an attachment of any readable file is a single command away. Safer alternatives: - `aws ses get-send-quota` / `list-identities` for inspection without sending - Send through the application's approved path with a scoped role
  3. curl-smtp-send

    High

    curl can speak SMTP directly; --mail-from/--mail-rcpt sends email.

    Explanation
    `curl` is not only an HTTP client: with `smtp://`/`smtps://` plus `--mail-from` and `--mail-rcpt` it sends mail, and `-T` supplies the message body from a file. This is an easy channel to miss because the command looks like an ordinary web request. Safer alternatives: - Use curl for HTTP only; leave mail to a reviewed, approved path - Have the operator send the message manually
  4. dotnet-smtp-client

    High

    System.Net.Mail.SmtpClient sends email directly from .NET, bypassing Send-MailMessage.

    Explanation
    `[System.Net.Mail.SmtpClient]` sends mail straight from .NET, which is the usual workaround when `Send-MailMessage` is unavailable or being watched, and `.Attachments.Add(...)` on the message carries any readable file out with it. Both the client and a `.Send`/`.SendAsync`/`.SendMailAsync` call are required, so constructing the client (or a `MailMessage` draft) without sending is not matched. Safer alternatives: - Hand the content to a person instead of transmitting it - Route approved automated mail through a reviewed service, not an ad-hoc one-liner
  5. graph-send-mail

    High

    Microsoft Graph sendMail sends email as the authenticated mailbox.

    Explanation
    `POST https://graph.microsoft.com/v1.0/me/sendMail` (or `Send-MgUserMail`) sends mail as the authenticated mailbox using the token already on the machine. Recipients and attachments come from the request body, so no SMTP server is needed and no mail client has to be installed. Safer alternatives: - Use Graph read scopes for inspection; leave sends to an approved service principal - Create a draft (`POST /me/messages`) for a person to review instead of sending
  6. mail-api-send-endpoint

    High

    POST to a transactional mail-API send endpoint delivers email to arbitrary recipients.

    Explanation
    A send endpoint on SendGrid, Mailgun, Postmark, Resend, SparkPost, Brevo, Mailjet, or SMTP2GO accepts any recipient list, body, and base64 attachment in the request, using the API key already configured on the machine. It needs no mail client and leaves no trace in the user's Sent Items. Safer alternatives: - Read-only API calls (template and event lookups) are unaffected — use those to inspect - Route approved sends through the application's reviewed code path
  7. outlook-com-send

    High

    Outlook/CDO COM automation sends mail as the signed-in user through the real mail client.

    Explanation
    `New-Object -ComObject Outlook.Application` plus `.CreateItem(0)` and `.Send()` produces genuine mail from the logged-in mailbox — it appears in Sent Items and passes every sender check, because it really is the user. Both the COM object and a `.Send()` are required, and a multi-line Outlook flow must also create a mail item, so obtaining the object to read a calendar, or building a draft and calling `.Display()`, is not matched. The evaluator's size-limited whole-command pass follows its per-segment passes, and the PowerShell scan extractor preserves a bounded Outlook creation/send sequence, so both one-liners and ordinary multi-line `.ps1` mailers are caught. `CDO.Message` — the classic scriptable SMTP COM object — is covered by the same rule, including the `[type]::GetTypeFromProgID(...)` form that avoids `New-Object`. Safer alternatives: - Draft the item and leave it unsent for the user to review (`.Display()`, not `.Send()`) - Ask the operator to send it themselves
  8. send-mailmessage

    High

    Send-MailMessage sends email from this machine to arbitrary recipients.

    Explanation
    `Send-MailMessage` sends mail through an SMTP server with whatever recipients, subject, body, and `-Attachments` the command supplies. It is the shortest path from "the agent can read a file" to "the file left the company", and the mail is sent under a real identity. Safer alternatives: - Write the intended message to a file and let a person review and send it - If one automated send is approved, allowlist that rule rather than the whole pack
  9. smtp-cli-tool

    High

    blat/swaks/msmtp/mailsend/sendemail and `git send-email` are command-line mail senders.

    Explanation
    These small utilities exist for one purpose: sending mail (with attachments) from a script. `git send-email` is the same thing for patches — it mails the contents of commits to arbitrary addresses through an SMTP server. Their presence on a developer workstation is usually incidental, so a call to one is worth an explicit approval. Safer alternatives: - Leave the content on disk for a person to review and send - Allowlist the specific command if a scheduled, reviewed send needs it

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • read-only-data-context
  • dcg-self-inspection