Open
Conversation
Collaborator
|
Could you post the output of connecting to your database I have not looked at this scram code at all, but it's over ten years old and haven't seen many complaints (and I've also seen people using it to connect to RDS). I'm hesitant to "just change it", especially because it's in the authentication workflow. |
Author
|
@arp242 I can try but the error surfaces because this package is used in https://github.com/cyrilgdn/terraform-provider-postgresql essentially for pg16+ if someone sets scram_iterations <1000 and uses a set of credentials with that strength you get the error |
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.
Fix SCRAM-SHA-256 iteration count validation for low iteration values
Problem
The SCRAM-SHA-256 authentication fails with the error:
This occurs when connecting to servers (e.g., AWS RDS) that use iteration counts below 1000.
Root Cause
The length validation check
len(fields[2]) < 6requires the iteration field to have at least 6 characters (e.g.,i=1000). This incorrectly rejects valid iteration counts with fewer than 4 digits, such asi=256(5 characters).Fix
Changed the minimum length check from
< 6to< 3, which only requiresi=plus at least one digit. The actual integer validation is still performed bystrconv.Atoion the subsequent line.Changed Files
scram/scram.go: Line 164