diff options
| author | ReAnzu | 2018-02-24 23:45:00 -0600 |
|---|---|---|
| committer | rr- | 2018-03-08 23:40:47 +0100 |
| commit | 3f52aceca44bc52e0c8654f46c66073320109ae9 (patch) | |
| tree | 8eb921ff35b1241f3eafef97db45c6e495f37338 /server/szurubooru/model/user.py | |
| parent | 7519e071e79a2cf51e41e35fce030749c71fc0cf (diff) | |
server/users: harden password hashes
- Changed password setup to use libsodium and argon2id (regular SHA256
hashing for passwords is inadequate as modern GPU's can hash generate
billions of hashes per second).
- Added code to auto migrate old passwords to the new password_hash if
the existing password_hash matches either of the legacy password
generation schemes (SHA1 or SHA256).
- Added migration to support new password_hash format length
- Added column password_revision. This field will default to 0, which
all passwords will have till they're updated. After that each password
hash method has a revision.
Diffstat (limited to 'server/szurubooru/model/user.py')
| -rw-r--r-- | server/szurubooru/model/user.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/szurubooru/model/user.py b/server/szurubooru/model/user.py index dd7c062..39c5a91 100644 --- a/server/szurubooru/model/user.py +++ b/server/szurubooru/model/user.py @@ -23,8 +23,10 @@ class User(Base): last_login_time = sa.Column('last_login_time', sa.DateTime) version = sa.Column('version', sa.Integer, default=1, nullable=False) name = sa.Column('name', sa.Unicode(50), nullable=False, unique=True) - password_hash = sa.Column('password_hash', sa.Unicode(64), nullable=False) + password_hash = sa.Column('password_hash', sa.Unicode(128), nullable=False) password_salt = sa.Column('password_salt', sa.Unicode(32)) + password_revision = sa.Column( + 'password_revision', sa.SmallInteger, default=0, nullable=False) email = sa.Column('email', sa.Unicode(64), nullable=True) rank = sa.Column('rank', sa.Unicode(32), nullable=False) avatar_style = sa.Column( |