-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
random_password.bcrypt_hash is incorrect since 3.4.0 #307
Comments
Hi @marcus-bcl 👋 Thank you for raising this and sorry you are running into trouble with this. I have been able to reproduce on 3.4.2 and believe I found a root cause. I will ensure there is additional testing for this functionality and submit a fix for it shortly. |
Reference: #307 This change fixes the source of the `bcrypt_hash` generation to being the result of the random password generation. The issue was introduced in v3.4.0. Previously: ``` --- FAIL: TestAccResourcePassword_BcryptHash (0.63s) /Users/bflad/src/github.com/hashicorp/terraform-provider-random/internal/provider/resource_password_test.go:107: Step 1/1 error: Check failed: Check 3/3 error: crypto/bcrypt: hashedPassword is not the hash of the given password ``` Suggested CHANGELOG: ``` NOTES: * resource/random_password: If the resource was created between versions 3.4.0 and 3.4.2, the `bcrypt_hash` value will not correctly verify against the `result` value. Use `terraform taint` or `terraform apply -replace` to trigger resource recreation with this version. BUG FIXES: * resource/random_password: Fixed incorrect `bcrypt_hash` generation since version 3.4.0 ```
Reference: #307 This change fixes the source of the `bcrypt_hash` generation to being the result of the random password generation. The issue was introduced in v3.4.0. Previously: ``` --- FAIL: TestAccResourcePassword_BcryptHash (0.63s) /Users/bflad/src/github.com/hashicorp/terraform-provider-random/internal/provider/resource_password_test.go:107: Step 1/1 error: Check failed: Check 3/3 error: crypto/bcrypt: hashedPassword is not the hash of the given password ``` Suggested CHANGELOG: ``` NOTES: * resource/random_password: If the resource was created between versions 3.4.0 and 3.4.2, the `bcrypt_hash` value would not correctly verify against the `result` value. Affected resources will automatically regenerate a valid `bcrypt_hash` after this upgrade. BUG FIXES: * resource/random_password: Fixed incorrect `bcrypt_hash` generation since version 3.4.0 ```
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform CLI and Provider Versions
Terraform v1.2.8
on linux_amd64
Terraform Configuration
Expected Behavior
The
result
output can be verified against thebcrypt_hash
output, e.g. using https://gchq.github.io/CyberChef/#recipe=Bcrypt_compare('')Actual Behavior
The
bcrypt_hash
is not a valid hash ofresult
.Steps to Reproduce
terraform apply
terraform output bcrypt_hash
terraform output result
How much impact is this issue causing?
Medium
Logs
No response
Additional Information
This worked in 3.3.2, but is broken in 3.4.0+.
Note: the
bcrypt(...)
function still works as expected, however generates a new hash on each apply. The following workaround can be used to get a static hash:Code of Conduct
The text was updated successfully, but these errors were encountered: