open-policy-agent/opa

Bundle discovery issue when roots contains a space character

Opened this issue · 0 comments

Short description

I noticed a strange behavior when the agent is configured with bundle discovery, and one of the manifest roots contains space characters. In this case the bundle is loaded without any error, but the data content will be missing.

Example .manifest file:
{ "revision": "abc", "roots": ["a/b/foo bar"] }

Corresponding folder structure:

a
  b
    foo bar
      data.json
.manifest
.signatures.json

After loading this bundle via discovery and call GET http://localhost:8182/v1/data, the result does not contain the content of the data.json file, even the root (a.b.foo bar) is missing from the json tree. In the agent log the "Bundle loaded and activated successfully. Etag updated to ..." message appears.

This behaviour does not block loading other bundles though.

I could reproduce this even with the latest 0.63.0 version.

And to make the things more interesting, loading the same bundle from command line:
opa -s -b mybundle.tar.gz will load the bundle correctly.

Also, I changed "foo bar" to "foo%20bar" and this oddity still occurred (and obviously foo_bar fixed the issue).

Steps To Reproduce

Create an agent with a discovery config and add the above bundle to load.

Expected behavior

The json tree should reflect the data.json content even when the root contains a whitespace character.