[GitHub] [apisix] membphis closed issue #2238: chore: bump `lua-resty-etcd` to version 1.2
membphis closed issue #2238: URL: https://github.com/apache/apisix/issues/2238 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: chore: bump `lua-resty-etcd` to version 1.2 (#2242)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 9d1a210 chore: bump `lua-resty-etcd` to version 1.2 (#2242) 9d1a210 is described below commit 9d1a210413944b8aef0492c67ddfd77cc57a5be2 Author: Shuyang Wu AuthorDate: Thu Sep 17 13:15:52 2020 +0800 chore: bump `lua-resty-etcd` to version 1.2 (#2242) fix #2238 --- rockspec/apisix-master-0.rockspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index 5a32099..b88a3c7 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -32,7 +32,7 @@ description = { dependencies = { "lua-resty-template = 1.9", -"lua-resty-etcd = 1.1", +"lua-resty-etcd = 1.2", "lua-resty-balancer = 0.02rc5", "lua-resty-ngxvar = 0.5", "lua-resty-jit-uuid = 0.0.7",
[GitHub] [apisix] membphis commented on pull request #2242: fix: bump lua-resty-etcd to 1.2
membphis commented on pull request #2242: URL: https://github.com/apache/apisix/pull/2242#issuecomment-693875655 @Yiyiyimu merged, many thx This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis merged pull request #2242: fix: bump lua-resty-etcd to 1.2
membphis merged pull request #2242: URL: https://github.com/apache/apisix/pull/2242 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2215: Used TscanCode scan the lua code,it report two code defects
spacewander commented on issue #2215: URL: https://github.com/apache/apisix/issues/2215#issuecomment-693797594 > [radixtree_router] is used after check at line 147 Look like it is a false positive. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2241: draft: `consumer` provides access to a collection of `service`
membphis commented on a change in pull request #2241: URL: https://github.com/apache/apisix/pull/2241#discussion_r489949071 ## File path: apisix/plugins/consumer-restriction.lua ## @@ -29,11 +34,12 @@ local schema = { type = "array", items = {type = "string"}, minItems = 1 -} +}, +rejected_code = {type = "integer", minimum = 200, default = 401} }, oneOf = { -{required = {"whitelist"}}, -{required = {"blacklist"}} +{required = {"whitelist", "type"}}, Review comment: `"type"` should be optional, because we have set a default value for it ## File path: apisix/plugins/consumer-restriction.lua ## @@ -20,6 +20,11 @@ local core = require("apisix.core") local schema = { type = "object", properties = { +type = { +type = "string", +enum = {"consumer", "service"}, Review comment: `consumer_name`, `service_id` is better ## File path: apisix/plugins/consumer-restriction.lua ## @@ -67,26 +83,30 @@ function _M.check_schema(conf) return true end + function _M.access(conf, ctx) -if not ctx.consumer then +if not conf.type then return 401, { message = "Missing authentication or identity verification." } end +local type_id = type_funcs[conf.type](ctx) +core.log.warn("type_id: ", type_id) Review comment: If this log is only useful to developers, we cannot use the "warning" log level here. ## File path: apisix/plugins/consumer-restriction.lua ## @@ -67,26 +83,30 @@ function _M.check_schema(conf) return true end + function _M.access(conf, ctx) -if not ctx.consumer then +if not conf.type then return 401, { message = "Missing authentication or identity verification." } end +local type_id = type_funcs[conf.type](ctx) Review comment: `type_id` is not a good name, and the `type_id` maybe a `nil` value. we need to check it first. ## File path: apisix/plugins/consumer-restriction.lua ## @@ -29,11 +33,12 @@ local schema = { type = "array", items = {type = "string"}, minItems = 1 -} +}, +rejected_code = {type = "integer", minimum = 200, default = 503} }, oneOf = { -{required = {"whitelist"}}, -{required = {"blacklist"}} +{required = {"whitelist", "types_of"}}, Review comment: "types_of" is optional ## File path: apisix/plugins/consumer-restriction.lua ## @@ -48,6 +54,15 @@ local _M = { schema = schema, } +local type_funcs = { +["serviec"] = function(ctx) Review comment: typo ## File path: apisix/plugins/consumer-restriction.lua ## @@ -20,6 +20,11 @@ local core = require("apisix.core") local schema = { type = "object", properties = { +type = { +type = "string", +enum = {"consumer", "service"}, +default = "service" Review comment: the default value should be `consumer_name`, keep the same as the old way. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #2239: feat: `hmac-auth` add signed headers to calculate signature
membphis commented on pull request #2239: URL: https://github.com/apache/apisix/pull/2239#issuecomment-693793335 @nic-chen you should update the doc, we can confirm the doc first This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis closed pull request #2243: [WIP] CI failed, have to confirm it online
membphis closed pull request #2243: URL: https://github.com/apache/apisix/pull/2243 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new pull request #2243: CI failed, have to confirm it online
membphis opened a new pull request #2243: URL: https://github.com/apache/apisix/pull/2243 ### What this PR does / why we need it: as title ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2239: feat: `hmac-auth` add signed headers to calculate signature
membphis commented on a change in pull request #2239: URL: https://github.com/apache/apisix/pull/2239#discussion_r489913483 ## File path: apisix/plugins/hmac-auth.lua ## @@ -182,13 +201,25 @@ local function generate_signature(ctx, secret_key, params) canonical_query_string = core.table.concat(query_tab, "&") end -local req_body = core.request.get_body() -req_body = req_body or "" +local canonical_headers = "" + +core.log.info("all headers: ", core.json.encode(core.request.headers(), true)) Review comment: `core.request.headers(ctx)` we should pass the `ctx` for better performance ## File path: apisix/plugins/hmac-auth.lua ## @@ -182,13 +201,25 @@ local function generate_signature(ctx, secret_key, params) canonical_query_string = core.table.concat(query_tab, "&") end -local req_body = core.request.get_body() -req_body = req_body or "" +local canonical_headers = "" + +core.log.info("all headers: ", core.json.encode(core.request.headers(), true)) + +for _, h in pairs(params.signed_headers) do +canonical_headers = canonical_headers .. (core.request.header(ctx, h) or "") +core.log.info("canonical_headers:", canonical_headers, +" header:", core.json.encode(h), Review comment: bad indentation ## File path: apisix/plugins/hmac-auth.lua ## @@ -182,13 +201,25 @@ local function generate_signature(ctx, secret_key, params) canonical_query_string = core.table.concat(query_tab, "&") end -local req_body = core.request.get_body() -req_body = req_body or "" +local canonical_headers = "" + +core.log.info("all headers: ", core.json.encode(core.request.headers(), true)) + +for _, h in pairs(params.signed_headers) do +canonical_headers = canonical_headers .. (core.request.header(ctx, h) or "") Review comment: `canonical_headers` can be an array object, then we can use `table.insert` and `table.concat` way, which is better performance ## File path: apisix/plugins/hmac-auth.lua ## @@ -182,13 +201,25 @@ local function generate_signature(ctx, secret_key, params) canonical_query_string = core.table.concat(query_tab, "&") end -local req_body = core.request.get_body() -req_body = req_body or "" +local canonical_headers = "" + +core.log.info("all headers: ", core.json.encode(core.request.headers(), true)) + +for _, h in pairs(params.signed_headers) do Review comment: I think we should use `ipairs` here ## File path: apisix/plugins/hmac-auth.lua ## @@ -264,18 +310,22 @@ local function get_params(ctx) local auth_data = ngx_re.split(auth_string, "#") core.log.info("auth_string: ", auth_string, " #auth_data: ", #auth_data, " auth_data: ", core.json.delay_encode(auth_data)) -if #auth_data == 5 and auth_data[1] == "hmac-auth-v1" then +if #auth_data == 6 and auth_data[1] == "hmac-auth-v2" then ak = auth_data[2] signature = auth_data[3] algorithm = auth_data[4] timestamp = auth_data[5] +signed_headers = auth_data[6] end end params.access_key = ak params.algorithm = algorithm params.signature = signature params.timestamp = timestamp or 0 +params.signed_headers = ngx_re.split(signed_headers or "", ";") Review comment: if the `signed_headers` is `nil`, I think `params.signed_headers` is `nil`. it is an optional field. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] juzhiyuan commented on a change in pull request #1947: feature: add wechat pay signature plugin
juzhiyuan commented on a change in pull request #1947: URL: https://github.com/apache/apisix/pull/1947#discussion_r489886319 ## File path: apisix/plugins/signature.lua ## @@ -0,0 +1,214 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local core = require("apisix.core") +local redis_new = require("resty.redis").new +local ngx = ngx +local md5 = ngx.md5 +local encode_args = ngx.encode_args +local tonumber = tonumber +local plugin_name = "signature" + +local schema = { +type = "object", +properties = { +appkey = {type = "string",minLength = 5,maxLength = 32,pattern = [[^[a-zA-Z0-9_-]{5,32}$]]}, +secret = {type = "string",minLength = 1}, +algorithm = { +type = "string", +enum = {"md5"}, +default = "md5" +}, +timeout = {type = "integer", minimum = 10, default = 10}, +anti_reply = { +type = "boolean", +default = true +}, +policy = { +type = "string", +enum = {"redis"}, +default = "redis" +}, +redis_host = { Review comment: Please take a look at https://github.com/apache/apisix/blob/master/apisix/plugins/limit-count.lua#L59-L77 , your codes look good to me, but I would prefer using dependencies. ## File path: apisix/plugins/signature.lua ## @@ -0,0 +1,214 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local core = require("apisix.core") +local redis_new = require("resty.redis").new +local ngx = ngx +local md5 = ngx.md5 +local encode_args = ngx.encode_args +local tonumber = tonumber +local plugin_name = "signature" + +local schema = { +type = "object", +properties = { +appkey = {type = "string",minLength = 5,maxLength = 32,pattern = [[^[a-zA-Z0-9_-]{5,32}$]]}, +secret = {type = "string",minLength = 1}, +algorithm = { +type = "string", +enum = {"md5"}, +default = "md5" +}, +timeout = {type = "integer", minimum = 10, default = 10}, +anti_reply = { +type = "boolean", +default = true +}, +policy = { +type = "string", +enum = {"redis"}, +default = "redis" +}, +redis_host = { +type = "string", minLength = 2, default = "127.0.0.1" +}, +redis_port = { +type = "integer", minimum = 1, default = 6379 +}, +redis_password = { +type = "string", minLength = 0, default="" +}, +redis_timeout = { +type = "integer", minimum = 1 +}, +redis_keepalive = { +type = "integer", minimum = 10 +}, +redis_poolsize = { +type = "integer", minimum = 100 +}, +}, +required = {"appkey", "secret", "timeout", "algorithm"} +} + +local _M = { +version = 0.1, +priority = 2513, +type = 'auth', +name = plugin_name, +schema = schema, +} + +function _M.check_schema(conf) +local ok, err = core.schema.check(schema, conf) +if not ok then +return false, err +end + +if not conf.algorithm then Review comment: From codes above, `conf.algorithm` will always exist here I think? ## File path: apisix/plugins/signature.lua ## @@ -0,0 +1,214 @@ +-- +-- Licensed to the Apache Software
[GitHub] [apisix] nic-chen commented on a change in pull request #2239: feat: `hmac-auth` add signed headers to calculate signature
nic-chen commented on a change in pull request #2239: URL: https://github.com/apache/apisix/pull/2239#discussion_r489911418 ## File path: apisix/plugins/hmac-auth.lua ## @@ -52,16 +58,19 @@ local schema = { clock_skew = { type = "integer", default = 300 -} +}, +signed_headers = { +type = "array", +items = { +type = "string", +minLength = 1, +maxLength = 20, Review comment: ok This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gxthrj commented on a change in pull request #2239: feat: `hmac-auth` add signed headers to calculate signature
gxthrj commented on a change in pull request #2239: URL: https://github.com/apache/apisix/pull/2239#discussion_r489908479 ## File path: apisix/plugins/hmac-auth.lua ## @@ -52,16 +58,19 @@ local schema = { clock_skew = { type = "integer", default = 300 -} +}, +signed_headers = { +type = "array", +items = { +type = "string", +minLength = 1, +maxLength = 20, Review comment: The maxLength of 20 is not enough, how about 50? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #2241: draft: `consumer` provides access to a collection of `service`
Firstsawyou commented on a change in pull request #2241: URL: https://github.com/apache/apisix/pull/2241#discussion_r489903558 ## File path: apisix/plugins/consumer-restriction.lua ## @@ -20,6 +20,10 @@ local core = require("apisix.core") local schema = { type = "object", properties = { +types_of = { Review comment: ok. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2241: draft: `consumer` provides access to a collection of `service`
membphis commented on a change in pull request #2241: URL: https://github.com/apache/apisix/pull/2241#discussion_r489899670 ## File path: apisix/plugins/consumer-restriction.lua ## @@ -20,6 +20,10 @@ local core = require("apisix.core") local schema = { type = "object", properties = { +types_of = { Review comment: `type` is enough This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2241: draft: `consumer` provides access to a collection of `service`
membphis commented on a change in pull request #2241: URL: https://github.com/apache/apisix/pull/2241#discussion_r489899205 ## File path: apisix/plugins/consumer-restriction.lua ## @@ -20,6 +20,10 @@ local core = require("apisix.core") local schema = { type = "object", properties = { +types_of = { +type = "string", +enum = {"consumer", "service"} Review comment: need `default` value This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers commented on pull request #2179: URL: https://github.com/apache/apisix/pull/2179#issuecomment-693767787 > do we need to add some new test cases? Will supply some test cases. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #477: fix: host should not be required
juzhiyuan commented on a change in pull request #477: URL: https://github.com/apache/apisix-dashboard/pull/477#discussion_r489881967 ## File path: src/pages/Route/components/Step1/RequestConfigView.tsx ## @@ -47,7 +47,6 @@ const RequestConfigView: React.FC = ({ data, disabled, onChange }) => {
[GitHub] [apisix-dashboard] juzhiyuan closed issue #458: bug: When creating a route, host should not be required
juzhiyuan closed issue #458: URL: https://github.com/apache/apisix-dashboard/issues/458 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix-dashboard] branch master updated: fix: host should not be required (#479)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new 5b24ece fix: host should not be required (#479) 5b24ece is described below commit 5b24ecec1ffa4df32bd635edfa0ef9da6ef01c4f Author: litesun <7sunm...@gmail.com> AuthorDate: Thu Sep 17 09:44:30 2020 +0800 fix: host should not be required (#479) * fix: host should not be required * feat: remove required rule --- src/pages/Route/components/Step1/RequestConfigView.tsx | 5 - 1 file changed, 5 deletions(-) diff --git a/src/pages/Route/components/Step1/RequestConfigView.tsx b/src/pages/Route/components/Step1/RequestConfigView.tsx index 6037ada..93481a6 100644 --- a/src/pages/Route/components/Step1/RequestConfigView.tsx +++ b/src/pages/Route/components/Step1/RequestConfigView.tsx @@ -57,11 +57,6 @@ const RequestConfigView: React.FC = ({ data, disabled, onChange }) => { validateTrigger={['onChange', 'onBlur']} rules={[ { - required: true, - whitespace: true, - message: formatMessage({ id: 'route.request.config.input.domain.name' }), -}, -{ pattern: new RegExp(/(^\*?[a-zA-Z0-9._-]+$|^\*$)/, 'g'), message: formatMessage({ id: 'route.request.config.domain.name.rule' }), },
[GitHub] [apisix-dashboard] juzhiyuan merged pull request #479: fix: host should not be required
juzhiyuan merged pull request #479: URL: https://github.com/apache/apisix-dashboard/pull/479 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming merged pull request #2168: bugfix: clear all cached object when got `delete` action, and removing stale boolean data in table `self.values` with a safer way
moonming merged pull request #2168: URL: https://github.com/apache/apisix/pull/2168 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: bugfix: clear all cached object when got `delete` action, and removing (#2168)
This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 68b1f9c bugfix: clear all cached object when got `delete` action, and removing (#2168) 68b1f9c is described below commit 68b1f9cc57c3320ff814859ce66f4cfd401e10ae Author: YuanSheng Wang AuthorDate: Thu Sep 17 09:30:44 2020 +0800 bugfix: clear all cached object when got `delete` action, and removing (#2168) stale boolean data in table `self.values` with a safer way. --- apisix/core/config_etcd.lua | 25 ++ t/node/route-delete.t | 109 2 files changed, 126 insertions(+), 8 deletions(-) diff --git a/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua index b651ea9..d058277 100644 --- a/apisix/core/config_etcd.lua +++ b/apisix/core/config_etcd.lua @@ -14,6 +14,8 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- + +local table= require("apisix.core.table") local config_local = require("apisix.core.config_local") local log = require("apisix.core.log") local json = require("apisix.core.json") @@ -338,10 +340,13 @@ local function sync_data(self) res.value.id = key self.values[pre_index] = res res.clean_handlers = {} +log.info("update data by key: ", key) else self.sync_times = self.sync_times + 1 self.values[pre_index] = false +self.values_hash[key] = nil +log.info("delete data by key: ", key) end elseif res.value then @@ -349,25 +354,29 @@ local function sync_data(self) insert_tab(self.values, res) self.values_hash[key] = #self.values res.value.id = key +log.info("insert data by key: ", key) end -- avoid space waste --- todo: need to cover this path, it is important. if self.sync_times > 100 then -local count = 0 -for i = 1, #self.values do -local val = self.values[i] -self.values[i] = nil +local values_original = table.clone(self.values) +table.clear(self.values) + +for i = 1, #values_original do +local val = values_original[i] if val then -count = count + 1 -self.values[count] = val +table.insert(self.values, val) end end -for i = 1, count do +table.clear(self.values_hash) +log.info("clear stale data in `values_hash` for key: ", key) + +for i = 1, #self.values do key = short_key(self, self.values[i].key) self.values_hash[key] = i end + self.sync_times = 0 end diff --git a/t/node/route-delete.t b/t/node/route-delete.t new file mode 100644 index 000..298 --- /dev/null +++ b/t/node/route-delete.t @@ -0,0 +1,109 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +use t::APISIX 'no_plan'; + +repeat_each(2); +log_level('info'); +worker_connections(256); +no_root_location(); +no_shuffle(); + +run_tests(); + +__DATA__ + +=== TEST 1: create 130 routes + delete them +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test + +for i = 1, 130 do +local code, body = t('/apisix/admin/routes/' .. i, +ngx.HTTP_PUT, +[[{ +"upstream": { +"nodes": { +"127.0.0.1:1980": 1 +}, +"type": "roundrobin" +}, +"uri": "/hello]] .. i .. [[" +}]] +) +end + +for i = 1, 130 do +local code, body =
[GitHub] [apisix-dashboard] LiteSun opened a new pull request #479: fix: host should not be required
LiteSun opened a new pull request #479: URL: https://github.com/apache/apisix-dashboard/pull/479 Please answer these questions before submitting a pull request - Why submit this pull request? - [x] Bug fix - [ ] New feature provided - [ ] Improve performance - Related issues ___ ### Bugfix - Description - How to fix? ___ ### New feature or improvement - Describe the details and related test reports. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu opened a new pull request #2242: fix: bump lua-resty-etcd to 1.2
Yiyiyimu opened a new pull request #2242: URL: https://github.com/apache/apisix/pull/2242 ### What this PR does / why we need it: update lua-resty-etcd version to remove the unnecessary log in etcd v3 ### Pre-submission checklist: * [x] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [x] Is this PR backward compatible? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] dotSlashLu edited a comment on pull request #2222: fix: return ok in kafka-logger
dotSlashLu edited a comment on pull request #: URL: https://github.com/apache/apisix/pull/#issuecomment-693730801 @ShiningRush thanks for your guide. You are right about why the error message was missed before, such a short waiting time will cover all kinds of error messages including kafka timeout and topic missing. I've increased the waiting time and also the `batch_max_size` and `timeout` in kafka-logger setups to expose errors more quickly if there are any. Now the reproduce is stable. Before the change: ``` # Failed test 'TEST 5: access - pattern "[error]" should not match any line in error.log but matches line "2020/09/17 07:59:38 [error] 2386#0: *20 [lua] batch-processor.lua:61: Batch Processor[kafka logger] failed to process entries: nil, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:1984" (req 0) # ' # at /usr/local/share/perl/5.28.1/Test/Nginx/Socket.pm line 1280. # Failed test 'TEST 5: access - pattern "[error]" should not match any line in error.log but matches line "2020/09/17 07:59:38 [error] 2386#0: *20 [lua] batch-processor.lua:68: Batch Processor[kafka logger] exceeded the max_retry_count[1] dropping the entries, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:1984" (req 0) # ' # at /usr/local/share/perl/5.28.1/Test/Nginx/Socket.pm line 1280. ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on pull request #2230: bug: removed default access token for Admin API
moonming commented on pull request #2230: URL: https://github.com/apache/apisix/pull/2230#issuecomment-693734871 In this pr, we only need to modify one file, and only need to make one change, which is to print a warning when the Admin IP is not 127.0.0.1 and using default token This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on issue #2238: chore: bump `lua-resty-etcd` to version 1.2
Yiyiyimu commented on issue #2238: URL: https://github.com/apache/apisix/issues/2238#issuecomment-693732896 Sure thx! This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] dotSlashLu commented on pull request #2222: fix: return ok in kafka-logger
dotSlashLu commented on pull request #: URL: https://github.com/apache/apisix/pull/#issuecomment-693730801 @ShiningRush thanks for your guide. You are right about why the error message was missed before, such a short waiting time will cover all kinds of error messages including kafka timeout and topic missing. I've increased the waiting time and also the `batch_max_size`, `batch_max_size` in kafka-logger setups to expose errors more quickly if there are any. Now the reproduce is stable. Before the change: ``` # Failed test 'TEST 5: access - pattern "[error]" should not match any line in error.log but matches line "2020/09/17 07:59:38 [error] 2386#0: *20 [lua] batch-processor.lua:61: Batch Processor[kafka logger] failed to process entries: nil, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:1984" (req 0) # ' # at /usr/local/share/perl/5.28.1/Test/Nginx/Socket.pm line 1280. # Failed test 'TEST 5: access - pattern "[error]" should not match any line in error.log but matches line "2020/09/17 07:59:38 [error] 2386#0: *20 [lua] batch-processor.lua:68: Batch Processor[kafka logger] exceeded the max_retry_count[1] dropping the entries, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:1984" (req 0) # ' # at /usr/local/share/perl/5.28.1/Test/Nginx/Socket.pm line 1280. ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #477: fix: host should not be required
juzhiyuan commented on pull request #477: URL: https://github.com/apache/apisix-dashboard/pull/477#issuecomment-693564981 ping @LiteSun This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on pull request #2036: feature: support etcd v3, by mocking v2 API
Yiyiyimu commented on pull request #2036: URL: https://github.com/apache/apisix/pull/2036#issuecomment-693536211 TODO: we need to add doc for etcd migration This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #477: fix: host should not be required
liuxiran commented on a change in pull request #477: URL: https://github.com/apache/apisix-dashboard/pull/477#discussion_r489585799 ## File path: src/pages/Route/components/Step1/RequestConfigView.tsx ## @@ -47,7 +47,6 @@ const RequestConfigView: React.FC = ({ data, disabled, onChange }) => {
[GitHub] [apisix] Firstsawyou opened a new pull request #2241: draft: `consumer` provides access to a collection of `service`
Firstsawyou opened a new pull request #2241: URL: https://github.com/apache/apisix/pull/2241 ### What this PR does / why we need it: The `consumer` provides access to the `service` collection . Put it in the "consumer-restriction" plug-in to achieve, by adding the "schema" field of this plug-in, to control the access of "consumer" and "service". ### Pre-submission checklist: * [x] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on pull request #2236: draft: `consumer` provides access to a collection of `service`
Firstsawyou commented on pull request #2236: URL: https://github.com/apache/apisix/pull/2236#issuecomment-693487383 This `pr` was created incorrectly. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou closed pull request #2236: draft: `consumer` provides access to a collection of `service`
Firstsawyou closed pull request #2236: URL: https://github.com/apache/apisix/pull/2236 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on pull request #2236: draft: `consumer` provides access to a collection of `service`
Firstsawyou commented on pull request #2236: URL: https://github.com/apache/apisix/pull/2236#issuecomment-693486412 > What this PR does? Can you show some examples? This `pr` was created incorrectly, I will recreate one and explain the reason. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #434: Requirements for refactoring the Dashboard with Manager API
juzhiyuan commented on issue #434: URL: https://github.com/apache/apisix-dashboard/issues/434#issuecomment-693483449 - [ ] Refactor APIs about Route, Upstream, etc. Both backend and frontend. - [ ] Uniform the Error Codes both on backend and frontend. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan edited a comment on issue #434: Requirements for refactoring the Dashboard with Manager API
juzhiyuan edited a comment on issue #434: URL: https://github.com/apache/apisix-dashboard/issues/434#issuecomment-693483449 TODO according to today's meeting. - [ ] Refactor APIs about Route, Upstream, etc. Both backend and frontend. - [ ] Update the Error Codes both on the backend and frontend. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #471: Proposal: Service
juzhiyuan commented on issue #471: URL: https://github.com/apache/apisix-dashboard/issues/471#issuecomment-693482289 > Allow users to directly fill in the upstream address, we can support this feature later. Just to make sure, does this mean users could fill in the Upstream Form manually instead of choosing a existing one? This will be implemented in the Upstream Form :D This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #2230: bug: removed default access token for Admin API
membphis commented on pull request #2230: URL: https://github.com/apache/apisix/pull/2230#issuecomment-693481591 > I don't think so, `YOUR_OWN_API_TOKEN` is good as hint, not the real token. > we can keep the current token you are right. the current way, if the APISIX starts with the default Admin API Key, we'll show a WARNING message. and I updated the default token to a different one. ``` $ ./bin/apisix start WARNING: using the default Key is very dangerous. You can call `./bin/apisix gen_admin_key` to generate a new Admin API key or manually update the `conf/config.yaml` file. ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489500949 ## File path: t/admin/routes.t ## @@ -1557,8 +1557,7 @@ location /t { ngx.say("code: ", code) ngx.say(body) --- etcd v3 would still get the value at 2s, don't know why yet -ngx.sleep(2.5) +ngx.sleep(2) Review comment: please revert them This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new issue #2240: BUG: need to call `os.exit(false)`
membphis opened a new issue #2240: URL: https://github.com/apache/apisix/issues/2240 Calls the ISO C function exit to terminate the CLI program. for example: https://github.com/apache/apisix/blob/master/bin/apisix#L77 https://github.com/apache/apisix/blob/master/bin/apisix#L902 https://github.com/apache/apisix/blob/master/bin/apisix#L908 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on pull request #2236: draft: `consumer` provides access to a collection of `service`
moonming commented on pull request #2236: URL: https://github.com/apache/apisix/pull/2236#issuecomment-693453228 What this PR does? Can you show some examples? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489481394 ## File path: t/admin/routes.t ## @@ -1611,7 +1610,7 @@ location /t { end ngx.say("[push] succ: ", body) -ngx.sleep(2.5) +ngx.sleep(2) Review comment: ditto ## File path: t/admin/routes.t ## @@ -1557,8 +1557,7 @@ location /t { ngx.say("code: ", code) ngx.say(body) --- etcd v3 would still get the value at 2s, don't know why yet -ngx.sleep(2.5) +ngx.sleep(2) Review comment: why change this? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on issue #2238: chore: bump `lua-resty-etcd` to version 1.2
membphis commented on issue #2238: URL: https://github.com/apache/apisix/issues/2238#issuecomment-693438111 @Yiyiyimu would you like to fix this issue? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new issue #2238: chore: bump `lua-resty-etcd` to version 1.2
membphis opened a new issue #2238: URL: https://github.com/apache/apisix/issues/2238 https://luarocks.org/modules/membphis/lua-resty-etcd/1.2-0 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #2036: feature: support etcd v3, by mocking v2 API
membphis commented on pull request #2036: URL: https://github.com/apache/apisix/pull/2036#issuecomment-693429050 @Yiyiyimu you can create a new Github issue if you find some other things. this PR has been merged, we should use the new issue to resolve the problem. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on pull request #2036: feature: support etcd v3, by mocking v2 API
Yiyiyimu commented on pull request #2036: URL: https://github.com/apache/apisix/pull/2036#issuecomment-693426643 > we could optimize it in another pr @nic-chen I think we need to release a newer version of lua-resty-etcd, since the current version would output TONS of logs. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #469: Feature: debug a route online
membphis commented on issue #469: URL: https://github.com/apache/apisix-dashboard/issues/469#issuecomment-693426115 After researching, the test request does not require any specific request headers. On the dashboard, it directly simulates the user's request. Very good function, look forward to. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on pull request #1943: feature: support etcd v3
Yiyiyimu commented on pull request #1943: URL: https://github.com/apache/apisix/pull/1943#issuecomment-693425041 Close since #2036 is merged This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu closed pull request #1943: feature: support etcd v3
Yiyiyimu closed pull request #1943: URL: https://github.com/apache/apisix/pull/1943 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2036: feature: support etcd v3, by mocking v2 API
Yiyiyimu commented on a change in pull request #2036: URL: https://github.com/apache/apisix/pull/2036#discussion_r489460767 ## File path: bin/apisix ## @@ -879,35 +887,35 @@ local function init_etcd(show_output) local host_count = #(yaml_conf.etcd.host) --- check whether the user has enabled etcd v2 protocol +local etcd_ok = false for index, host in ipairs(yaml_conf.etcd.host) do -uri = host .. "/v2/keys" -local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w %{http_code} " .. uri +-- check if etcd version above 3.4 +cmd = "curl " .. host .. "/version 2>&1" local res = excute_cmd(cmd) -if res == "404" then -io.stderr:write(string.format("failed: please make sure that you have enabled the v2 protocol of etcd on %s.\n", host)) +local op_ver = str_split(res, "\"")[4] +local need_ver = "3.4.0" +if not check_version(op_ver, need_ver) then +io.stderr:write("etcd version must >=", need_ver, " current ", op_ver, "\n") return end -end - -local etcd_ok = false -for index, host in ipairs(yaml_conf.etcd.host) do local is_success = true -uri = host .. "/v2/keys" .. (etcd_conf.prefix or "") for _, dir_name in ipairs({"/routes", "/upstreams", "/services", "/plugins", "/consumers", "/node_status", "/ssl", "/global_rules", "/stream_routes", "/proto"}) do -local cmd = "curl " .. uri .. dir_name -.. "?prev_exist=false -X PUT -d dir=true " -.. "--connect-timeout " .. timeout +local key = (etcd_conf.prefix or "") .. dir_name .. "/" + +local base64_encode = require("base64").encode +local uri = host .. "/v3/kv/put" +local post_json = '{"value":"' .. base64_encode("init_dir") .. '", "key":"' .. base64_encode(key) .. '"}' +cmd = "curl " .. uri .. " -X POST -d '" .. post_json +.. "' --connect-timeout " .. timeout .. " --max-time " .. timeout * 2 .. " --retry 1 2>&1" local res = excute_cmd(cmd) -if not res:find("index", 1, true) -and not res:find("createdIndex", 1, true) then +if (etcd_version == "v3" and not res:find("OK", 1, true)) then Review comment: fix by #2233 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on pull request #2233: change: check etcd cluster version when init_etcd
Yiyiyimu commented on pull request #2233: URL: https://github.com/apache/apisix/pull/2233#issuecomment-693424234 @tokers Thank you for the fix! This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
Firstsawyou commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489452597 ## File path: t/admin/routes.t ## @@ -2180,3 +2180,65 @@ GET /t --- error_code: 400 --- no_error_log [error] + + + +=== TEST 60: set empty service. (id: 1)(allow empty `service` object) Review comment: ok. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489452341 ## File path: t/admin/routes.t ## @@ -2180,3 +2180,65 @@ GET /t --- error_code: 400 --- no_error_log [error] + + + +=== TEST 60: set empty service. (id: 1)(allow empty `service` object) +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/services/1', +ngx.HTTP_PUT, +{}, +[[{ +"node": { +"value": {"id":"1"} +}, +"action": "set" +}]] +) + +ngx.status = code +ngx.say(body) +} +} +--- request +GET /t +--- response_body +passed +--- no_error_log +[error] + + + +=== TEST 61: route binding empty service +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/routes/1', +ngx.HTTP_PUT, +[[{ +"methods": ["GET"], +"upstream": { +"nodes": { +"127.0.0.1:8080": 1 Review comment: take a look at: https://github.com/apache/apisix/blob/master/t/node/route-domain.t#L96 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489451763 ## File path: t/admin/routes.t ## @@ -2180,3 +2180,65 @@ GET /t --- error_code: 400 --- no_error_log [error] + + + +=== TEST 60: set empty service. (id: 1)(allow empty `service` object) +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/services/1', +ngx.HTTP_PUT, +{}, +[[{ +"node": { +"value": {"id":"1"} +}, +"action": "set" +}]] +) + +ngx.status = code +ngx.say(body) +} +} +--- request +GET /t +--- response_body +passed +--- no_error_log +[error] + + + +=== TEST 61: route binding empty service +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/routes/1', +ngx.HTTP_PUT, +[[{ +"methods": ["GET"], +"upstream": { +"nodes": { +"127.0.0.1:8080": 1 Review comment: why `8080`? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489450650 ## File path: t/admin/routes.t ## @@ -2180,3 +2180,65 @@ GET /t --- error_code: 400 --- no_error_log [error] + + + +=== TEST 60: set empty service. (id: 1)(allow empty `service` object) Review comment: we can not do `E2E` test in folder `t/admin/*`. please move those test case to `t/node/`, `service-empty.t` is a good test file name. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] GBXing commented on issue #2175: bug: kafka-logger plugin comes with exception logs
GBXing commented on issue #2175: URL: https://github.com/apache/apisix/issues/2175#issuecomment-693355770 @moonming Setting max_retry_count to 2 still generates an exception log, and the log is sent three times This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new issue #2237: test(hmac-auth): unstable test case
membphis opened a new issue #2237: URL: https://github.com/apache/apisix/issues/2237 ``` # Failed test 'TEST 13: verify: invalid signature - response_body - response is expected (repeated req 0, req 0)' # at /home/runner/work/apisix/apisix/test-nginx/lib/Test/Nginx/Socket.pm line 1589. # got: '{"message":"Missing related consumer"} # ' # expected: '{"message":"Invalid signature"} # ' # Looks like you failed 1 test of 108. t/plugin/hmac-auth.t . Dubious, test returned 1 (wstat 256, 0x100) Failed 1/108 subtests This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 edited a comment on issue #478: What is the default account password of the dashboard?
bzp2010 edited a comment on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693335842 @Caelebs It seems that the Manager API is not using the latest version. Can you try to update it? Explanation: in the previous update, the login API was adjusted from `/user/login` to `/apisix/admin/user/login`, and the frontend code of the dashboard was also updated synchronously. However, in previous versions, API requests prefixed with `/apifix/admin` would be filtered through the filter, and the error request would be returned to HTTP 401. 看起来原因可能是Manager API没有使用最新版本,可以尝试进行更新吗? 解释:登录API在之前的更新中由 `/user/login` 调整至 `/apisix/admin/user/login` ,dashboard前端代码也同步进行了更新,然而在之前的版本以 `/apifix/admin` 前缀的API请求会经由filter进行过滤,并对错误请求返回HTTP 401,可能在这个过程中导致了你出现的错误。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] codjust commented on issue #2151: feature: Best practice for jaeger
codjust commented on issue #2151: URL: https://github.com/apache/apisix/issues/2151#issuecomment-693349312 May be we can use [nginx-opentracing](https://github.com/opentracing-contrib/nginx-opentracing/blob/master/example/lua/jaeger/nginx.conf) ? a nginx dynamic-module, What do you think? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 edited a comment on issue #478: What is the default account password of the dashboard?
bzp2010 edited a comment on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693335842 @Caelebs It seems that the Manager API is not using the latest version. Can you try to update it? Explanation: in the previous update, the login API was adjusted from `/user/login` to `/apisix/admin/user/login`, and the frontend code of the dashboard was also updated synchronously. However, in previous versions, API requests prefixed with `/apifix/admin` would be filtered through the filter, and the error request would be returned to HTTP 401. 看起来原因可能是Manager API没有使用最新版本,可以尝试进行更新吗? 解释:登录API在之前的更新中由 `/user/login` 调整至 `/apisix/admin/user/login` ,dashboard前端代码也同步进行了更新,然而在之前的版本以 `/apifix/admin` 前缀的API请求会经由filter进行过滤,并对错误请求返回HTTP 401,可能在这个过程中导致了你的错误。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #478: What is the default account password of the dashboard?
bzp2010 commented on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693335842 @Caelebs It seems that the Manager API is not using the latest version. Can you try to update it? Explanation: in the previous update, the login API was adjusted from `/user/login` to `/apisix/admin/user/login`, and the frontend code of the dashboard was also updated synchronously. However, in previous versions, API requests prefixed with `/apifix/admin` would be filtered through the filter, and the error request would be returned to HTTP 401. 看起来原因可能是Manager API没有使用最新版本,可以尝试进行更新吗? 解释:登录API在之前的更新中由 `/user/login` 调整至 `/apisix/admin/user/login` ,dashboard前端代码也同步进行了更新,然而在之前的版本以 `/apifix/admin` 前缀的API请求会经由filter进行过滤,并对错误请求返回HTTP 401。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] Caelebs commented on issue #478: What is the default account password of the dashboard?
Caelebs commented on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693316930 不好意思我英文不好还是中文描述吧 我这边尝试过注释掉服务端apisix配置文件config.yaml文件中admin_key这一段,这一段注释掉之后前台登录时候user/login接口直接报404,还有这个admin_key配置中的key值我应该怎样生成? 所以我又把注释掉的那一段还原回去,重新部署之后环境以及恢复到之前的状态,登录报错信息和之前的一样 ``` 2020/09/16 18:23:08 [warn] 37#37: *17282 [lua] ctx.lua:82: __index(): failed to fetch cookie value by key: cookie_x_api_key error: nil, client: 10.20.12.29, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "apisix-gw-lb:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2F; 2020/09/16 18:23:08 [warn] 37#37: *17282 [lua] init.lua:95: handler(): failed to check token: missing apikey, client: 10.20.12.29, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "apisix-gw-lb:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2F; ``` 前端页面控制台看了下报错401 Authorization Required 但是cookie里面有token ![image](https://user-images.githubusercontent.com/12752710/93325508-06964080-f84a-11ea-816f-2b7780125e1b.png) ![image](https://user-images.githubusercontent.com/12752710/93325561-157cf300-f84a-11ea-9d8a-c1ea1958251b.png) @bzp2010 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #478: What is the default account password of the dashboard?
bzp2010 commented on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693308666 @Caelebs Please check API response by `Chrome Developer Tools (F12)`. Normally, the response is similar to this. ` { "data": { "token": "A JWT string" } } ` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2216: improve: use optimistic locking to avoid concurrency problem in admin…
tokers commented on pull request #2216: URL: https://github.com/apache/apisix/pull/2216#issuecomment-693306223 @membphis Adjusted. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou opened a new pull request #2236: feature: "consumer" provides access to a collection of "service"
Firstsawyou opened a new pull request #2236: URL: https://github.com/apache/apisix/pull/2236 ### What this PR does / why we need it: "consumer" provides access to a collection of "service". ### Pre-submission checklist: * [x] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming closed issue #2234: bug: etcd_version in ./bin/apisix is not defined
moonming closed issue #2234: URL: https://github.com/apache/apisix/issues/2234 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on issue #2234: bug: etcd_version in ./bin/apisix is not defined
moonming commented on issue #2234: URL: https://github.com/apache/apisix/issues/2234#issuecomment-693298121 fixed by https://github.com/apache/apisix/pull/2233 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: change: check etcd cluster version when init_etcd (#2233)
This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e93cdbd change: check etcd cluster version when init_etcd (#2233) e93cdbd is described below commit e93cdbd48ad5bb9c9f351ef4e7122035713b3e81 Author: Alex Zhang AuthorDate: Wed Sep 16 17:46:53 2020 +0800 change: check etcd cluster version when init_etcd (#2233) --- bin/apisix| 135 +- rockspec/apisix-master-0.rockspec | 3 +- 2 files changed, 107 insertions(+), 31 deletions(-) diff --git a/bin/apisix b/bin/apisix index 96e6b6a..f79f4c3 100755 --- a/bin/apisix +++ b/bin/apisix @@ -21,9 +21,9 @@ local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end --- Note: The `excute_cmd` return value will have a line break at the end, +-- Note: The `execute_cmd` return value will have a line break at the end, -- it is recommended to use the `trim` function to handle the return value. -local function excute_cmd(cmd) +local function execute_cmd(cmd) local t, err = io.popen(cmd) if not t then return nil, "failed to execute command: " .. cmd .. ", error info:" .. err @@ -33,7 +33,7 @@ local function excute_cmd(cmd) return data end -excute_cmd("install -d -m 777 /tmp/apisix_cores/") +execute_cmd("install -d -m 777 /tmp/apisix_cores/") local pkg_cpath_org = package.cpath local pkg_path_org = package.path @@ -42,12 +42,14 @@ local apisix_home = "/usr/local/apisix" local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;" .. apisix_home .. "/deps/lib/lua/5.1/?.so;;" local pkg_path = apisix_home .."/deps/share/lua/5.1/?.lua;;" +local min_etcd_version = "3.4.0" + -- only for developer, use current folder as working space local is_root_path = false local script_path = arg[0] if script_path:sub(1, 2) == './' then -apisix_home = trim(excute_cmd("pwd")) +apisix_home = trim(execute_cmd("pwd")) if not apisix_home then error("failed to fetch current path") end @@ -605,14 +607,6 @@ local function merge_conf(base, new_tab) return base end -local function str_split(str, sep) -local t = {} -for s in str:gmatch("([^"..sep.."]+)") do -table.insert(t, s) -end -return t -end - local function read_yaml_conf() local profile = require("apisix.core.profile") @@ -654,16 +648,17 @@ local function read_yaml_conf() return default_conf end + local function get_openresty_version() local str = "nginx version: openresty/" -local ret = excute_cmd("openresty -v 2>&1") +local ret = execute_cmd("openresty -v 2>&1") local pos = string.find(ret,str) if pos then return string.sub(ret, pos + string.len(str)) end str = "nginx version: nginx/" -ret = excute_cmd("openresty -v 2>&1") +ret = execute_cmd("openresty -v 2>&1") pos = string.find(ret, str) if pos then return string.sub(ret, pos + string.len(str)) @@ -672,23 +667,82 @@ local function get_openresty_version() return nil end + local function is_32bit_arch() local ok, ffi = pcall(require, "ffi") if ok then -- LuaJIT return ffi.abi("32bit") end -local ret = excute_cmd("getconf LONG_BIT") +local ret = execute_cmd("getconf LONG_BIT") local bits = tonumber(ret) return bits <= 32 end + local function split(self, sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields + 1] = c end) return fields - end +end + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + local function check_version(cur_ver_s, need_ver_s) local cur_vers
[GitHub] [apisix] moonming merged pull request #2233: change: check etcd cluster version when init_etcd
moonming merged pull request #2233: URL: https://github.com/apache/apisix/pull/2233 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] Caelebs edited a comment on issue #478: What is the default account password of the dashboard?
Caelebs edited a comment on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693271087 我用admin/admin登录后端apisix内部的NGINX日志有报错 ``` 2020/09/16 16:52:09 [warn] 38#38: *559800 [lua] ctx.lua:82: __index(): failed to fetch cookie value by key: cookie_x_api_key error: nil, client: 10.20.12.27, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "10.20.8.63:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; 2020/09/16 16:52:09 [warn] 38#38: *559800 [lua] init.lua:95: handler(): failed to check token: missing apikey, client: 10.20.12.27, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "10.20.8.63:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; ``` 前台页面提示账号密码错误... apisix是部署在k8s环境下的 dashboard是基于源码路径下的Dockerfile打包的镜像 dashboard的日志看起来一切正常 ``` 10.20.0.0 - - [16/Sep/2020:08:50:08 +] "GET /favicon.png HTTP/1.1" 200 85376 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" 10.20.0.0 - - [16/Sep/2020:08:50:24 +] "POST /apisix/admin/user/login HTTP/1.1" 401 578 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" 10.20.0.0 - - [16/Sep/2020:08:51:26 +] "POST /apisix/admin/user/login HTTP/1.1" 401 578 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" 10.20.0.0 - - [16/Sep/2020:08:51:27 +] "POST /apisix/admin/user/login HTTP/1.1" 401 578 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" 10.20.0.0 - - [16/Sep/2020:08:51:28 +] "POST /apisix/admin/user/login HTTP/1.1" 401 578 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" 10.20.0.0 - - [16/Sep/2020:08:52:09 +] "POST /apisix/admin/user/login HTTP/1.1" 401 578 "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-" ``` @liuxiran @juzhiyuan This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming merged pull request #2231: change: remove dashboard sub module.
moonming merged pull request #2231: URL: https://github.com/apache/apisix/pull/2231 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: change: remove dashboard sub module. (#2231)
This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 455e7df change: remove dashboard sub module. (#2231) 455e7df is described below commit 455e7df005cdfd341c9e64305855dac79663bc71 Author: Wen Ming AuthorDate: Wed Sep 16 17:07:18 2020 +0800 change: remove dashboard sub module. (#2231) --- dashboard | 1 - 1 file changed, 1 deletion(-) diff --git a/dashboard b/dashboard deleted file mode 16 index 329b092..000 --- a/dashboard +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 329b092dcaa7a505dcdec86c667b6803f5863d94
[GitHub] [apisix-dashboard] Caelebs edited a comment on issue #478: What is the default account password of the dashboard?
Caelebs edited a comment on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693271087 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] Caelebs commented on issue #478: What is the default account password of the dashboard?
Caelebs commented on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693271087 我用admin/admin登录后端apisix内部的NGINX日志有报错 ``` 2020/09/16 16:52:09 [warn] 38#38: *559800 [lua] ctx.lua:82: __index(): failed to fetch cookie value by key: cookie_x_api_key error: nil, client: 10.20.12.27, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "10.20.8.63:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; 2020/09/16 16:52:09 [warn] 38#38: *559800 [lua] init.lua:95: handler(): failed to check token: missing apikey, client: 10.20.12.27, server: , request: "POST /apisix/admin/user/login HTTP/1.0", host: "10.20.8.63:9080", referrer: "http://10.10.16.250:30927/user/login?redirect=%2Fuser%2Flogin; ``` 前台页面提示账号密码错误... @liuxiran This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #469: Feature: debug a route online
juzhiyuan commented on issue #469: URL: https://github.com/apache/apisix-dashboard/issues/469#issuecomment-693269716 take a look at those requests sent from Swagger UI? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #469: Feature: debug a route online
membphis commented on issue #469: URL: https://github.com/apache/apisix-dashboard/issues/469#issuecomment-693268651 That is a useful feature. We can use a specified header for testing. Any suggestion? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] ShiningRush removed a comment on pull request #2222: fix: return ok in kafka-logger
ShiningRush removed a comment on pull request #: URL: https://github.com/apache/apisix/pull/#issuecomment-693263708 This bug should result in an error for each request, then test case 5 should fail, proving that the case does not cover the situation, I guess it should be caused by the short waiting time, please modify the case to cover the bug This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] ShiningRush commented on pull request #2222: fix: return ok in kafka-logger
ShiningRush commented on pull request #: URL: https://github.com/apache/apisix/pull/#issuecomment-693263708 This bug should result in an error for each request, then test case 5 should fail, proving that the case does not cover the situation, I guess it should be caused by the short waiting time, please modify the case to cover the bug This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.
membphis commented on a change in pull request #2209: URL: https://github.com/apache/apisix/pull/2209#discussion_r489260881 ## File path: t/admin/services.t ## @@ -1085,3 +1085,97 @@ GET /t --- error_code: 400 --- no_error_log [error] + + + +=== TEST 31: set empty service. (id: 1)(allow empty `service` object) +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/services/1', +ngx.HTTP_PUT, +{}, +[[{ +"node": { +"value": {"id":"1"} +}, +"action": "set" +}]] +) + +ngx.status = code +ngx.say(body) +} +} +--- request +GET /t +--- response_body +passed +--- no_error_log +[error] + + + +=== TEST 32: add content to the empty service.(id: 1)(allow empty `service` object) Review comment: bad title ## File path: t/admin/schema.t ## @@ -37,10 +37,29 @@ qr/"plugins":\{"type":"object"}/ === TEST 2: get service schema +--- config +location /t { +content_by_lua_block { +local core = require("apisix.core") +local t = require("lib.test_admin").test +local code, _, res_body = t('/apisix/admin/schema/service', +ngx.HTTP_GET +) +local res_data = core.json.decode(res_body) +local result = res_data["anyOf"] Review comment: bad process, not easy to read This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated (84ce7ba -> d1fe72c)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 84ce7ba feat: add AK/SK(HMAC) auth plugin. (#2192) add d1fe72c bugfix: fixed wrong zipkin Arguments (#2193) No new revisions were added by this update. Summary of changes: apisix/plugins/zipkin.lua | 22 -- apisix/plugins/zipkin/codec.lua | 22 +- 2 files changed, 21 insertions(+), 23 deletions(-)
[GitHub] [apisix] membphis closed issue #2191: bug zipkin Arguments
membphis closed issue #2191: URL: https://github.com/apache/apisix/issues/2191 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis merged pull request #2193: fixed #2191
membphis merged pull request #2193: URL: https://github.com/apache/apisix/pull/2193 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on issue #2235: pluin(zipkin): add test case
membphis commented on issue #2235: URL: https://github.com/apache/apisix/issues/2235#issuecomment-693252142 @dickens7 welcome to fix this issue when you have time This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on issue #478: What is the default account password of the dashboard?
liuxiran commented on issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478#issuecomment-693247410 admin/admin This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers commented on a change in pull request #2179: URL: https://github.com/apache/apisix/pull/2179#discussion_r489240639 ## File path: apisix/http/router/radixtree_sni.lua ## @@ -62,6 +62,20 @@ local function parse_pem_priv_key(sni, pkey) end +local function decrypt_priv_pkey(iv, key) +if str_find(key, "---") then Review comment: OK, actually i just copy and paste the original codes. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers commented on a change in pull request #2179: URL: https://github.com/apache/apisix/pull/2179#discussion_r489240353 ## File path: apisix/http/router/radixtree_sni.lua ## @@ -95,14 +109,22 @@ local function create_router(ssl_items) end -- decrypt private key -if aes_128_cbc_with_iv ~= nil and -not core.string.has_prefix(ssl.value.key, "---") then -local decrypted = aes_128_cbc_with_iv:decrypt(ngx_decode_base64(ssl.value.key)) -if decrypted == nil then -core.log.error("decrypt ssl key failed. key[", ssl.value.key, "] ") -else +if aes_128_cbc_with_iv ~= nil then +local decrypted = decrypt_priv_pkey(aes_128_cbc_with_iv, Review comment: sure. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #2216: WIP: improve: use optimistic locking to avoid concurrency problem in admin…
membphis commented on pull request #2216: URL: https://github.com/apache/apisix/pull/2216#issuecomment-693242116 @tokers got it, we can merge this PR later This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] Caelebs opened a new issue #478: What is the default account password of the dashboard?
Caelebs opened a new issue #478: URL: https://github.com/apache/apisix-dashboard/issues/478 Please answer these questions before submitting your issue. ### Question - What is the default account password of the dashboard? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
membphis commented on a change in pull request #2179: URL: https://github.com/apache/apisix/pull/2179#discussion_r489233605 ## File path: apisix/http/router/radixtree_sni.lua ## @@ -62,6 +62,20 @@ local function parse_pem_priv_key(sni, pkey) end +local function decrypt_priv_pkey(iv, key) +if str_find(key, "---") then Review comment: should we use `core.string.has_prefix` here? ## File path: apisix/http/router/radixtree_sni.lua ## @@ -95,14 +109,22 @@ local function create_router(ssl_items) end -- decrypt private key -if aes_128_cbc_with_iv ~= nil and -not core.string.has_prefix(ssl.value.key, "---") then -local decrypted = aes_128_cbc_with_iv:decrypt(ngx_decode_base64(ssl.value.key)) -if decrypted == nil then -core.log.error("decrypt ssl key failed. key[", ssl.value.key, "] ") -else +if aes_128_cbc_with_iv ~= nil then +local decrypted = decrypt_priv_pkey(aes_128_cbc_with_iv, Review comment: the `ssl.value.key` maybe nil. how about this code style? ```lua if ssl.value.key then ... end if ssl.value.keys then ... end ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2216: improve: use optimistic locking to avoid concurrency problem in admin…
tokers commented on pull request #2216: URL: https://github.com/apache/apisix/pull/2216#issuecomment-693237994 @membphis @moonming This PR should be adjusted to the ETCD v3 data structure, So i mark it as work in progress. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on pull request #2230: bug: removed default access token for Admin API
moonming commented on pull request #2230: URL: https://github.com/apache/apisix/pull/2230#issuecomment-693237220 I don't think so, `YOUR_OWN_API_TOKEN` is good as hint, not the real token. we can keep the current token This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix-dashboard] branch refactor updated: fmt project
This is an automated email from the ASF dual-hosted git repository. vinci pushed a commit to branch refactor in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/refactor by this push: new 24c627a fmt project 24c627a is described below commit 24c627a6c16f7e19db5b94faae7577ece9fa7b66 Author: ShiningRush <277040...@qq.com> AuthorDate: Wed Sep 16 15:44:24 2020 +0800 fmt project --- api/filter/authentication.go | 8 +- api/filter/request_id.go | 4 +- api/internal/core/entity/entity.go| 39 ++--- api/internal/core/store/store.go | 74 api/internal/core/store/store_test.go | 315 +- api/internal/handler/route/route.go | 122 ++--- api/log/log.go| 37 ++-- api/main.go | 22 +-- api/route/authentication.go | 6 +- api/route/authentication_test.go | 50 +++--- api/route/base.go | 16 +- api/route/base_test.go| 2 - api/route/consumer_test.go| 4 +- api/route/route_group_test.go | 2 +- api/route/route_test.go | 34 ++-- 15 files changed, 365 insertions(+), 370 deletions(-) diff --git a/api/filter/authentication.go b/api/filter/authentication.go index 0a2bfde..ad794af 100644 --- a/api/filter/authentication.go +++ b/api/filter/authentication.go @@ -27,7 +27,7 @@ import ( func Authentication() gin.HandlerFunc { return func(c *gin.Context) { - if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path,"/apisix") { + if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path, "/apisix") { tokenStr := c.GetHeader("Authorization") // verify token @@ -57,9 +57,9 @@ func Authentication() gin.HandlerFunc { } if _, ok := conf.UserList[claims.Subject]; !ok { -c.AbortWithStatusJSON(http.StatusUnauthorized, errno.FromMessage(errno.ForbiddenError).Response()) -return - } + c.AbortWithStatusJSON(http.StatusUnauthorized, errno.FromMessage(errno.ForbiddenError).Response()) + return + } } c.Next() } diff --git a/api/filter/request_id.go b/api/filter/request_id.go index 8d8ea80..aced90c 100644 --- a/api/filter/request_id.go +++ b/api/filter/request_id.go @@ -34,9 +34,9 @@ func RequestId() gin.HandlerFunc { // Expose it for use in the application c.Set("X-Request-Id", requestId) -c.Request.Header.Set("X-Request-Id", requestId) + c.Request.Header.Set("X-Request-Id", requestId) -// Set X-Request-Id header + // Set X-Request-Id header c.Writer.Header().Set("X-Request-Id", requestId) c.Next() } diff --git a/api/internal/core/entity/entity.go b/api/internal/core/entity/entity.go index 8f26503..c3ed12f 100644 --- a/api/internal/core/entity/entity.go +++ b/api/internal/core/entity/entity.go @@ -1,27 +1,26 @@ package entity type Route struct { - ID string `json:"id"` - Uri string `json:"uri,omitempty" validate:"uri"` - Uris []string `json:"uris,omitempty"` - Name string `json:"name,omitempty" validate:"max=50"` - Desc string `json:"desc,omitempty" validate:"max=256"` - Priority int `json:"priority,omitempty"` - Methods []string `json:"methods,omitempty"` - Host string `json:"host,omitempty"` - Hosts[]string `json:"hosts,omitempty"` - RemoteAddr string `json:"remote_addr,omitempty"` - RemoteAddrs string `json:"remote_addrs,omitempty"` - Vars string `json:"vars,omitempty"` - FilterFunc string `json:"filter_func,omitempty"` - Script string `json:"script,omitempty"` - Plugins interface{} `json:"plugins,omitempty"` - Upstream Upstream `json:"upstream,omitempty"` - ServiceId string `json:"service_id,omitempty"` - UpstreamId string `json:"upstream_id,omitempty"` - ServiceProtocol string `json:"service_protocol,omitempty"` + ID string `json:"id"` + Uri string `json:"uri,omitempty" validate:"uri"` + Uris[]string`json:"uris,omitempty"` + Namestring `json:"name,omitempty" validate:"max=50"` + Descstring `json:"desc,omitempty" validate:"max=256"` + Priorityint `json:"priority,omitempty"` + Methods []string`json:"methods,omitempty"` + Hoststring `json:"host,omitempty"` + Hosts []string`json:"hosts,omitempty"` + RemoteAddr string `json:"remote_addr,omitempty"` + RemoteAddrs string `json:"remote_addrs,omitempty"` + Vars
[GitHub] [apisix] tokers commented on pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers commented on pull request #2179: URL: https://github.com/apache/apisix/pull/2179#issuecomment-693221215 @moonming Rebased. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers removed a comment on pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers removed a comment on pull request #2179: URL: https://github.com/apache/apisix/pull/2179#issuecomment-693219910 @moonming OK. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2179: bugfix: supported the encryption/decryption for multi priv keys
tokers commented on pull request #2179: URL: https://github.com/apache/apisix/pull/2179#issuecomment-693219910 @moonming OK. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on a change in pull request #2120: [key-auth]fix: skip consumer when config has no key
moonming commented on a change in pull request #2120: URL: https://github.com/apache/apisix/pull/2120#discussion_r489208626 ## File path: t/plugin/key-auth.t ## @@ -215,3 +215,56 @@ apikey: auth-13 ["passed\n", "hello world\n"] --- no_error_log [error] + + + +=== TEST 9: add consumer with empty key +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/consumers', +ngx.HTTP_PUT, +[[{ +"username": "error", +"plugins": { +"key-auth": { +} Review comment: any update? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on issue #2234: bug: etcd_version in ./bin/apisix is not defined
moonming commented on issue #2234: URL: https://github.com/apache/apisix/issues/2234#issuecomment-693209618 good catch, welcome PR to fix This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2233: change: check etcd cluster version when init_etcd
tokers commented on pull request #2233: URL: https://github.com/apache/apisix/pull/2233#issuecomment-693204656 @membphis Fixed. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org