keto icon indicating copy to clipboard operation
keto copied to clipboard

Unable to Validate Multiple Namespaces in Files

Open NoiSek opened this issue 2 years ago • 0 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.

NoiSek avatar Jun 07 '22 23:06 NoiSek