RiskboundDocs

Policy library

Sending external email

Email that leaves the company cannot be taken back. Watch for mass sends, files sent to outsiders, and domains you never want to mail.

What it guards#

ToolWhen an agent calls it
send_emailTo send a message from a company mailbox

Params#

ParamTypeRequiredMeaning
recipient_domainslist of stringsyesEach distinct domain in To, Cc and Bcc, lowercase. ["example.com", "customer.test"]
recipient_countwhole numberyesTotal recipients across To, Cc and Bcc
has_attachmentbooleanyestrue if any file is attached

Work these out in your code from the message you are about to send, not from what the model says it will send.

Outcomes#

RequestOutcomePolicy id
Only internal domains, up to 50 recipientsallowemail-internal
Up to 3 recipients, no attachmentallowemail-external-small
Up to 500 recipientsask_humanemail-needs-approval
More than 500 recipientsblockemail-mass-send
Any denied domainblockemail-denied-domains

Tune it#

  • Replace "example.com" in email-internal with your own domains.
  • Edit the deny list in email-denied-domains.
  • To make every outside email wait for a person, delete email-external-small.

The policy#

This is email.cedar as it is in the repository.

cedar
// Sending email outside the company.
//
// Tool: send_email
// Params: recipient_domains (list of strings, one per distinct domain),
//         recipient_count (whole number), has_attachment (boolean)
//
//   only internal domains, up to 50 recipients     allow
//   up to 3 recipients, no attachment              allow
//   up to 500 recipients                           ask a human
//   more than 500 recipients                       block
//   any domain on the deny list                    block

@id("email-internal")
permit (principal, action == Action::"act", resource == Tool::"send_email")
when {
  ["example.com"].containsAll(context.recipient_domains) &&
  context.recipient_count <= 50
};

@id("email-external-small")
permit (principal, action == Action::"act", resource == Tool::"send_email")
when { context.recipient_count <= 3 && !context.has_attachment };

@id("email-needs-approval")
permit (principal, action == Action::"act_with_approval", resource == Tool::"send_email")
when { context.recipient_count <= 500 };

@id("email-mass-send")
forbid (principal, action, resource == Tool::"send_email")
when { context.recipient_count > 500 };

@id("email-denied-domains")
forbid (principal, action, resource == Tool::"send_email")
when { context.recipient_domains.containsAny(["competitor.example", "pastebin.example"]) };