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

index out of range error for request #212

Closed
bwaz opened this issue Jan 16, 2017 · 1 comment
Closed

index out of range error for request #212

bwaz opened this issue Jan 16, 2017 · 1 comment
Labels

Comments

@bwaz
Copy link

bwaz commented Jan 16, 2017

The parser panics when the "request" parameter is not set to a value.
http://localhost:8181/v1/data?request

2017/01/16 09:28:36 http: panic serving 127.0.0.1:42608: runtime error: index out of range
goroutine 45 [running]:
net/http.(*conn).serve.func1(0xc4201b0380)
/usr/local/go/src/net/http/server.go:1491 +0x12a
panic(0x85a3e0, 0xc42000e110)
/usr/local/go/src/runtime/panic.go:458 +0x243
github.com/open-policy-agent/opa/server.parseRequest(0xc4202be310, 0x1, 0x1, 0x7, 0xc4201b5aa8, 0xf0, 0xc4202de960, 0x0)
/go/src/github.com/open-policy-agent/opa/server/server.go:1074 +0x80a
github.com/open-policy-agent/opa/server.(*Server).v1DataGet(0xc42000ae60, 0xadfce0, 0xc4202b43a0, 0xc4202de960)
/go/src/github.com/open-policy-agent/opa/server/server.go:471 +0x229
github.com/open-policy-agent/opa/server.(*Server).(github.com/open-policy-agent/opa/server.v1DataGet)-fm(0xadfce0, 0xc4202b43a0, 0xc4202de960)
/go/src/github.com/open-policy-agent/opa/server/server.go:310 +0x48
net/http.HandlerFunc.ServeHTTP(0xc420184590, 0xadfce0, 0xc4202b43a0, 0xc4202de960)
/usr/local/go/src/net/http/server.go:1726 +0x44
github.com/open-policy-agent/opa/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc42000aeb0, 0xadfce0, 0xc4202b43a0, 0xc4202de960)
/go/src/github.com/open-policy-agent/opa/vendor/github.com/gorilla/mux/mux.go:114 +0x10d
github.com/open-policy-agent/opa/runtime.(*LoggingHandler).ServeHTTP(0xc420185e50, 0xae05e0, 0xc4201bc1a0, 0xc4202de780)
/go/src/github.com/open-policy-agent/opa/runtime/logging.go:30 +0xf8
net/http.serverHandler.ServeHTTP(0xc42001b700, 0xae05e0, 0xc4201bc1a0, 0xc4202de780)
/usr/local/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc4201b0380, 0xae0da0, 0xc4202b8280)
/usr/local/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2293 +0x44d
2017/01/16 09:28:36 http: panic serving 127.0.0.1:42610: runtime error: index out of range
goroutine 46 [running]:
net/http.(*conn).serve.func1(0xc4201b0480)
/usr/local/go/src/net/http/server.go:1491 +0x12a
panic(0x85a3e0, 0xc42000e110)

@tsandall
Copy link
Member

Oops! parseRequest should check for empty strings. Should be an easy fix.

@tsandall tsandall added the bug label Jan 16, 2017
tsandall added a commit to tsandall/opa that referenced this issue Jan 17, 2017
Return an error if the request parameter is empty. This indicates an error in
the caller.

Fixes open-policy-agent#212
tsandall added a commit that referenced this issue Jan 17, 2017
Return an error if the request parameter is empty. This indicates an error in
the caller.

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

No branches or pull requests

2 participants