{{ message }}
Repository navigation
Reject overlong user names in dropUser and updateUser - #748
Open
GodfredArhinful wants to merge 1 commit into
Open
GodfredArhinful wants to merge 1 commit into
GodfredArhinful wants to merge 1 commit into
Conversation
PostgreSQL truncates identifiers to 63 bytes, so dropUser and updateUser with a name of 64 bytes or more acted on the existing user whose name is its 63-byte prefix. For example, dropUser with a 64-byte name dropped the 63-byte user and reported success. Both commands now reject names of NAMEDATALEN bytes or more before any role lookup or SQL generation, with the same error createUser already returns. The regression test covers both commands with username constraints enabled and disabled, a 64-byte name of two-byte characters, and checks that the 63-byte user and its password are left unchanged. Fixes documentdb#734 Signed-off-by: Godfred Arhinful <102437752+GodfredArhinful@users.noreply.github.com>
This branch has not been deployed
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.

Description
Fixes #734.
PostgreSQL truncates identifiers to 63 bytes.
dropUserandupdateUserpassed user names of 64 bytes or more through, so the request acted on the existing user whose name is the 63-byte prefix. Before this change,dropUserwith a 64-character name dropped an existing 63-character user and returnedok: 1.Both commands now reject names of
NAMEDATALEN(64) bytes or more before any role lookup or SQL generation, with the sameBadValueerror thatcreateUseralready returns (#730).Tests added to
user_crud_commands:dropUserandupdateUserwith a 64-byte name, withenableUsernamePasswordConstraintson and offrolpasswordis unchanged, and its exact name can still drop itWithout the fix, the same test shows the 63-byte user dropped by the first 64-byte request.
Type of Change
AI Disclosure
Checklist
git commit -s)