nic-6443 commented on code in PR #13884:
URL: https://github.com/apache/apisix/pull/13884#discussion_r3868550901
##########
apisix/plugins/basic-auth.lua:
##########
@@ -148,7 +148,19 @@ local function find_consumer(ctx)
return nil, nil, "Invalid user authorization"
end
- if cur_consumer.auth_conf.password ~= password then
+ -- fail closed: a consumer written before the schema required a non-empty
+ -- password, or a secret reference that resolves to "", must never
authenticate
+ local expected = cur_consumer.auth_conf.password
+ if expected == "" then
+ err = "empty password configured for consumer: " ..
cur_consumer.consumer_name
+ if auth_utils.is_running_under_multi_auth(ctx) then
+ return nil, nil, err
+ end
+ core.log.warn(err)
+ return nil, nil, "Invalid user authorization"
+ end
Review Comment:
I think this is excessive defensive programming.
--
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]