Skip to content
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

Incorrect username validation #8

Open
ferrreo opened this issue Jul 2, 2024 · 6 comments
Open

Incorrect username validation #8

ferrreo opened this issue Jul 2, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@ferrreo
Copy link
Member

ferrreo commented Jul 2, 2024

Here we are checking for only alphanumeric: https://github.com/PikaOS-Linux/pkg-pika-first-setup/blob/c6b9d3743223bdc0611bdf0c80dc3ea902742cc7/src/first_setup/user_carousel/mod.rs#L232C12-L232C29

This needs to instead use the regexes of NAME_REGEX and SYS_NAME_REGEX to check against as this is what adduser does.

@ferrreo ferrreo added the bug Something isn't working label Jul 2, 2024
@CosmicFusion
Copy link
Collaborator

Default regex

Allows !"#$%&'()*+,-./ many scripts don't account for that

It may have some unforseen consequences

I think having strictly lower case alphanumeric usernames, and leaving the Fancy Stuff to gecos fullname

I may be wrong if I am I will happily implement it

@CosmicFusion
Copy link
Collaborator

So as far as I can see online

  • vanilla-installer
  • calamares
  • cinnamon settings
  • gnome settings
  • plasma settings
  • ubiquity

All ignore The name regex

As they are apparently really volatile, and cause and Unprofessionally written scripts to break

@ferrreo
Copy link
Member Author

ferrreo commented Jul 3, 2024

Default regex

Allows !"#$%&'()*+,-./ many scripts don't account for that

It may have some unforseen consequences

I think having strictly lower case alphanumeric usernames, and leaving the Fancy Stuff to gecos fullname

I may be wrong if I am I will happily implement it

This is wrong. Those regexes only allow -_. and alphanumeric (also can't start with a .). If they are allowing any more then our config to set those regexes are incorrect and none standard.

We should be allowing whatever adduser allows, it has all the protections in place already, that's why it has a --allow-bad-names flag to override if you need (we do not need).

@ferrreo
Copy link
Member Author

ferrreo commented Jul 3, 2024

So as far as I can see online

  • vanilla-installer
  • calamares
  • cinnamon settings
  • gnome settings
  • plasma settings
  • ubiquity

All ignore The name regex

As they are apparently really volatile, and cause and Unprofessionally written scripts to break

Not correct, they all seem to be allowing - _ and . except calamares (not tried vanilla)? So they are either using the regexes or implemented their own version of the default check.

@CosmicFusion
Copy link
Collaborator

So as far as I can see online

  • vanilla-installer
  • calamares
  • cinnamon settings
  • gnome settings
  • plasma settings
  • ubiquity

All ignore The name regex

As they are apparently really volatile, and cause and Unprofessionally written scripts to break

Not correct, they all seem to be allowing - _ and . except calamares (not tried vanilla)? So they are either using the regexes or implemented their own version of the default check.

Ok... I will switch the regex

@erenfro
Copy link

erenfro commented Jul 4, 2024

Thank you very much for looking into this!
I wanted to point out, "VALID NAMES" section of man 5 adduser.conf shows basically that usernames must start with a lowercase alpha character (system users can start with underscore additionally), be all lower-case, and can include digits, dash, and underscore, in current spec. Historically it could also include periods, @ signs, and end in $ specifically due to samba machine accounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants