Skip to content

Instantly share code, notes, and snippets.

@zepatrik
Created June 16, 2021 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zepatrik/93e78bec988e4371f0362f76ec429f9e to your computer and use it in GitHub Desktop.
Save zepatrik/93e78bec988e4371f0362f76ec429f9e to your computer and use it in GitHub Desktop.
Reproduce ory/keto#601
++ mktemp XXXXX.yml
+ cfg=OoInq.yml
+ echo '
namespaces:
- id: 0
name: endpoints
dsn: memory'
+ go build -tags sqlite .
+ keto_server_pid=49779
+ ./keto serve -c OoInq.yml
+ trap teardown EXIT
+ ./keto status -b
neither flag --read-remote nor env var KETO_READ_REMOTE are set, falling back to 127.0.0.1:4466
INFO[2021-06-16T10:40:30+02:00] No tracer configured - skipping tracing setup audience=application service_name=ORY Keto service_version=master
SERVING
INFO[2021-06-16T10:40:31+02:00] finished streaming call with code Canceled audience=application error=rpc error: code = Canceled desc = Stream has ended. grpc.code=Canceled grpc.method=Watch grpc.service=grpc.health.v1.Health grpc.start_time=2021-06-16T10:40:31+02:00 grpc.time_ms=8.215 service_name=ORY Keto service_version=master span.kind=server system=grpc
+ curl -s -d '{ "namespace":"endpoints", "object":"/endpoint/MyGRPCEndpoint","relation": "access", "subject":"uuidv4-1"}' -X PUT localhost:4467/relation-tuples
+ jq
INFO[2021-06-16T10:40:31+02:00] started handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4467 method:PUT path:/relation-tuples query:<nil> remote:[::1]:34920 scheme:http]
INFO[2021-06-16T10:40:31+02:00] completed handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4467 method:PUT path:/relation-tuples query:<nil> remote:[::1]:34920 scheme:http] http_response=map[status:201 text_status:Created took:3.8426ms]
{
"namespace": "endpoints",
"object": "/endpoint/MyGRPCEndpoint",
"relation": "access",
"subject": "uuidv4-1"
}
+ curl -s 'localhost:4466/relation-tuples?namespace=endpoints&subject=uuidv4-1'
+ jq
INFO[2021-06-16T10:40:32+02:00] started handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4466 method:GET path:/relation-tuples query:Value is sensitive and has been redacted. To see the value set config key "log.leak_sensitive_values = true" or environment variable "LOG_LEAK_SENSITIVE_VALUES=true". remote:[::1]:51820 scheme:http]
INFO[2021-06-16T10:40:32+02:00] completed handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4466 method:GET path:/relation-tuples query:Value is sensitive and has been redacted. To see the value set config key "log.leak_sensitive_values = true" or environment variable "LOG_LEAK_SENSITIVE_VALUES=true". remote:[::1]:51820 scheme:http] http_response=map[status:200 text_status:OK took:1.481827ms]
{
"relation_tuples": [
{
"namespace": "endpoints",
"object": "/endpoint/MyGRPCEndpoint",
"relation": "access",
"subject": "uuidv4-1"
}
],
"next_page_token": ""
}
+ curl -s 'localhost:4466/relation-tuples?namespace=endpoints'
+ jq
INFO[2021-06-16T10:40:32+02:00] started handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4466 method:GET path:/relation-tuples query:Value is sensitive and has been redacted. To see the value set config key "log.leak_sensitive_values = true" or environment variable "LOG_LEAK_SENSITIVE_VALUES=true". remote:[::1]:51822 scheme:http]
INFO[2021-06-16T10:40:32+02:00] completed handling request http_request=map[headers:map[accept:*/* user-agent:curl/7.76.1] host:localhost:4466 method:GET path:/relation-tuples query:Value is sensitive and has been redacted. To see the value set config key "log.leak_sensitive_values = true" or environment variable "LOG_LEAK_SENSITIVE_VALUES=true". remote:[::1]:51822 scheme:http] http_response=map[status:200 text_status:OK took:1.670933ms]
{
"relation_tuples": [
{
"namespace": "endpoints",
"object": "/endpoint/MyGRPCEndpoint",
"relation": "access",
"subject": "uuidv4-1"
}
],
"next_page_token": ""
}
+ teardown
+ kill 49779
+ rm OoInq.yml
#!/bin/bash
set -euxo pipefail
cfg="$(mktemp XXXXX.yml)"
echo '
namespaces:
- id: 0
name: endpoints
dsn: memory' > "$cfg"
go build -tags sqlite .
./keto serve -c "$cfg" &
keto_server_pid=$!
function teardown() {
kill $keto_server_pid || true
rm "$cfg" || true
}
trap teardown EXIT
./keto status -b
curl -s -d '{ "namespace":"endpoints", "object":"/endpoint/MyGRPCEndpoint","relation": "access", "subject":"uuidv4-1"}' -X PUT localhost:4467/relation-tuples | jq
curl -s 'localhost:4466/relation-tuples?namespace=endpoints&subject=uuidv4-1' | jq
curl -s 'localhost:4466/relation-tuples?namespace=endpoints' | jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment