apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: admin api matches config ID by prefix

Open Gary-Airwallex opened this issue 6 years ago • 2 comments

Issue description

Admin api appears to match config Id by prefix instead of an exact string match.

Environment

  • apisix version (cmd: apisix version): 2.0
  • OS: osx + linux

Minimal test code / Steps to reproduce the issue

  1. PUT a new upstream with id: abc
  2. GET upstream by id: ab

What's the actual result? (including assertion message & call stack if applicable)

The upstream abc is returned.

What's the expected result?

A NOT_FOUND is expected here

Gary-Airwallex avatar Nov 17 '20 03:11 Gary-Airwallex

It's very critical, should take priority to fix this.

Suppose this case:

  1. Put a upstream with id foobar.
  2. Put a route which refers to upstream foo.
  3. Instead of reporting an error that the second step refers to a non-exist upstream, the route is put successfully with upstream foobar.

JanLi-air avatar Nov 17 '20 03:11 JanLi-air

It is indeed a problem, thanks for the feedback.

idbeta avatar Nov 17 '20 04:11 idbeta