nic-6443 commented on code in PR #2813:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2813#discussion_r3654149198


##########
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:
   Thanks, the error now reaches reconciliation, but the update path still 
fails open. If an existing Ingress has already programmed a route without CSRF 
and is then updated with `enable-csrf: "true"` but no key, `Provider.Update` 
returns on this error before calling `UpdateConfig`; it does not delete or 
replace the previous resources, so the old unprotected route remains in the ADC 
cache and data plane. The translator-only tests cannot catch this. Please 
reject the invalid update in admission or program a fail-closed replacement, 
and cover an update from an already-served route.



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