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
e6cc5f2a
Commit
e6cc5f2a
authored
Nov 23, 2020
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply 6 suggestion(s) to 2 file(s)
parent
add38cc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
lib/gitlab/encrypted_configuration.rb
lib/gitlab/encrypted_configuration.rb
+5
-5
spec/lib/gitlab/encrypted_configuration_spec.rb
spec/lib/gitlab/encrypted_configuration_spec.rb
+1
-1
No files found.
lib/gitlab/encrypted_configuration.rb
View file @
e6cc5f2a
...
...
@@ -41,7 +41,7 @@ module Gitlab
def
read
if
active?
decrypt
content_path
.
binread
decrypt
(
content_path
.
binread
)
else
""
end
...
...
@@ -55,7 +55,7 @@ module Gitlab
File
.
open
(
temp_file
.
path
,
'wb'
)
do
|
file
|
file
.
write
(
encrypt
(
contents
))
end
FileUtils
.
mv
temp_file
.
path
,
content_path
FileUtils
.
mv
(
temp_file
.
path
,
content_path
)
ensure
temp_file
&
.
unlink
end
...
...
@@ -71,7 +71,7 @@ module Gitlab
end
def
change
(
&
block
)
writing
read
,
&
block
writing
(
read
,
&
block
)
end
private
...
...
@@ -84,12 +84,12 @@ module Gitlab
def
encrypt
(
contents
)
handle_missing_key!
encryptor
.
encrypt_and_sign
contents
encryptor
.
encrypt_and_sign
(
contents
)
end
def
decrypt
(
contents
)
handle_missing_key!
encryptor
.
decrypt_and_verify
contents
encryptor
.
decrypt_and_verify
(
contents
)
end
def
encryptor
...
...
spec/lib/gitlab/encrypted_configuration_spec.rb
View file @
e6cc5f2a
...
...
@@ -79,7 +79,7 @@ RSpec.describe Gitlab::EncryptedConfiguration do
expect
(
config
.
foo
[
:bar
]).
to
be
true
end
it
'throws a custom error when
d
eferencing an invalid key map config'
do
it
'throws a custom error when
r
eferencing an invalid key map config'
do
config
=
described_class
.
new
(
content_path:
credentials_config_path
,
base_key:
credentials_key
)
config
.
write
(
"stringcontent"
)
...
...
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