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
Boxiang Sun
gitlab-ce
Commits
b26fd49e
Commit
b26fd49e
authored
Apr 04, 2019
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catching and cleanly reporting SSL errors in Ci::Config::External::Processor
parent
95bbcf08
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
changelogs/unreleased/ci-lint-ssl-error.yml
changelogs/unreleased/ci-lint-ssl-error.yml
+6
-0
lib/gitlab/ci/config/external/processor.rb
lib/gitlab/ci/config/external/processor.rb
+2
-1
spec/lib/gitlab/ci/config/external/processor_spec.rb
spec/lib/gitlab/ci/config/external/processor_spec.rb
+22
-0
No files found.
changelogs/unreleased/ci-lint-ssl-error.yml
0 → 100644
View file @
b26fd49e
---
title
:
Catch and report OpenSSL exceptions while fetching external configuration files
in CI::Config
merge_request
:
26750
author
:
Drew Cimino
type
:
fixed
lib/gitlab/ci/config/external/processor.rb
View file @
b26fd49e
...
@@ -11,7 +11,8 @@ module Gitlab
...
@@ -11,7 +11,8 @@ module Gitlab
@values
=
values
@values
=
values
@external_files
=
External
::
Mapper
.
new
(
values
,
project:
project
,
sha:
sha
,
user:
user
,
expandset:
expandset
).
process
@external_files
=
External
::
Mapper
.
new
(
values
,
project:
project
,
sha:
sha
,
user:
user
,
expandset:
expandset
).
process
@content
=
{}
@content
=
{}
rescue
External
::
Mapper
::
Error
=>
e
rescue
External
::
Mapper
::
Error
,
OpenSSL
::
SSL
::
SSLError
=>
e
raise
IncludeError
,
e
.
message
raise
IncludeError
,
e
.
message
end
end
...
...
spec/lib/gitlab/ci/config/external/processor_spec.rb
View file @
b26fd49e
...
@@ -270,5 +270,27 @@ describe Gitlab::Ci::Config::External::Processor do
...
@@ -270,5 +270,27 @@ describe Gitlab::Ci::Config::External::Processor do
end
end
end
end
end
end
context
'when config includes an external configuration file via SSL web request'
do
before
do
stub_request
(
:get
,
'https://sha256.badssl.com/fake.yml'
).
to_return
(
body:
'image: ruby:2.6'
,
status:
200
)
stub_request
(
:get
,
'https://self-signed.badssl.com/fake.yml'
)
.
to_raise
(
OpenSSL
::
SSL
::
SSLError
.
new
(
'SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)'
))
end
context
'with an acceptable certificate'
do
let
(
:values
)
{
{
include:
'https://sha256.badssl.com/fake.yml'
}
}
it
{
is_expected
.
to
include
(
image:
'ruby:2.6'
)
}
end
context
'with a self-signed certificate'
do
let
(
:values
)
{
{
include:
'https://self-signed.badssl.com/fake.yml'
}
}
it
'returns a reportable configuration error'
do
expect
{
subject
}.
to
raise_error
(
described_class
::
IncludeError
,
/certificate verify failed/
)
end
end
end
end
end
end
end
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