Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/data_filter_mongo example test case for employees/john example not working as advertised in README.md (returns empty) #215

Open
wvkehoe opened this issue Apr 9, 2023 · 0 comments

Comments

@wvkehoe
Copy link

wvkehoe commented Apr 9, 2023

Hello @VineethReddy02

Thank you for making the data_filter_mongo contribution to OPA.

Can you provide the current status of this contribution?

When I attempt to run the employees/john example that you describe in https://github.com/open-policy-agent/contrib/blob/main/data_filter_mongodb/README.md, I get an empty 200 response (see my command line below).

Note that since I'm running on an M1 Mac and I could not find a M1 arch published version of vineeth97/opa-mongo, I needed t build from source. Also, i noticed that the code as provided reads a request body on the GET endpoint which, since I'm using curl to send requests, meant that I needed to add a POST endpoint that uses the same api.handleGetReq handler. I've tried to trace down through the debugger to pinpoint where things go wrong but this is complicated by the extremely nested nature of the evaluation. The best I've been able to determine so far is that the "defined" boolean at https://github.com/open-policy-agent/opa/blob/main/topdown/eval.go#L417 never gets set to true for any evaluated step executed by evalStep method so the method returns nil.

The only output I see is in the following, one-line log output message from the server log:

{"level":"info","ts":1681043557.8948538,"caller":"opa/opa.go:62","msg":"received request","request":{"method":"POST","path":["employees","john"],"user":"danerys"}}

Upgrading the opa dependency from 0.43.1 to latest 0.51.0 does not help matters.

Any suggestions would be appreciated.

Here is my command line I'm using to transmit the request to the server:

@curl -X POST http://localhost:9095/employees/john -d @- <<EOF

{
"input": {
"method": "GET",
"path": ["employees", "john"],
"user": "danerys"
}
}
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant