apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: return `400` for invalid uri `/hello-_~!*();:@&=+$,/[]` in route

Open idbeta opened this issue 6 years ago • 2 comments

Issue description

I have a strange idea about uri, so I tested it, but it didn't work, pls help me out

$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{
"uri": "/hello-_~!*();:@&=+$,/[]",
 "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}}'
HTTP/1.1 200 OK
... ...

test route

$ curl -i 'http://127.0.0.1:9080/hello-_~%21%2a%28%29%3b%3a%40%26%3d%2b%24%2c/%5b%5d'
HTTP/1.1 404 Not Found
... ...

test the original address

$ curl -i 'http://127.0.0.1:9666/hello-_~%21%2a%28%29%3b%3a%40%26%3d%2b%24%2c/%5b%5d'
HTTP/1.1 200 OK
... ..

Environment

  • apisix version (cmd: apisix version): master
  • OS: macos

idbeta avatar Oct 12 '20 03:10 idbeta

ping @membphis

idbeta avatar Oct 12 '20 10:10 idbeta

"uri": "/hello-_~!*();:@&=+$,/[]",

that is an invalid path for APISIX. the * mainly use for prefix matching.

the admin API should return 400 for this case.

here is the link of the APISIX router: https://github.com/api7/lua-resty-radixtree#prefix-match

membphis avatar Oct 13 '20 01:10 membphis