mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-22 10:19:57 +00:00
make auth.salt parameter optional
Used implementation of the hasher includes salt itself, thus additional salt is optional and can be safely (in terms of security) treat as empty string
This commit is contained in:
@ -52,7 +52,7 @@ class Users(Handler):
|
||||
if args.action == Action.Update:
|
||||
user = Users.user_create(args)
|
||||
# if password is left blank we are not going to require salt to be set
|
||||
salt = configuration.get("auth", "salt") if user.password else ""
|
||||
salt = configuration.get("auth", "salt", fallback="") if user.password else ""
|
||||
database.user_update(user.hash_password(salt))
|
||||
elif args.action == Action.List:
|
||||
users = database.user_list(args.username, args.role)
|
||||
|
@ -46,7 +46,7 @@ class Mapping(Auth):
|
||||
"""
|
||||
Auth.__init__(self, configuration, provider)
|
||||
self.database = database
|
||||
self.salt = configuration.get("auth", "salt")
|
||||
self.salt = configuration.get("auth", "salt", fallback="")
|
||||
|
||||
async def check_credentials(self, username: str | None, password: str | None) -> bool:
|
||||
"""
|
||||
|
@ -93,9 +93,12 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
|
||||
"type": "string",
|
||||
"oneof": [
|
||||
{"allowed": ["disabled"]},
|
||||
{"allowed": ["configuration", "mapping"], "dependencies": ["salt"]},
|
||||
{"allowed": ["configuration", "mapping"]},
|
||||
{"allowed": ["oauth"], "dependencies": [
|
||||
"client_id", "client_secret", "oauth_provider", "oauth_scopes", "salt"
|
||||
"client_id",
|
||||
"client_secret",
|
||||
"oauth_provider",
|
||||
"oauth_scopes",
|
||||
]},
|
||||
],
|
||||
},
|
||||
|
Reference in New Issue
Block a user