Denys Andriyanov
06/22/2023, 12:21 PM---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
version: "default"
# Importing `identity_roles` in so they can be used in the resource policy.
importDerivedRoles:
- identity_roles
# This resource file is reviewed for when checking permissions when a resource
# is of `kind` "user_request"
resource: user_request
rules:
# If the `principal`s role is `admin` then all the actions are allowed.
- actions: [ "*" ]
roles:
- root
effect: EFFECT_ALLOW
# A `admin_that_owns_the_tenant` can only access `user_request` that belong to resources in
# their tenant,
- actions: [ "*" ]
roles:
- admin
effect: EFFECT_ALLOW
condition:
match:
expr: request.resource.attr.tenant == request.principal.tenant
getting
"error":"failed to get check for [user_requ
est.default]: policy compilation error: 1 compilation errors\nresource user request.yaml Invalid expression in resource rule 'rule-002' (failed to compile
request.resource.attr.tenant == request.principal.tenant
[undefined field 'tenant'])"}Denys Andriyanov
06/22/2023, 12:22 PMChris Arderne
06/23/2023, 10:11 AMAlex Olivier (Cerbos)
Yousef Sultan
06/29/2023, 9:32 AMYousef Sultan
06/29/2023, 9:36 AMMark Piper
06/30/2023, 3:19 AMcerbos-query-plan-adapters
and added one. (Not yet in a gem or well-documented, but it passes all the ORM tests). Sharing it here!
https://github.com/mark-piper/cerbos-query-plan-adapters/tree/mark-piper/activerecordAnna Paykina
07/06/2023, 11:33 AMBen Hall
07/11/2023, 6:16 PMMark Piper
07/13/2023, 4:16 PMrequest_id
is not logged. I've opened an issue https://github.com/cerbos/cerbos/issues/1690 and a PR to fix it: https://github.com/cerbos/cerbos/pull/1691jimmy mc
07/14/2023, 8:28 AMjimmy mc
07/14/2023, 8:52 AMFIRAS FENDRI
07/28/2023, 10:37 AMTim Letap
07/29/2023, 10:01 PMTomΓ‘Ε‘ Hanus
07/31/2023, 1:47 PMFarzad Soltani
08/08/2023, 8:13 AM/api/check
endpoint:
{
"principal": {
"id": "user_1", // the user ID
"roles": ["user"], // list of roles from user's profile
"attr": {} // a map of attributes about the user - not used yet
},
"resource": {
"kind": "contact", // the type of the resources
"instances": { // a map of the resource instance(s) being checked
"contact_1": { // key is the ID of the resource instance
"attr": {} // a map of attributes about the resource - not used yet
}
}
},
"actions": ["read"] // the list of actions to be done on the resource
}
This is pointing users to the deprecated version of the endpoint and doesn't work with the new endpoint. An example of a valid payload would be something like this:
{
"principal": {
"id": "user_1",
"roles": [
"user"
],
"attr": {}
},
"resources": [
{
"actions": [
"read",
"write"
],
"resource": {
"id": "XX125",
"kind": "contact"
}
}
]
}
If my point is valid, I can open an issue and PR to fix this section.Jesum Yip
08/10/2023, 8:03 AMJesum Yip
08/11/2023, 7:42 AMprincipalPolicy.principal
. how is this reference? is it in a derived role?Jesum Yip
08/11/2023, 8:05 AMapiVersion: api.cerbos.dev/v1
resourcePolicy:
version: default
resource: invict_triage
importDerivedRoles:
- avengers_global_users
rules:
- actions:
- subscribed
effect: EFFECT_ALLOW
derivedRoles:
- avengers_invict_user
condition:
match:
expr: request.resource.attr.data_org_id == "blablabla"
what's a clean way to add actions READ and actions WRITE permissions to the resource invict_triage
for this specific derivedRole WITHOUT modifying the YAML above?Vishal Augustine
08/11/2023, 1:20 PMEmre (Cerbos)
Roman Levytskyi
08/18/2023, 8:53 AMcors
block can we use *
in it?
cors:
allowedOrigins:
- '*.<http://domain.com|domain.com>'
and if so, would the <http://my.sub.domain.com|my.sub.domain.com>
be allowed?Ali Ataf
08/21/2023, 9:02 AMprincipal
refers to the id
of the user, is there a way to make a general principal policy for a specific role?
my use case is I have an admin
role that has all permissions and I don't want to repeat for example
- actions: ["*"]
effect: EFFECT_ALLOW
roles:
- admin
for each policy that I haveAmit
08/26/2023, 1:09 PMLinenBot
08/31/2023, 2:54 PMkam
joined #community.Kam
08/31/2023, 2:59 PMAnna Paykina
09/05/2023, 9:01 AMNathan Tarbert
09/13/2023, 2:58 PMBalwan singh
09/15/2023, 9:42 AMFarzad Soltani
09/18/2023, 1:22 PM---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
version: default
resource: user
rules:
- actions:
- create
roles:
- admin
- user
effect: EFFECT_ALLOW
- actions:
- update
- read
roles:
- user
effect: EFFECT_ALLOW
condition:
match:
expr: request.resource.id == request.principal.id
- actions:
- create
- update
- list
- read
roles:
- admin
effect: EFFECT_ALLOW