Policy Use Cases
Overview
Forbid Access for All Except a Role for a Tagged Resource
Example policy statements
// forbid all access
// unless the principal has the `devDBUsers` role
// and the resource is tagged with `env` and `env=dev`
permit (
principal in StrongDM::Role::"devDBUsers",
action,
resource
) when {
resource.hasTag("env") && resource.getTag("env") == "dev"
};
// alternative 1: permit access for principals
// that have the `devDBUsers` role and
// want to perform specific actions in SQL
// and when the resource is tagged with `env` and `env=prod`
permit (
principal in StrongDM::Role::"devDBUsers",
action in [
SQL::Action::"select",
SQL::Action::"with",
SQL::Action::"values",
SQL::Action::"show",
SQL::Action::"set"
],
resource
) when {
resource.sdm.hasTag("env") && resource.sdm.getTag("env") == "prod"
};
// alternative 2: permit access for a principal
// who has the `devDBUsers` role
// when the resource is tagged with `env` and `env=prod`
// unless the principal is trying to write to SQL tables
permit (
principal in StrongDM::Role::"devDBUsers",
action,
resource
) when {
resource.sdm.hasTag("env") && resource.sdm.getTag("env") == "prod"
} unless {
context.sql has "writeTables"
};
// or forbid principals with the `devDBUsers` role
// when trying to write to SQL tables
// when the resource is tagged with `env` and `env=prod`
forbid (
principal in StrongDM::Role::"devDBUsers",
action,
resource
) when {
context.sql has "writeTables" &&
resource.sdm.hasTag("env") && resource.sdm.getTag("env") == "prod"
} ;Restrict Access to Sensitive Resources
Example policy statement
Allow Only Postgres-Supported Actions on Specified Resources
Example Permit statement
Example Forbid statement
Deny All Actions on the Production DB Originating Outside of the US
Example Forbid statement
Example Permit statement
Limit Query Result Set and Display Notification for Operator Role
Example policy statement
Allow All Actions on Postgres Resources
Example Permit statement
Permit Access Only During Business Hours Not in December
Example Permit statement
Last updated
Was this helpful?

