Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Disallow slashes and other naughty strings in project names #4295

Closed
mattbk opened this issue Jan 16, 2017 · 10 comments
Closed

Disallow slashes and other naughty strings in project names #4295

mattbk opened this issue Jan 16, 2017 · 10 comments
Labels

Comments

@mattbk
Copy link
Contributor

mattbk commented Jan 16, 2017

Per some security researchers, we get project names like this:

All of these break the URL, so the project page can't be reached and needs to be manually removed from the database.

Not a security issue, but is an annoyance and could be used for spam.

@chadwhitacre
Copy link
Contributor

@dmk246 @EdOverflow Would one of you be able to cross-link this to the relevant HackerOne ticket?

@EdOverflow
Copy link
Contributor

@whit537 Done. https://hackerone.com/reports/176396

@mattbk
Copy link
Contributor Author

mattbk commented Jan 17, 2017

Potentially useful? https://github.com/minimaxir/big-list-of-naughty-strings

@mattbk
Copy link
Contributor Author

mattbk commented Feb 1, 2017

These types of names also produce errors on the front page (FD):

there is one failing request to
https://gratipay.com/x.x/?>/image?size=small, which returns a 404 error.

@mattbk mattbk changed the title Disallow slashes in project names Disallow slashes and other naughty strings in project names Feb 1, 2017
@mattbk
Copy link
Contributor Author

mattbk commented Mar 8, 2017

NB, to delete existing bad projects, use branch.sql.
http://gratipay.slackarchive.io/gratipay/-/1488556344.00768/1488986867.00782/1488986782007817/

@mattbk
Copy link
Contributor Author

mattbk commented Mar 8, 2017

Interesting.

TEAM_NAME_PATTERN = re.compile(r'^(?=.*[A-Za-z])([A-Za-z0-9.,-_ ]+)$')

@mattbk
Copy link
Contributor Author

mattbk commented Mar 9, 2017

Those are the required characters. At least one letter and then you can have some other stuff that isn't required.

/me wanders off to learn how to regex out / and ? at the same time...

@chadwhitacre
Copy link
Contributor

chadwhitacre commented Mar 9, 2017

@mattbk I'm pretty sure there's a bug in the regex because - indicates a range encompassing all of the ASCII characters between , and _. If this hypothesis is correct than the way to fix is probably for the - to be the last character in the set.

@chadwhitacre
Copy link
Contributor

Note that there's another similar regex for usernames which may have the same bug.

@mattbk
Copy link
Contributor Author

mattbk commented Mar 9, 2017

I will try that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants