Commit graph

21 commits

Author SHA1 Message Date
Semyon Pupkov
869d8e814e Fix UriDefaultParser cop 2018-09-21 12:37:57 +05:00
Stan Hu
50ff362650 Escape username and password in UrlSanitizer#full_url
If a user uses a password with certain characters (e.g. /, #, +, etc.)
UrlSanitizer#full_url will generate an invalid URL that cannot be
parsed properly by Addressable::URI. If used with UrlBlocker, this
will be flagged as an invalid URI.
2018-07-19 03:14:07 -07:00
Stan Hu
718a23fd36 Properly handle colons in URL passwords
Before b46d5b13ec, we relied on
`Addressable::URI` to parse the username/password in a URL, but this failed
when credentials contained special characters. However, this introduced a regression
where the parsing would incorrectly truncate the password if the password had a colon.

Closes #49080
2018-07-10 13:09:37 -07:00
Jacopo
181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Lin Jen-Shin
e9ffa33951 Freeze the constant array 2017-10-02 14:45:58 +08:00
Lin Jen-Shin
9401c137fd Just allow the scheme we want! 2017-09-29 21:45:00 +08:00
Lin Jen-Shin
f7fd36f2a2 Adapt to the latest addressable behaviour 2017-09-29 20:42:27 +08:00
Lin Jen-Shin
87328fa978 Make sure we didn't blow up if URI is invalid 2017-09-28 21:49:37 +08:00
Nick Thomas
b46d5b13ec Backport more EE changes to Gitlab::UrlSanitizer 2017-09-11 21:43:43 +01:00
Nick Thomas
c8bdb20228 Remove blank passwords from sanitized URLs 2017-09-06 15:29:14 +01:00
Nick Thomas
759f34bd0a Backport EE fixes to Gitlab::UrlSanitizer to CE 2017-09-06 15:29:13 +01:00
Rémy Coutable
bf4cc9e1f3
Don't allow to pass a user to ProjectWiki#http_url_to_repo
This partially reverts be25bbc4d2.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-30 14:18:58 +02:00
Rémy Coutable
be25bbc4d2 Fix ProjectWiki#http_url_to_repo signature
New Gitlab::UrlSanitizer.http_credentials_for_user method responsible
for generating a credentials hash from a user.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-20 16:24:01 +01:00
Toon Claes
c92808ed32 Fix for creating a project through API when import_url is nil
The API was returning 500 when `nil` is passed for the `import_url`.

In fact, it was `Gitlab::UrlSanitizer.valid?` which was throwing a
`NoMethodError` when `nil` value was passed.
2017-03-10 10:03:03 +01:00
Douwe Maan
7d4b52b27d Enable Style/WordArray 2017-02-23 09:32:41 -06:00
James Lopez
99f7b6d246 spec and fix for sanitize method 2016-07-11 09:01:09 +02:00
James Lopez
ef5713546b few more changes from suggestions 2016-06-30 17:22:56 +02:00
James Lopez
545b92af06 use class method 2016-06-30 14:30:07 +02:00
James Lopez
5b893d603d few changes based on feedback 2016-06-30 13:17:37 +02:00
James Lopez
d83ce65c1a fix changelog and merge 2016-05-23 09:11:21 +02:00
Rubén Dávila
0c47b68d04 Mask credentials from URL when import of project has failed. 2016-05-18 21:16:36 -05:00
Renamed from lib/gitlab/import_url.rb (Browse further)