Hi, is it possible to enable more verbose logging ...
# help
f
Hi, is it possible to enable more verbose logging for the
/check
endpoint? I set log level to
DEBUG
but I want to see which the derived role user got while the authorization check process.
a
Hey
If you add
"includeMeta": true
into the request to the check endpoint it will include more information about which policies matched
eg
Copy code
{
  "requestId": "test01",
  "actions": [
    "view"
  ],
  "resource": {
    "policyVersion": "dev",
    "kind": "album:object",
    "instances": {
      "XX125": {
        "attr": {
          "owner": "alicia",
          "id": "XX125",
          "public": false,
          "tags": [
            "x",
            "y"
          ],
          "flagged": false
        }
      }
    }
  },
  "principal": {
    "id": "alicia",
    "policyVersion": "dev",
    "roles": [
      "user"
    ],
    "attr": {
      "geography": "GB"
    }
  },
  "includeMeta": true
}
Let me know if that answers your question - happy to jump on a quick call if it is easier 🙂
f
Thank you so much @Alex Olivier (Cerbos)! So I can see
"effectiveDerivedRoles": []
Now I need to figure out why my principal doesn't get the derived role that I expected.
a
If you are willing to share your policies, I'm happy to assist
Thank you @Alex Olivier (Cerbos), I've just uploaded my request body along with my policies.
a
From a quick look, I think the path for the owner should be
request.resource.attr.campaign.owner
f
Thank you. Adjusted it but I got effect_deny again. I got campaign_owner derived role when I import only one derived role configuration here: https://gist.github.com/fatihky/04830529e4281fdef5d8b3adc13e8ab7#file-resource_campaign_keyword-yaml-L8
a
Hmm let me try and replicate this
I can replicate what you are seeing - let me raise with our engineering team and see if we can get an answer to this for you
f
Thank you, in mean time, I found an example that imports multiple derived roles: https://github.com/cerbos/cerbos/blob/e8df72a6448bb5f7f371fa6a4b3d64983242379d/internal/test/testdata/compile/multiple_imports.yaml I'll try that now.
a
Hey just to let you know that this was indeed a bug and a PR with a fix is already up for review https://github.com/cerbos/cerbos/pull/330
Thanks for raising it and hopefully it hasn't caused too many headaches
c
Thanks for reporting the bug. We just released v0.8.0 with the bugfix. https://github.com/cerbos/cerbos/releases/tag/v0.8.0
f
Thank you so much @Alex Olivier (Cerbos) and @Charith (Cerbos). Sorry for the delayed appreciation because of the Slack's service interruption.
🎉 1