wklken commented on issue #9149:
URL: https://github.com/apache/apisix/issues/9149#issuecomment-1549524129

   ## version: 3.2
   
   print the plugin.schema of `ip-restriction` before line `if 
plugin.schema['$comment'] ~= plugin_injected_schema['$comment'] then` in file 
`apisix/plugin.lua`
   
   then do
   
   ```
   apisix reload
   ```
   
   got the log, `_meta` in the schema
   
   ```
   2023/05/16 11:48:23 [error] 264480#264480: *29507760 [lua] plugin.lua:165: 
load_plugin(): the ip-restriction schema: {
     oneOf = {
       {
         required = {
           "whitelist"
         }
       },
       {
         required = {
           "blacklist"
         }
       }
     },
     properties = {
       _meta = {
         properties = {
           disable = {
             type = "boolean"
           },
           error_response = {
             oneOf = {
               {
                 type = "string"
               },
               {
                 type = "object"
               }
             }
           },
           filter = {
             description = "filter determines whether the plugin needs to be 
executed at runtime",
             type = "array"
           },
           priority = {
             description = "priority of plugins by customized order",
             type = "integer"
           }
         },
         type = "object"
       },
       blacklist = {
         items = {
           anyOf = {
             {
               format = "ipv4",
               title = "IPv4",
               type = "string"
             },
             {
               pattern = 
"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$",
               title = "IPv4/CIDR",
               type = "string"
             },
             {
               format = "ipv6",
               title = "IPv6",
               type = "string"
             },
             {
               pattern = 
"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$",
               title = "IPv6/CIDR",
               type = "string"
             }
           }
         },
         minItems = 1,
         type = "array"
       },
       message = {
         default = "Your IP address is not allowed",
         maxLength = 1024,
         minLength = 1,
         type = "string"
       },
       whitelist = {
         items = {
           anyOf = {
             {
               format = "ipv4",
               title = "IPv4",
               type = "string"
             },
             {
               pattern = 
"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$",
               title = "IPv4/CIDR",
               type = "string"
             },
             {
               format = "ipv6",
               title = "IPv6",
               type = "string"
             },
             {
               pattern = 
"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$",
               title = "IPv6/CIDR",
               type = "string"
             }
           }
         },
         minItems = 1,
         type = "array"
       }
     },
     type = "object"
   }, context: init_worker_by_lua*
   2023/05/16 11:48:23 [error] 264480#264480: *29507760 [lua] plugin.lua:171: 
load_plugin(): invalid plugin [ip-restriction]: found forbidden '_meta' field 
in the schema, context: init_worker_by_lua*
   ```
   
   then i do reload for many times, some got `[error]`, but some load success, 
and the success log of `ip-restriction`(no `_meta` in schema)
   
   ```
   2023/05/16 11:52:09 [error] 264683#264683: *29523032 [lua] plugin.lua:165: 
load_plugin(): the ip-restriction schema: {
     oneOf = {
       {
         required = {
           "whitelist"
         }
       },
       {
         required = {
           "blacklist"
         }
       }
     },
     properties = {
       blacklist = {
         items = {
           anyOf = {
             {
               format = "ipv4",
               title = "IPv4",
               type = "string"
             },
             {
               pattern = 
"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$",
               title = "IPv4/CIDR",
               type = "string"
             },
             {
               format = "ipv6",
               title = "IPv6",
               type = "string"
             },
             {
               pattern = 
"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$",
               title = "IPv6/CIDR",
               type = "string"
             }
           }
         },
         minItems = 1,
         type = "array"
       },
       message = {
         default = "Your IP address is not allowed",
         maxLength = 1024,
         minLength = 1,
         type = "string"
       },
       whitelist = {
         items = {
           anyOf = {
             {
               format = "ipv4",
               title = "IPv4",
               type = "string"
             },
             {
               pattern = 
"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$",
               title = "IPv4/CIDR",
               type = "string"
             },
             {
               format = "ipv6",
               title = "IPv6",
               type = "string"
             },
             {
               pattern = 
"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$",
               title = "IPv6/CIDR",
               type = "string"
             }
           }
         },
         minItems = 1,
         type = "array"
       }
     },
     type = "object"
   }, context: init_worker_by_lua*
   ```
   
   ## 2.15.3
   
   I can find the log in another version, I think it's the same reason
   
   ```
   2.15.3 invalid plugin [ip-restriction]: found forbidden 'disable' field in 
the schema, context: init_worker_by_lua*
   ```
   
   ------
   
   
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to