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
11f54caa
Commit
11f54caa
authored
Sep 13, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow trailing newline in secret base64 data
parent
82b8cc5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+1
-1
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+5
-0
No files found.
lib/gitlab/workhorse.rb
View file @
11f54caa
...
@@ -102,7 +102,7 @@ module Gitlab
...
@@ -102,7 +102,7 @@ module Gitlab
def
secret
def
secret
@secret
||=
begin
@secret
||=
begin
bytes
=
Base64
.
strict_decode64
(
File
.
read
(
secret_path
))
bytes
=
Base64
.
strict_decode64
(
File
.
read
(
secret_path
)
.
chomp
)
raise
"
#{
secret_path
}
does not contain
#{
SECRET_LENGTH
}
bytes"
if
bytes
.
length
!=
SECRET_LENGTH
raise
"
#{
secret_path
}
does not contain
#{
SECRET_LENGTH
}
bytes"
if
bytes
.
length
!=
SECRET_LENGTH
bytes
bytes
end
end
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
11f54caa
...
@@ -30,6 +30,11 @@ describe Gitlab::Workhorse, lib: true do
...
@@ -30,6 +30,11 @@ describe Gitlab::Workhorse, lib: true do
expect
(
subject
.
encoding
).
to
eq
(
Encoding
::
ASCII_8BIT
)
expect
(
subject
.
encoding
).
to
eq
(
Encoding
::
ASCII_8BIT
)
end
end
it
'accepts a trailing newline'
do
open
(
described_class
.
secret_path
,
'a'
)
{
|
f
|
f
.
write
"
\n
"
}
expect
(
subject
.
length
).
to
eq
(
32
)
end
it
'raises an exception if the secret file cannot be read'
do
it
'raises an exception if the secret file cannot be read'
do
File
.
delete
(
described_class
.
secret_path
)
File
.
delete
(
described_class
.
secret_path
)
expect
{
subject
}.
to
raise_exception
(
Errno
::
ENOENT
)
expect
{
subject
}.
to
raise_exception
(
Errno
::
ENOENT
)
...
...
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