shreemaan-abhishek commented on code in PR #2813:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2813#discussion_r3680527543


##########
internal/adc/translator/annotations/plugins/csrf.go:
##########
@@ -39,7 +41,10 @@ func (c *csrf) Handle(e annotations.Extractor) (any, error) {
 
        key := e.GetStringAnnotation(annotations.AnnotationsCsrfKey)
        if key == "" {
-               return nil, nil
+               // csrf requested but the key is missing: fail loud instead of
+               // silently dropping the plugin and programming the route 
unprotected.

Review Comment:
   Done in dc0fc9c. `csrf.Handle` now returns an error when the key is missing, 
so `plugins.Parse` logs a breadcrumb for the cases the webhook cannot cover 
(webhook off, or a pre-upgrade Ingress). Parse skips only the csrf plugin, so 
the rest of the route is untouched. The webhook stays the enforcement point. 
Kept it to webhook + log as suggested.



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