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#
| Tool | When an agent calls it |
|---|---|
export_customer_data | To write customer records to a file, sheet, bucket or another system |
Params#
| Param | Type | Required | Meaning |
|---|---|---|---|
row_count | whole number | yes | How many records. Count them before you ask |
includes_pii | boolean | yes | true if any column holds personal data: names, emails, addresses, phone numbers, IDs |
destination | string | yes | "internal" for your own systems. Anything else counts as outside |
Outcomes#
| Request | Outcome | Policy id |
|---|---|---|
| Up to 1,000 rows, no PII, internal | allow | export-small-internal |
| Up to 100,000 rows | ask_human | export-needs-approval |
| More than 100,000 rows, caller has a dry run | dry_run | export-large-dry-run |
| More than 100,000 rows, no dry run | block | no_matching_policy |
PII to anywhere but "internal" | block | export-no-pii-outside |
| More than 1,000,000 rows | block | export-hard-cap |
Tune it#
- Change
1000inexport-small-internaland100000inexport-needs-approvalto 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
dryRunto the guard. Without one, large exports are blocked.
The policy#
This is data-export.cedar as it is in the repository.
// 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 };