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

Behaviour varies between /relation-tuples/check/openapi and /relation-tuples/check #1596

Open
4 of 5 tasks
MarkMk1 opened this issue Oct 7, 2024 · 0 comments
Open
4 of 5 tasks
Labels
bug Something is not working.

Comments

@MarkMk1
Copy link

MarkMk1 commented Oct 7, 2024

Preflight checklist

Ory Network Project

No response

Describe the bug

When defining a subject set, both the CLI and base /relation-tuples/check allow for the subject relation to be excluded.

The OpenAPI-produced client (both the outdated 0.11 on maven and I think the one generated from master) refer to /relation-tuples/check/openapi.

This endpoint will return a 400, whereas the CLI and /relation-tuples/check endpoints will return true or false where expected.

Reproducing the bug

Make API request from the OpenAPI client (PermissionApi.checkPermission)

permissionApi.checkPermission(
MY_NAMESPACE,
_object.toString(),
MY_RELATION,
null, // subject_id
ENTITY, // namespace
"$requestingEntity", // subject set object
null, // subject set relation
DEFAULT_MAX_DEPTH)

This will return 400.

Override this function to use the non-openAPI POST endpoint, and alter it to add the parameters to the POST body instead of the query parameters.

This will succeed.

Relevant log output

INFO[2024-10-07T15:16:23+02:00] started handling request                      http_request=map[headers:map[accept:application/json accept-encoding:gzip connection:Keep-Alive user-agent:OpenAPI-Generator/v0.11.0-alpha.0/java] host:localhost:4466 method:GET path:/relation-tuples/check/openapi query:namespace=Entity&object=1234&relation=read&subject_set.namespace=Entity&subject_set.object=5678&max-depth=10 remote:127.0.0.1:50412 scheme:http]
INFO[2024-10-07T15:16:23+02:00] An error occurred while handling a request    audience=application error=map[debug: message:incomplete subject, provide "subject_id" or a complete "subject_set.*" reason: stack_trace: status:Bad Request status_code:400] http_request=map[headers:map[accept:application/json accept-encoding:gzip connection:Keep-Alive user-agent:OpenAPI-Generator/v0.11.0-alpha.0/java] host:localhost:4466 method:GET path:/relation-tuples/check/openapi query:namespace=Entity&object=2234&relation=read&subject_set.namespace=Entity&subject_set.object=74090&max-depth=10 remote:127.0.0.1:50412 scheme:http] http_response=map[status_code:400] service_name=Ory Keto service_version=v0.12.0-alpha.0

Relevant configuration

No response

Version

v0.12.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Binary

Additional Context

No response

@MarkMk1 MarkMk1 added the bug Something is not working. label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

1 participant