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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b9d00365
Commit
b9d00365
authored
May 21, 2018
by
Mayra Cabrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs to ensure internal url are blocked
Also rescue Gitlab::HTTP::BlockedUrlError
parent
b44fdca0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
ee/lib/gitlab/ci/external/file/remote.rb
ee/lib/gitlab/ci/external/file/remote.rb
+1
-1
ee/spec/lib/gitlab/ci/external/file/remote_spec.rb
ee/spec/lib/gitlab/ci/external/file/remote_spec.rb
+16
-0
No files found.
ee/lib/gitlab/ci/external/file/remote.rb
View file @
b9d00365
...
...
@@ -12,7 +12,7 @@ module Gitlab
@content
=
strong_memoize
(
:content
)
do
begin
Gitlab
::
HTTP
.
get
(
location
)
rescue
Gitlab
::
HTTP
::
Error
,
Timeout
::
Error
,
SocketError
rescue
Gitlab
::
HTTP
::
Error
,
Timeout
::
Error
,
SocketError
,
Gitlab
::
HTTP
::
BlockedUrlError
nil
end
end
...
...
ee/spec/lib/gitlab/ci/external/file/remote_spec.rb
View file @
b9d00365
...
...
@@ -50,6 +50,14 @@ describe Gitlab::Ci::External::File::Remote do
expect
(
remote_file
.
valid?
).
to
be_falsy
end
end
context
'with an internal url'
do
let
(
:location
)
{
'http://localhost:8080'
}
it
'should be falsy'
do
expect
(
remote_file
.
valid?
).
to
be_falsy
end
end
end
describe
"#content"
do
...
...
@@ -84,6 +92,14 @@ describe Gitlab::Ci::External::File::Remote do
expect
(
remote_file
.
content
).
to
be_nil
end
end
context
'with an internal url'
do
let
(
:location
)
{
'http://localhost:8080'
}
it
'should be nil'
do
expect
(
remote_file
.
content
).
to
be_nil
end
end
end
describe
"#error_message"
do
...
...
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