Owen Cummings
03/14/2023, 3:50 PMiat
and exp
timestamp based checks?Saul Martin
03/15/2023, 11:18 AMSaul Martin
03/20/2023, 4:59 PMservices:
cerbos:
image: <http://ghcr.io/cerbos/cerbos:0.25.0|ghcr.io/cerbos/cerbos:0.25.0>
container_name: cerbos
volumes:
- ./illiquid_assets_api/api/cerbos/policies:/policies
ports:
- "3592:3592"
- "3593:3593"
command: server --config=/
restart: unless-stopped
• illiquid_assets_api / api / cerbos / config.yml
• illiquid_assets_api / api / cerbos / policies / policy.ymlJesum Yip
03/23/2023, 6:13 AMDipesh Bajgain
03/23/2023, 7:54 AM{"log.level":"error","@timestamp":"2023-03-23T07:50:37.865Z","log.logger":"cerbos.index","message":"Index build failed","load_failures":[{"file":"config.yaml","error":"failed to unmarshal JSON: proto: (line 1:2): unknown field \"server\""}]}
cerbos: error: failed to create store: failed to build index: missing imports=0, missing scopes=0, duplicate definitions=0, load failures=1
My docker compose config is as below:
version: "3.8"
services:
app:
restart: always
container_name: dashboard
image: dashboard
build:
context: .
target: development
volumes:
- ./src:/app/src
ports:
- 3000:3000
command: npm run dev
cerbos:
image: <http://ghcr.io/cerbos/cerbos:0.25.0|ghcr.io/cerbos/cerbos:0.25.0>
container_name: cerbos
volumes:
- ./cerbos:/config
- ./cerbos:/policies
ports:
- "3592:3592"
- "3593:3593"
restart: unless-stopped
command: server --config /config/config.yaml
And my cerbos config file is as below:
server:
playgroundEnabled: true
httpListenAddr: ":3592"
grpcListenAddr: ":3593"
storage:
driver: "disk"
disk:
directory: /policies
watchForChanges: true
Dipesh Bajgain
03/24/2023, 5:42 AMCross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <http://localhost:3592/api/check/resources>. (Reason: CORS request did not succeed). Status code: (null).
And my updated config file is as below:
---
storage:
driver: "disk"
disk:
directory: /policies
watchForChanges: true
server:
playgroundEnabled: true
httpListenAddr: ":3592"
grpcListenAddr: ":3593"
cors:
allowedHeaders: ['content-type']
allowedOrigins: ['*']
disabled: false
maxAge: 10s
Aldin Kiselica
03/24/2023, 8:55 AMsdktr
03/24/2023, 9:00 PMBojan Delic
03/29/2023, 12:31 PMfailed to load test suite: failed to unmarshal JSON: proto: syntax error (line 1:183): unexpected token {
and I am sure I made some mistake in yaml file (I have validated it and it is valid yaml) and I am sure it is not going to be last time, so I am looking for a way to get a sense of what is wrong. I am running docker run -it -v (pwd)/policies:/policies -v (pwd)/tests:/tests <http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest> compile /policies --tests /tests --verbose
. Thanks.Bojan Delic
03/30/2023, 12:44 PMHugo Tiem
03/30/2023, 3:33 PMseala va
04/01/2023, 8:34 AMHugo Tiem
04/03/2023, 12:13 PMcondition:
match:
expr: R.attr.all(content, content.author.user.employerId == V.user_employer_id)
# where user_employer_id = P.attr.user.employerId
but i got this error on cerbos console :
{
"log.level": "error",
"@timestamp": "2023-04-03T12:00:11.755Z",
"log.logger": "cerbos.grpc",
"message": "Policy check failed",
"grpc.start_time": "2023-04-03T12:00:11Z",
"system": "grpc",
"span.kind": "server",
"grpc.service": "cerbos.svc.v1.CerbosService",
"grpc.method": "CheckResources",
"peer.address": "172.17.0.1:36048",
"cerbos": {
"call_id": "01GX3FTCXCDAS2SXWCKCQX1P8V"
},
"error": "failed to get check for [article.default]: policy compilation error: 1 compilation errors:\npolicies/articles.yaml: Invalid expression in resource rule 'rule-005' (failed to compile `R.attr.all(article, article.author.user.employerId == V.user_employer_id)` [type 'primitive:STRING' does not support field selection])"
}
how can i check if user and author id are the same for every items of the list ?Owen Cummings
04/03/2023, 6:41 PMHugo Tiem
04/04/2023, 7:25 AMJesum Yip
04/14/2023, 9:25 AMshams agaz
04/17/2023, 6:04 AMSlackbot
04/18/2023, 3:55 AMAtabey Heydarli
04/19/2023, 2:09 PMCERBOS_CLIENT = CerbosClient(host="<http://192.168.1.192:3593>", request_retries=10)
sessionList=crud.session.get_active_by_owner_sub(db=db, owner_id=user_id)
if sessionList:
principal = Principal(
user_id,
roles=roles, # type: ignore
policy_version="20210210",
)
resource = Resource(
sessionList[0].id.__str__(), # type: ignore
sessionList[0].__tablename__,
attr=jsonable_encoder(sessionList[0]),
)
action = "read"
allowed = CERBOS_CLIENT.is_allowed(action, principal, resource)
if not allowed:
raise HTTPException(
status_code=403, detail="Unauthorized"
)
And these are the logs of last two requests, last one took around 16 seconds:
{"log.level":"info","@timestamp":"2023-04-19T14:08:32.043Z","log.logger":"cerbos.grpc","message":"Handled request","grpc.start_time":"2023-04-19T14:08:32Z","system":"grpc","span.kind":"server","grpc.service":"cerbos.svc.v1.CerbosService","grpc.method":"CheckResources","peer.address":"127.0.0.1:44744","http":{"x_forwarded_for":["172.23.0.1"],"x_forwarded_host":["192.168.1.192:3593"]},"cerbos":{"call_id":"01GYCXGWSBJR2P1WZ4HMZTG58W"},"grpc.code":"OK","grpc.time_ms":0.182}
{"log.level":"info","@timestamp":"2023-04-19T14:08:48.494Z","log.logger":"cerbos.grpc","message":"Handled request","grpc.start_time":"2023-04-19T14:08:48Z","system":"grpc","span.kind":"server","grpc.service":"cerbos.svc.v1.CerbosService","grpc.method":"CheckResources","http":{"x_forwarded_for":["172.23.0.1"],"x_forwarded_host":["192.168.1.192:3593"]},"cerbos":{"call_id":"01GYCXHCVEJM0PE5Z3SB002T7B"},"peer.address":"127.0.0.1:44744","grpc.code":"OK","grpc.time_ms":0.291}
Carl Bäckström
04/25/2023, 9:16 AMDavid Nilsdotter
04/25/2023, 1:52 PMhelm install cerbos cerbos/cerbos --version=0.26.0
, the installation goes through and I'm able to access the API documentation on the endpoint in the browser.
To be able to test policy requests, I want to serve policies from a public S3 bucket, and added a config file as described here https://docs.cerbos.dev/cerbos/latest/installation/helm.html, but with the following configuration:
cerbos:
config:
server:
httpListenAddr: :3592
grpcListenAddr: :3593
adminAPI:
adminCredentials:
passwordHash: <password-hash>
username: cerbos
enabled: true
log:
level: info
storage:
driver: s3
blob:
bucket: s3://<bucket-name>?region=eu-west-1
updatePollInterval: 10s
downloadTimeout: 30s
I tried the following:
• helm upgrade cerbos cerbos/cerbos --version=0.26.0 --values=config.yaml
-> This does nothing. It states the upgrade is successful, but nothing changes and Cerbos does not seem to read the policy. The API documentation is still available.
• helm uninstall cerbos
helm install cerbos cerbos/cerbos --version=0.26.0 --values=config.yaml
-> This breaks the system, and the ingress returns 503 when trying to access the API documentation.
• Rerunning helm uninstall cerbos
helm install cerbos cerbos/cerbos --version=0.26.0
restores the API access.
A couple of things:
• How / can I upgrade an existing cerbos service using helm in the cluster, and if so, what is the process for this?
• How can I read / access the deployment logs, if something does not goes well?
• What could be the issue here? Am I missing some required configurations?Alex Tuca
04/27/2023, 8:54 AMDavid Nilsdotter
04/27/2023, 11:40 AMEric Formo
04/28/2023, 8:04 PMAlex Tuca
05/03/2023, 7:04 AMAlex Tuca
05/03/2023, 9:51 AMPaul Werner
05/04/2023, 9:56 AMPaul Werner
05/04/2023, 10:42 AMCarl Bäckström
05/04/2023, 5:41 PMCarl Bäckström
05/04/2023, 5:48 PM@cerbos/orm-prisma
can be found?