Jesum Yip
07/08/2024, 5:29 AMCheckResourcesResult
which has a property called result
which holds an instance of Resource
class. In that instance of Resource
class, I see that the attr
property is an empty dictionary. Is this supposed to be empty or are there circumstances where this will be filled up? the reason I am asking is this: i set my kind
to be a global value of service:fields.
I am using cerbos to control which fields in a database get obfuscated when a REST API returns it. the way I differentiate the fields (or specify the field names) in the cerbos API payload is via an attribute to the resource. I call this attribute field_name
Jesum Yip
07/08/2024, 5:29 AMfield_name
. I have policies written that evaluate this attribute.Jesum Yip
07/08/2024, 5:30 AMkind
is the same for all the resources.Jesum Yip
07/08/2024, 5:30 AMJesum Yip
07/08/2024, 5:34 AM- resource: "service:fields"
actions:
- action: read
condition:
match:
all:
of:
- expr: >
!(R.attr.field_name in [
"field1",
"field2",
this makes it easy for me because if i have 20 fields, I don't have to write 20 policies.Charith (Cerbos)
Resource
object in the response won't have the attributes set. It's just reusing the same type but not actually echoing back the request.
The response from Cerbos returns results in the same order as the request. However, it is intentionally undocumented because we might want to change that in the future. The recommended way to uniquely identify results is to use the resource ID. The get_resource
method of the response can be used for that.Jesum Yip
07/08/2024, 8:54 PM