Allow "." and long usernames in the DCV authenticator#3208
Open
hanwen-cluster wants to merge 2 commits into
Open
Allow "." and long usernames in the DCV authenticator#3208hanwen-cluster wants to merge 2 commits into
hanwen-cluster wants to merge 2 commits into
Conversation
af42acc to
3dc16d9
Compare
The DCV external rejected valid usernames in two ways: 1. USER_REGEX did not permit ".", so usernames such as "first.last" failed validation with "The authUser parameter is not valid". 2. Session ownership was verified by parsing `ps aux`, whose USER column is truncated to 8 characters. For usernames longer than 8 characters the truncated name never matched, so valid sessions were reported as non-existent. Changes: - Add "." to the allowed characters in USER_REGEX. - Resolve the username to its numeric UID (pwd.getpwnam) and match it against the UID column from `ps -eo uid,args` instead of comparing the (truncatable) username from `ps aux`. This is robust for names of any length and avoids the fragile fixed-column parsing. - Raise error when the user does not exist on the system. Note: usernames containing uppercase characters are still rejected by USER_REGEX; that is a separate, pre-existing limitation and is out of scope here. This commit addresses aws/aws-parallelcluster#7352, aws#2472, aws/aws-parallelcluster#7345
3dc16d9 to
699589e
Compare
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 of changes
The DCV external rejected valid usernames in two ways:
USER_REGEX did not permit ".", so usernames such as "first.last" failed validation with "The authUser parameter is not valid".
Session ownership was verified by parsing
ps aux, whose USER column is truncated to 8 characters. For usernames longer than 8 characters the truncated name never matched, so valid sessions were reported as non-existent.Changes:
ps -eo uid,argsinstead of comparing the (truncatable) username fromps aux. This is robust for names of any length and avoids the fragile fixed-column parsing.Note: usernames containing uppercase characters are still rejected by USER_REGEX; that is a separate, pre-existing limitation and is out of scope here.
This commit addresses aws/aws-parallelcluster#7352, #2472, aws/aws-parallelcluster#7345
Tests
The following tests have been passed
References
Checklist
developadd the branch name as prefix in the PR title (e.g.[release-3.6]).Please review the guidelines for contributing and Pull Request Instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.