Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Insecure password storage #44

Description

@st161848

Password hashes are created with crypto.createHmac(passwordAlgorithm, passwordSecret).update(password), which is not a secure way of storing passwords.

Notably, two users who have the same password will share the same password hash:

ccims=# select (username, pw_hash) from users;
                             row
-------------------------------------------------------------
 (test1,sha256;6UBguf6xoaDCi0HsGx8JoP32WrJoXKmSwghTr23buH4=)
 (test2,sha256;6UBguf6xoaDCi0HsGx8JoP32WrJoXKmSwghTr23buH4=)
(2 rows)

Instead, passwords should be stored with a random salt and an intentionally expensive validation function such as PBKDF2. Using a password secret is probably not necessary.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions