feat: add HashedPassword transformer - #482
Open
YauhenBichel wants to merge 1 commit into
Open
YauhenBichel wants to merge 1 commit into
YauhenBichel wants to merge 1 commit into
Conversation
Replace a password hash with a bcrypt hash of one known password, so test accounts can log in after the restore. The bcrypt_variant parameter picks the prefix (2a, 2b, 2y); the default 2a is the only one pgcrypto crypt() understands. Closes GreenmaskIO#480 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #480
What
A new
HashedPasswordtransformer. It writes a bcrypt hash of one known password into a column, so test accounts can log in after the restore.bcrypt_variant:2a(default),2bor2y. pgcryptocrypt()understands only2a.cost: 4 to 31, default 10.per_row_salt: defaultfalse, so the password is hashed once and the dump stays fast.keep_null: defaulttrue.resolve_env+${VAR}feature, so it stays out of the config. Warnings never include it.Tests
crypt(pw, hash) = hashis true for all rows.2b/2y, pgcrypto gives no error, but every login check is false. This is why the default is2a.Written with help from an AI assistant; I reviewed and tested it.