Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
401be1d1
Commit
401be1d1
authored
Dec 08, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allow strings in URL::Sanitizer.valid?
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/55079
parent
7cb0dd98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
0 deletions
+7
-0
changelogs/unreleased/sh-ignore-arrays-url-sanitizer.yml
changelogs/unreleased/sh-ignore-arrays-url-sanitizer.yml
+5
-0
lib/gitlab/url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+1
-0
spec/lib/gitlab/url_sanitizer_spec.rb
spec/lib/gitlab/url_sanitizer_spec.rb
+1
-0
No files found.
changelogs/unreleased/sh-ignore-arrays-url-sanitizer.yml
0 → 100644
View file @
401be1d1
---
title
:
Only allow strings in URL::Sanitizer.valid?
merge_request
:
23675
author
:
type
:
fixed
lib/gitlab/url_sanitizer.rb
View file @
401be1d1
...
@@ -14,6 +14,7 @@ module Gitlab
...
@@ -14,6 +14,7 @@ module Gitlab
def
self
.
valid?
(
url
)
def
self
.
valid?
(
url
)
return
false
unless
url
.
present?
return
false
unless
url
.
present?
return
false
unless
url
.
is_a?
(
String
)
uri
=
Addressable
::
URI
.
parse
(
url
.
strip
)
uri
=
Addressable
::
URI
.
parse
(
url
.
strip
)
...
...
spec/lib/gitlab/url_sanitizer_spec.rb
View file @
401be1d1
...
@@ -41,6 +41,7 @@ describe Gitlab::UrlSanitizer do
...
@@ -41,6 +41,7 @@ describe Gitlab::UrlSanitizer do
false
|
'123://invalid:url'
false
|
'123://invalid:url'
false
|
'valid@project:url.git'
false
|
'valid@project:url.git'
false
|
'valid:pass@project:url.git'
false
|
'valid:pass@project:url.git'
false
|
%w(test array)
true
|
'ssh://example.com'
true
|
'ssh://example.com'
true
|
'ssh://:@example.com'
true
|
'ssh://:@example.com'
true
|
'ssh://foo@example.com'
true
|
'ssh://foo@example.com'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment