shreemaan-abhishek opened a new pull request, #13617:
URL: https://github.com/apache/apisix/pull/13617

   ### Description
   
   The `workflow` Plugin (priority 1006) can run a plugin such as `limit-count` 
(priority 1002) or `limit-conn` (priority 1003) as an action. When the same 
plugin is *also* configured directly in the normal plugin chain on the same 
Route/Service/Consumer/Global Rule, the plugin ends up running twice per 
request:
   
   1. once via the `workflow` action handler, and
   2. once in the normal chain (the `workflow` access handler returns `nil` on 
the non-rejected path, so it does not short-circuit the chain).
   
   The visible impact is that a request is counted/limited twice. For 
`limit-count` the quota is consumed at 2x; the same applies to `limit-conn` 
(which is also double-counted in both `access` and `log`). This is reachable 
with stock plugins and a non-exotic configuration.
   
   This PR adds `plugin.skip_plugin(ctx, name)` to mark the action plugin as 
skipped for the rest of the request, so once `workflow` runs it as an action it 
is not executed again in the normal chain. The skip is honored in both 
`run_plugin` loops (access/rewrite and log/header_filter/body_filter), so 
`limit-conn`'s `log`-phase decrement is also handled only by the `workflow` 
action.
   
   #### Which issue(s) this PR fixes:
   
   N/A
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is 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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to