feat(identity): hash passwords with Argon2id and bounded inputs
This commit is contained in:
1 parent
6153887eb5
commit
dda3825786
26 files changed
+1475
-32
No files matched your search
@@ -59,6 +59,10 @@ type Config struct {
|
||||
LogLevel string
|
||||
ReadinessTimeout time.Duration
|
||||
ShutdownTimeout time.Duration
|
||||
|
||||
// PasswordHashConcurrency is the number of password hash derivations
|
||||
// that may run at once; further logins and registrations wait.
|
||||
PasswordHashConcurrency int
|
||||
}
|
||||
|
||||
type LookupEnv func(string) (string, bool)
|
||||
@@ -93,6 +97,9 @@ func LoadFromEnv(lookup LookupEnv) (Config, error) {
|
||||
if err := config.loadMail(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
if err := config.loadPasswordHash(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
|
||||
var err error
|
||||
config.DatabaseMigrateOnStart, err = boolOrDefault(lookup, "DATABASE_MIGRATE_ON_START", defaultDatabaseMigrateOnStart)
|
||||
@@ -134,6 +141,9 @@ func (config Config) Validate() error {
|
||||
if err := config.ValidateMail(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := config.ValidatePasswordHash(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateAddress("HTTP_ADDR", config.HTTPAddr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user