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

bug: APISIX core resources require strict verification and do not need to pass in additional fields. #10229

Closed
9 tasks done
Sn0rt opened this issue Sep 19, 2023 · 0 comments · Fixed by #10233
Closed
9 tasks done

Comments

@Sn0rt
Copy link
Contributor

Sn0rt commented Sep 19, 2023

the original PR #4797

Current Behavior

# curl http://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X POST -d '{
                       "upstream": {
                           "type": "roundrobin",
                           "nodes": {
                               "httpbin.org": 1
                           },
                           "vvv": "ccc"
                       },
                       "uri": "/get"
                   }'
                   
{"key":"/apisix/routes/00000000000000013083","value":{"upstream":{"type":"roundrobin","scheme":"http","pass_host":"pass","nodes":{"httpbin.org":1},"hash_on":"vars","vvv":"ccc"},"id":"00000000000000013083","status":1,"create_time":1694071341,"uri":"/get","update_time":1694071341,"priority":0}}
# etcdctl get /apisix/routes/00000000000000013083

/apisix/routes/00000000000000013083
{"id":"00000000000000013083","priority":0,"update_time":1694071341,"create_time":1694071341,"uri":"/get","status":1,"upstream":{"type":"roundrobin","scheme":"http","pass_host":"pass","nodes":{"httpbin.org":1},"hash_on":"vars","vvv":"ccc"}}

Expected Behavior

No additional fields can be passed in core resources.

Core resources include

  • Consumer
  • Consumer Group
  • Global Rules
  • Plugin
  • Plugin Config
  • Route
  • stream route
  • Service
  • Upstream

Error Logs

N/A

Steps to Reproduce

N/A

Environment

  • APISIX version (run apisix version): master
  • Operating system (run uname -a): ubuntu
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

If the user uses the service discovery function of APISIX such as nacos, the definition of upstream needs to be updated.

--- config
    location /t {
        content_by_lua_block {
            local t = require("lib.test_admin").test
            local code, body = t('/apisix/admin/upstreams',
                 ngx.HTTP_PUT,
                 [[{
                    "id": 1,
                    "nodes": {
                        "127.0.0.1:8080": 1
                    },
                    "type": "roundrobin",
                    "_service_name": "xyz",
                    "_discovery_type": "nacos"
                }]]
            )

            ngx.status = code
            ngx.say(body)
        }
    }
@Sn0rt Sn0rt changed the title bug: bug: APISIX core resources require mandatory verification and do not need to pass in additional fields. Sep 19, 2023
@Sn0rt Sn0rt changed the title bug: APISIX core resources require mandatory verification and do not need to pass in additional fields. bug: APISIX core resources require strict verification and do not need to pass in additional fields. Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant