ory / keto

Open Source (Go) implementation of "Zanzibar: Google's Consistent, Global Authorization System". Ships gRPC, REST APIs, newSQL, and an easy and granular permission language. Supports ACL, RBAC, and other access models.

Home Page:https://www.ory.sh/?utm_source=github&utm_medium=banner&utm_campaign=keto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to Validate Multiple Namespaces in Files

NoiSek opened this issue · comments

Preflight checklist

Describe the bug

When specifying a namespace file in the configuration, Keto is unable to parse multiple namespaces. The parser expects exactly one namespace value and does not currently have logic to handle arrays of namespaces.

This means that for values like file://./my_namespaces.json that the following is true.

PASS:

{ 'id': 0, 'name': 'foo' }

FAIL:

[ { 'id': 0, 'name': 'foo' }, { 'id': 1, 'name': 'bar' } ]

Reproducing the bug

Steps to reproduce:

  1. Specify a local file for namespaces in your keto.yml config
  2. Use any format, and specify multiple namespaces in an array
  3. Attempt to perform namespace validation with keto namespace validate or attempt to create any relation operation that specifies a namespace

Relevant log output

Encountered unmarshal error for "keto_namespaces.json": json: cannot unmarshal array into Go value of type map[string]interface {}

Relevant configuration

namespaces: file:///home/ory/keto_namespaces.json

Version

v0.8.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes

Additional Context

This bug occurs regardless of whether the file format is TOML / JSON / YAML and is not parser format specific.

For multiple namespaces, you can set the file URL to a directory containing all namespace files. With the OPL config #984 you also have all namespace in one file as described here. Closing, as the legacy namespace format will not be fixed.