Skip to content

Use CSPRNG for generating password salts - #16775

Merged
michaelklishin merged 1 commit into
mainfrom
password-salt
Jun 23, 2026
Merged

michaelklishin merged 1 commit into
mainfrom
password-salt

Conversation

@ansd

@ansd ansd commented Jun 23, 2026

Copy link
Copy Markdown
Member

What:
Use a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) for generating internal user password salts instead of a standard PRNG.

Why:
The rand module in Erlang is a PRNG and is not cryptographically secure. While a salt primarily needs to be globally unique rather than strictly unpredictable, modern security standards (such as NIST) recommend using a CSPRNG for all cryptographic material, including salts.

What:
Use a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG)
for generating internal user password salts instead of a standard PRNG.

Why:
The `rand` module in Erlang is a PRNG and is not cryptographically secure.
While a salt primarily needs to be globally unique rather than strictly
unpredictable, modern security standards (such as NIST) recommend using
a CSPRNG for all cryptographic material, including salts.
@ansd ansd added this to the 4.4.0 milestone Jun 23, 2026
@ansd
ansd requested a review from michaelklishin June 23, 2026 09:00
@mergify

mergify Bot commented Jun 23, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@michaelklishin michaelklishin left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find.

A mandatory mention of backwards compatibility: this new function produces a value of the same length/width (4 bytes) and the salt value is embedded into the user record in the internal database, so this change is entirely backwards compatible.

@michaelklishin
michaelklishin merged commit e93f921 into main Jun 23, 2026
186 checks passed
@michaelklishin
michaelklishin deleted the password-salt branch June 23, 2026 14:31
michaelklishin added a commit that referenced this pull request Jun 23, 2026
Use CSPRNG for generating password salts (backport #16775) (backport #16777)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants