RiskboundDocs

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#

ToolWhen an agent calls it
grant_accessTo give a user, group or service a role
revoke_accessTo take a role away

Params#

grant_access:

ParamTypeRequiredMeaning
granteestringyesWho gets the role. Use the same id as the agent's key when it is an agent
rolestringyesThe role name
duration_hourswhole numberyesHow long until it expires

revoke_access:

ParamTypeRequiredMeaning
rolestringyesThe role being removed

Outcomes#

RequestOutcomePolicy id
viewer for up to 24 hoursallowgrant-viewer-short
viewer or editor, longerask_humangrant-needs-approval
Any other roleblockgrant-roles-not-allowed
grantee is the agent itselfblockgrant-not-to-self
More than 720 hours (30 days)blockgrant-max-duration
Revoke any role but admin or ownerallowrevoke-ordinary
Revoke admin or ownerask_humanrevoke-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-approval and grant-roles-not-allowed. Keep them the same.
  • Change 24 and 720 to move the time limits.

The policy#

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

cedar
// 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");