500 error when adding a new project with a repository name starting with question mark.
Created by: bruffridge
The regex for validating repository names allows question marks and periods to start the name. I tried adding a new project with a repo name that starts with a question mark and got a 500 error on the POST request and on all subsequent GET requests to the server.
Looks like the bug was introduced here: https://github.com/gitlabhq/gitlabhq/commit/cc1f7ea2de68ba7d2f45a65e36549c63fb23508f
https://github.com/gitlabhq/gitlabhq/blob/master/lib/gitlab/regex.rb#L52 Offending regex: /\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_-.]*(?<!.git)\z/
It seems the regex was designed to allow filenames to start with a period ONLY, in which case the regex should be:
/\A[.]?[a-zA-Z0-9_][a-zA-Z0-9_-.]*(?<!.git)\z/
If repo names shouldn't be allowed to start with a period either than alter project.rb and reference a different regex instead of path_regex:
https://github.com/gitlabhq/gitlabhq/blob/master/app/models/project.rb#L96