RiskboundDocs

Policy library

Customer data export

Pulling customer records out of a system. Small internal exports are routine. Personal data leaving the company is a breach.

What it guards#

ToolWhen an agent calls it
export_customer_dataTo write customer records to a file, sheet, bucket or another system

Params#

ParamTypeRequiredMeaning
row_countwhole numberyesHow many records. Count them before you ask
includes_piibooleanyestrue if any column holds personal data: names, emails, addresses, phone numbers, IDs
destinationstringyes"internal" for your own systems. Anything else counts as outside

Outcomes#

RequestOutcomePolicy id
Up to 1,000 rows, no PII, internalallowexport-small-internal
Up to 100,000 rowsask_humanexport-needs-approval
More than 100,000 rows, caller has a dry rundry_runexport-large-dry-run
More than 100,000 rows, no dry runblockno_matching_policy
PII to anywhere but "internal"blockexport-no-pii-outside
More than 1,000,000 rowsblockexport-hard-cap

Tune it#

  • Change 1000 in export-small-internal and 100000 in export-needs-approval to move the lines.
  • To let some outside places take PII, give them names and list them: when { context.includes_pii && !["internal", "dpa-vendor"].contains(context.destination) }.
  • The dry run is for a handler that counts rows and shows a sample. Pass it as dryRun to the guard. Without one, large exports are blocked.

The policy#

This is data-export.cedar as it is in the repository.

cedar
// Exporting customer data.
//
// Tool: export_customer_data
// Params: row_count (whole number), includes_pii (boolean),
//         destination ("internal" or "external")
//
//   up to 1,000 rows, no PII, internal     allow
//   up to 100,000 rows                     ask a human
//   more than 100,000 rows                 dry run (count and preview only)
//   PII to an external destination         block
//   more than 1,000,000 rows               block

@id("export-small-internal")
permit (principal, action == Action::"act", resource == Tool::"export_customer_data")
when {
  context.row_count <= 1000 &&
  !context.includes_pii &&
  context.destination == "internal"
};

@id("export-needs-approval")
permit (
  principal,
  action == Action::"act_with_approval",
  resource == Tool::"export_customer_data"
)
when { context.row_count <= 100000 };

// A large export can still be previewed. Without a dry-run handler in the
// caller, Riskbound never offers a dry run, so the export is blocked.
@id("export-large-dry-run")
permit (principal, action == Action::"dry_run", resource == Tool::"export_customer_data");

@id("export-no-pii-outside")
forbid (principal, action, resource == Tool::"export_customer_data")
when { context.includes_pii && context.destination != "internal" };

@id("export-hard-cap")
forbid (principal, action, resource == Tool::"export_customer_data")
when { context.row_count > 1000000 };