You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/04/11 11:07:07 UTC

[GitHub] [apisix] tylitianrui opened a new pull request, #6822: check plugin init type

tylitianrui opened a new pull request, #6822:
URL: https://github.com/apache/apisix/pull/6822

   ### Description
   - check  the  type  of  `plugin.init` whether it  is  `function` or  not.  
   -  remove  redundant  code
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] commented on pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #6822:
URL: https://github.com/apache/apisix/pull/6822#issuecomment-1160241078

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on a diff in pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #6822:
URL: https://github.com/apache/apisix/pull/6822#discussion_r853680830


##########
apisix/plugin.lua:
##########
@@ -150,10 +150,13 @@ local function load_plugin(name, plugins_list, plugin_type)
     core.table.insert(plugins_list, plugin)
 
     if plugin.init then
-        plugin.init()
+        if  type(plugin.init) == "function" then
+            plugin.init()

Review Comment:
   We can add it in https://github.com/apache/apisix/blob/761c34a292d187fbc49ddb06f1be0d7790df3815/apisix/plugin.lua#L114 and reject invalid plugin



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
tokers commented on PR #6822:
URL: https://github.com/apache/apisix/pull/6822#issuecomment-1095750357

   @tylitianrui The issue link is broken, could you fix it?


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] commented on pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #6822:
URL: https://github.com/apache/apisix/pull/6822#issuecomment-1187019593

   This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any 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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] closed pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #6822: feat: check plugin init type
URL: https://github.com/apache/apisix/pull/6822


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on a diff in pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #6822:
URL: https://github.com/apache/apisix/pull/6822#discussion_r847859611


##########
apisix/plugin.lua:
##########
@@ -150,10 +150,13 @@ local function load_plugin(name, plugins_list, plugin_type)
     core.table.insert(plugins_list, plugin)
 
     if plugin.init then
-        plugin.init()
+        if  type(plugin.init) == "function" then
+            plugin.init()

Review Comment:
   Why do we need 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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #6822:
URL: https://github.com/apache/apisix/pull/6822#issuecomment-1103803068

   > plugin.init may be defined as other data types in custom plugins
   
   Frankly, I don't think it makes sense.
   
   If init needs to be checked, then `rewrite`, `access`, etc. all need to be checked.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tylitianrui commented on a diff in pull request #6822: feat: check plugin init type

Posted by GitBox <gi...@apache.org>.
tylitianrui commented on code in PR #6822:
URL: https://github.com/apache/apisix/pull/6822#discussion_r853670349


##########
apisix/plugin.lua:
##########
@@ -150,10 +150,13 @@ local function load_plugin(name, plugins_list, plugin_type)
     core.table.insert(plugins_list, plugin)
 
     if plugin.init then
-        plugin.init()
+        if  type(plugin.init) == "function" then
+            plugin.init()

Review Comment:
   check type  of `plugin.init`.   customer plugin may  define it  as other  data  types



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org