Index out of range
Davincible opened this issue · comments
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- This issue affects my Ory Network project.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Describe the bug
Index out of range when querying a tuple with wrong params. I used 'subject' instead of 'subject_id'. But would expect a descriptive error instead of a panic.
Reproducing the bug
curl http://127.0.0.1:4466/relation-tuples/check/openapi
Relevant log output
pandora-scraper-keto-1 | time=2023-01-16T11:42:09Z level=info msg=started handling request http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive content-length:102 content-type:application/json postman-token:b49de501-a3b4-4bd2-be66-fe2402cfd41c user-agent:PostmanRuntime/7.30.0] host:127.0.0.1:4466 method:POST path:/relation-tuples/check/openapi query:<nil> remote:172.22.0.1:39130 scheme:http]
pandora-scraper-keto-1 | 2023/01/16 11:42:09 http: panic serving 172.22.0.1:39130: runtime error: index out of range [1] with length 1
pandora-scraper-keto-1 | goroutine 232 [running]:
pandora-scraper-keto-1 | net/http.(*conn).serve.func1()
pandora-scraper-keto-1 | /usr/local/go/src/net/http/server.go:1850 +0xbf
pandora-scraper-keto-1 | panic({0x128cca0, 0xc000e00138})
pandora-scraper-keto-1 | /usr/local/go/src/runtime/panic.go:890 +0x262
pandora-scraper-keto-1 | github.com/ory/keto/internal/relationtuple.(*Mapper).FromTuple.func3()
pandora-scraper-keto-1 | /project/internal/relationtuple/uuid_mapping.go:227 +0x4b
pandora-scraper-keto-1 | github.com/ory/keto/internal/relationtuple.(*success).apply(0x6?)
pandora-scraper-keto-1 | /project/internal/relationtuple/uuid_mapping.go:56 +0x51
pandora-scraper-keto-1 | github.com/ory/keto/internal/relationtuple.(*Mapper).FromTuple(0xc0004825b0, {0x16545d8, 0xc000d8e630}, {0xc000da3098, 0x1, 0x0?})
pandora-scraper-keto-1 | /project/internal/relationtuple/uuid_mapping.go:237 +0xcd8
pandora-scraper-keto-1 | github.com/ory/keto/internal/check.(*Handler).postCheck(0xc0004758f0, {0x16545d8, 0xc000d8e630}, {0x7f3d80d8f9b8?, 0xc000d8e600}, 0x4b1504?)
pandora-scraper-keto-1 | /project/internal/check/handler.go:237 +0x268
pandora-scraper-keto-1 | github.com/ory/keto/internal/check.(*Handler).postCheckNoStatus(0xc0004758f0, {0x7f3d80d8f988, 0xc000014688}, 0xc000110500, {0xc000042af0?, 0x0?, 0xc00038807b?})
pandora-scraper-keto-1 | /project/internal/check/handler.go:185 +0xcc
pandora-scraper-keto-1 | github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc00072e9c0, {0x7f3d80d8f988, 0xc000014688}, 0xc000110500)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387 +0x81c
pandora-scraper-keto-1 | github.com/urfave/negroni.Wrap.func1({0x7f3d80d8f988, 0xc000014688}, 0x11ef940?, 0xc00075e3a0)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x4b
pandora-scraper-keto-1 | github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x11c49e0?, {0x7f3d80d8f988?, 0xc000014688?}, 0xc0001a6c60?, 0x0?)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x33
pandora-scraper-keto-1 | github.com/urfave/negroni.middleware.ServeHTTP({{0x164afa0?, 0xc0001209f0?}, 0xc000120ac8?}, {0x7f3d80d8f988, 0xc000014688}, 0x18?)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0xb6
pandora-scraper-keto-1 | github.com/ory/x/reqlog.(*Middleware).ServeHTTP(0xc0002b21c0, {0x7f3d80d8f988?, 0xc000014688}, 0xc000110500, 0xc00075e380)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/ory/x@v0.0.473/reqlog/middleware.go:134 +0x39d
pandora-scraper-keto-1 | github.com/urfave/negroni.middleware.ServeHTTP({{0x1647b40?, 0xc0002b21c0?}, 0xc000120ab0?}, {0x7f3d80d8f988, 0xc000014688}, 0x0?)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0xb6
pandora-scraper-keto-1 | github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc0002a06f0, {0x1653f20?, 0xc000c98480}, 0x1643440?)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0x125
pandora-scraper-keto-1 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*Handler).ServeHTTP(0xc0006c6000, {0x1652f00?, 0xc000c0e0e0}, 0xc000110000)
pandora-scraper-keto-1 | /go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.35.0/handler.go:204 +0x10b1
pandora-scraper-keto-1 | github.com/ory/x/otelx.TraceHandler.func1({0x1652f00, 0xc000c0e0e0}, 0xc000110000)
pandora-scraper-keto-1 | /go/pkg/mod/github.com/ory/x@v0.0.473/otelx/middleware.go:48 +0x5d
pandora-scraper-keto-1 | net/http.HandlerFunc.ServeHTTP(0x0?, {0x1652f00?, 0xc000c0e0e0?}, 0xa81514?)
pandora-scraper-keto-1 | /usr/local/go/src/net/http/server.go:2109 +0x2f
pandora-scraper-keto-1 | net/http.serverHandler.ServeHTTP({0x164e2a0?}, {0x1652f00, 0xc000c0e0e0}, 0xc000110000)
pandora-scraper-keto-1 | /usr/local/go/src/net/http/server.go:2947 +0x30c
pandora-scraper-keto-1 | net/http.(*conn).serve(0xc000731cc0, {0x16545d8, 0xc00076a840})
pandora-scraper-keto-1 | /usr/local/go/src/net/http/server.go:1991 +0x607
pandora-scraper-keto-1 | created by net/http.(*Server).Serve
pandora-scraper-keto-1 | /usr/local/go/src/net/http/server.go:3102 +0x4db
Relevant configuration
Request:
{
"subject": "User:admin",
"namespace": "Resource",
"object": "pgweb",
"relation": "access"
}
Version
v0.10-alpha.0
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
None
Additional Context
No response