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

Resolver for URLs with usernames do not include all valid characters #439

Closed
seav opened this issue Jul 14, 2016 · 4 comments
Closed

Resolver for URLs with usernames do not include all valid characters #439

seav opened this issue Jul 14, 2016 · 4 comments
Assignees
Labels

Comments

@seav
Copy link
Contributor

seav commented Jul 14, 2016

URLs that contain usernames use the following regex to capture the username: [-\w]+. This does not match the actual allowed characters for Django usernames found in django.contrib.auth.validators: [\w.@+-]+.

This results in website errors when usernames containing periods, at signs, or plus signs.

@seav
Copy link
Contributor Author

seav commented Jul 14, 2016

This affects the following URLs:

Website:
/organizations/<org>/members/<username>/
/organizations/<org>/members/<username>/remove/
/users/<username>/activate/
/users/<username>/deactivate/

API:
/organizations/<org>/users/<username>/
/organizations/<org>/projects/<project>/users/<username>/

@oliverroick
Copy link
Member

Three possible solutions here:

  1. Restrict user names to [-\w]+
  2. Change the URL pattern [\w.@+-]+. (Are . or @ allowed in URLs, I don't know).
  3. Change the URL pattern to use the user ID.

@seav
Copy link
Contributor Author

seav commented Jul 14, 2016

Number 2 seems to be the simplest to implement. I think . and @ are allowed in URLs. If not, they will get URL-encoded anyway, just like other Unicode characters.

@seav seav added the bug label Jul 14, 2016
@ian-ross
Copy link
Contributor

Both . and @ are explicitly allowed in URLs without encoding (see the BNF syntax here: https://www.w3.org/Addressing/URL/uri-spec.html#z8), so option 2 is definitely the best.

@ian-ross ian-ross self-assigned this Jul 14, 2016
oliverroick added a commit that referenced this issue Jul 14, 2016
Fix #439: characters in usernames in URLs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants