janiussyafiq commented on code in PR #13884:
URL: https://github.com/apache/apisix/pull/13884#discussion_r3867839410
##########
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 believe this is needed for the `$secret://` or `$env://` reference, or
else TEST 35 & 36 will likely fail. After dropping this codeblock, apparently
TEST 35 still passed due to #13836 not yet getting merged.
--
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]