Policy library
Changing access or permissions
Granting a role is a quiet way to widen what an agent, or an attacker steering it, can reach. Short read-only grants are routine. Admin grants and grants to the agent itself are not.
What it guards#
| Tool | When an agent calls it |
|---|---|
grant_access | To give a user, group or service a role |
revoke_access | To take a role away |
Params#
grant_access:
| Param | Type | Required | Meaning |
|---|---|---|---|
grantee | string | yes | Who gets the role. Use the same id as the agent's key when it is an agent |
role | string | yes | The role name |
duration_hours | whole number | yes | How long until it expires |
revoke_access:
| Param | Type | Required | Meaning |
|---|---|---|---|
role | string | yes | The role being removed |
Outcomes#
| Request | Outcome | Policy id |
|---|---|---|
viewer for up to 24 hours | allow | grant-viewer-short |
viewer or editor, longer | ask_human | grant-needs-approval |
| Any other role | block | grant-roles-not-allowed |
grantee is the agent itself | block | grant-not-to-self |
| More than 720 hours (30 days) | block | grant-max-duration |
Revoke any role but admin or owner | allow | revoke-ordinary |
Revoke admin or owner | ask_human | revoke-privileged-needs-approval |
grant-not-to-self compares grantee with context.agent, the agent key
Riskbound sets. A request cannot change context.agent.
Tune it#
- Edit the two role lists in
grant-needs-approvalandgrant-roles-not-allowed. Keep them the same. - Change
24and720to move the time limits.
The policy#
This is access.cedar as it is in the repository.
// Changing access or permissions.
//
// Tool: grant_access
// Params: grantee (string: who gets the access), role (string),
// duration_hours (whole number)
//
// viewer, up to 24 hours allow
// viewer or editor ask a human
// any other role block
// the agent granting to itself block (uses the agent key Riskbound sets)
// longer than 30 days block
//
// Tool: revoke_access
// Params: role (string)
//
// any role but admin and owner allow
// admin or owner ask a human
@id("grant-viewer-short")
permit (principal, action == Action::"act", resource == Tool::"grant_access")
when { context.role == "viewer" && context.duration_hours <= 24 };
@id("grant-needs-approval")
permit (principal, action == Action::"act_with_approval", resource == Tool::"grant_access")
when { ["viewer", "editor"].contains(context.role) };
@id("grant-roles-not-allowed")
forbid (principal, action, resource == Tool::"grant_access")
unless { ["viewer", "editor"].contains(context.role) };
// context.agent is the agent's key, set by Riskbound. Request params cannot
// overwrite it.
@id("grant-not-to-self")
forbid (principal, action, resource == Tool::"grant_access")
when { context.grantee == context.agent };
@id("grant-max-duration")
forbid (principal, action, resource == Tool::"grant_access")
when { context.duration_hours > 720 };
@id("revoke-ordinary")
permit (principal, action == Action::"act", resource == Tool::"revoke_access")
unless { ["admin", "owner"].contains(context.role) };
@id("revoke-privileged-needs-approval")
permit (principal, action == Action::"act_with_approval", resource == Tool::"revoke_access");