mirror of
https://github.com/ergochat/ergo.git
synced 2026-04-11 18:08:06 +02:00
fix handling of invalid API bearer tokens (#2380)
Not doing a pointfix since this only affects obvious misconfigurations of Ergo (our attempt to be defensive against those misconfigurations failed)
This commit is contained in:
parent
cbbe18314a
commit
5bb94efaf6
@ -1032,12 +1032,12 @@ func (config *Config) processAPI() (err error) {
|
||||
return errors.New("config.api.enabled is true, but listener address is empty")
|
||||
}
|
||||
|
||||
config.API.bearerTokenBytes = make([][]byte, len(config.API.BearerTokens))
|
||||
for i, tok := range config.API.BearerTokens {
|
||||
config.API.bearerTokenBytes = make([][]byte, 0, len(config.API.BearerTokens))
|
||||
for _, tok := range config.API.BearerTokens {
|
||||
if tok == "" || tok == "example" {
|
||||
continue
|
||||
}
|
||||
config.API.bearerTokenBytes[i] = []byte(tok)
|
||||
config.API.bearerTokenBytes = append(config.API.bearerTokenBytes, []byte(tok))
|
||||
}
|
||||
|
||||
var tlsConfig *tls.Config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user