Skip to content

Commit

Permalink
warn if file content looks off
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Nov 14, 2024
1 parent 6b1e6ca commit 918547a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions systemapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ func (s *Server) loadBasicAuthSecretFromFile() error {
}

s.basicAuthHash = string(secret)
if len(s.basicAuthHash) != 64 {
return fmt.Errorf("basic auth secret in %s does not look like a SHA256 hash (must be 64 characters)", s.cfg.General.BasicAuthSecretPath)
}

if len(secret) == 0 {
s.log.Info("Basic auth file without secret loaded, auth disabled until secret is configured", "file", s.cfg.General.BasicAuthSecretPath)
} else {
Expand Down

0 comments on commit 918547a

Please sign in to comment.