membphis commented on a change in pull request #3021:
URL: https://github.com/apache/apisix/pull/3021#discussion_r541539244



##########
File path: apisix/plugins/jwt-auth.lua
##########
@@ -42,12 +42,11 @@ local schema = {
 
 local consumer_schema = {
     type = "object",
-    additionalProperties = false,
+    -- can't use additionalProperties with dependencies

Review comment:
       Is it a bug of JSONSchema?

##########
File path: apisix/schema_def.lua
##########
@@ -43,14 +45,19 @@ local host_def = {
 _M.host_def = host_def
 
 
-local ipv4_def = "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}"
+local ipv4_seg = "([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"
+local ipv4_def_buf = {}
+for i = 1, 4 do
+    table_insert(ipv4_def_buf, ipv4_seg)
+end
+local ipv4_def = table_concat(ipv4_def_buf, [[\.]])
 -- There is false negative for ipv6/cidr. For instance, `:/8` will be valid.
 -- It is fine as the correct regex will be too complex.
 local ipv6_def = "([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}"
                  .. "([a-fA-F0-9]{0,4})?"
 local ip_def = {
     {title = "IPv4", type = "string", format = "ipv4"},
-    {title = "IPv4/CIDR", type = "string", pattern = "^" .. ipv4_def .. 
"/[0-9]{1,2}$"},
+    {title = "IPv4/CIDR", type = "string", pattern = "^" .. ipv4_def .. 
"/([12]?[0-9]|3[0-2])$"},

Review comment:
       I am not sure if the current regex is good enough, I have listed the 
example of IPs, we can confirm:
   
   * 127.0.0.1/1
   * 127.0.0.1/10
   * 127.0.0.1/11
   * 127.0.0.1/20
   * 127.0.0.1/21
   * 127.0.0.1/30
   * 127.0.0.1/32
   * 127.0.0.1/33
   
   




----------------------------------------------------------------
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


Reply via email to