Yehiel Mizrahi
07/06/2025, 3:25 PMcerbosctl
- when running:
cerbosctl get resource_policy --name=RECORD --server=localhost:3594 --username=<my_user> --password=<my_pass> --plaintext
I get:
cerbosctl: error: failed to list: error while listing policies: could not get policy: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (12398930 vs. 4194304)
But policies are not that big - the entire policy table is 5 MB (see the screenshots)
Is it trying to get all of the policies? Why if I am trying to get only one?
Thank you!Sam Lock (Cerbos)
07/07/2025, 7:05 AMALLOW
that now returns a DENY
?Yehiel Mizrahi
07/07/2025, 7:06 AMSam Lock (Cerbos)
07/07/2025, 7:10 AMUpon debugging I have noticed that policy that was returning ALLOW on certain check request is now returning DENY.
Sam Lock (Cerbos)
07/07/2025, 7:16 AMYehiel Mizrahi
07/07/2025, 7:18 AMSam Lock (Cerbos)
07/07/2025, 7:21 AMv0.45.1
)Yehiel Mizrahi
07/07/2025, 7:21 AMYehiel Mizrahi
07/07/2025, 7:22 AMSam Lock (Cerbos)
07/07/2025, 7:23 AMYehiel Mizrahi
07/07/2025, 7:24 AMYehiel Mizrahi
07/07/2025, 7:25 AMYehiel Mizrahi
07/07/2025, 7:26 AMSam Lock (Cerbos)
07/07/2025, 7:28 AM""
?Yehiel Mizrahi
07/07/2025, 7:29 AMSam Lock (Cerbos)
07/07/2025, 7:31 AM---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
resource: "album:object"
version: "default"
scope: "acme.corp" <--
...
If it's omitted, then it's just the default scope (which is useful context for debugging).Yehiel Mizrahi
07/07/2025, 8:12 AMYehiel Mizrahi
07/07/2025, 9:59 AMcerbosctl get resource_policy --name=RECORD --server=localhost:3594 --username=cerbos --password=cerbosAdmin --plaintext
I get:
cerbosctl: error: failed to list: error while listing policies: could not get policy: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (12550547 vs. 4194304)
even though I set
maxRecvMsgSizeBytes: 33554432 # 32MB in bytes
in my Cerbos config:
server:
# Configure Cerbos to listen on a Unix domain socket.
grpcListenAddr: "127.0.0.1:3593"
# Note that adminAPI will be enabled only for PermissionsService
adminAPI:
enabled: true
adminCredentials:
username: cerbos
passwordHash: whatever=
advanced:
grpc:
maxRecvMsgSizeBytes: 33554432 # 32MB in bytes
audit:
enabled: true
backend: file
file:
path: stdout
storage:
driver: mysql
mysql:
dsn: ${MYSQL_USERNAME}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:3306)/${MYSQL_DATABASE}
compile:
cacheDuration: 60s
Yehiel Mizrahi
07/07/2025, 11:23 AMmaxRecvMsgSizeBytes: 33554432
doesn't seem to kick inSam Lock (Cerbos)
07/07/2025, 1:49 PMYehiel Mizrahi
07/07/2025, 1:49 PMYehiel Mizrahi
07/07/2025, 1:50 PMcerbosctl: error: failed to list: error while listing policies: could not get policy: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (12398930 vs. 4194304)
Sam Lock (Cerbos)
07/07/2025, 2:00 PMYehiel Mizrahi
07/07/2025, 2:01 PMBilly Bolton
07/07/2025, 2:28 PMCharith (Cerbos)
maxRecvMsgSizeBytes
setting is for the Cerbos PDP defining how big the client's request could be. The error you're getting from cerbosctl
is the opposite. The server is sending a 12MiB message when the client is only able to accept 4MiB. That's the default value for gRPC clients.Yehiel Mizrahi
07/07/2025, 3:09 PMCharith (Cerbos)
SELECT LENGTH(definition) FROM policy WHERE name = 'RECORD'
and post the output?Yehiel Mizrahi
07/07/2025, 3:18 PMCharith (Cerbos)
SELECT SUM(LENGTH(definition)) FROM policy
as well?Yehiel Mizrahi
07/07/2025, 3:21 PMYehiel Mizrahi
07/07/2025, 3:22 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 3:36 PMYehiel Mizrahi
07/07/2025, 3:40 PMYehiel Mizrahi
07/07/2025, 3:44 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 3:48 PMYehiel Mizrahi
07/07/2025, 3:48 PMYehiel Mizrahi
07/07/2025, 3:49 PMYehiel Mizrahi
07/07/2025, 3:49 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 3:53 PMYehiel Mizrahi
07/07/2025, 3:54 PMCharith (Cerbos)
"(\"cnc:3ddb7420-b82a-40a9-84d6-dc9381788b21#role:35568e6e-f807-406b-b3ce-e074ea8bd28e\" in request.principal.attr.cncs[request.resource.attr.cnc].roles)"
. You can then attach the result of that lookup as a principal attribute in the call to Cerbos and the policy would be much simpler and wouldn't grow indefinitely.Yehiel Mizrahi
07/07/2025, 3:58 PMYehiel Mizrahi
07/07/2025, 3:59 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 4:00 PMYehiel Mizrahi
07/07/2025, 4:01 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 4:05 PMYehiel Mizrahi
07/07/2025, 4:05 PMYehiel Mizrahi
07/07/2025, 4:06 PMYehiel Mizrahi
07/07/2025, 4:07 PMCharith (Cerbos)
Yehiel Mizrahi
07/07/2025, 4:12 PMYehiel Mizrahi
07/07/2025, 4:12 PMYehiel Mizrahi
07/07/2025, 4:13 PMCharith (Cerbos)