BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
414daf34
Commit
414daf34
authored
Jun 04, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-fix-secrets-not-working' into 'master'
Fix attr_encryption key settings Closes #47166 See merge request gitlab-org/gitlab-ce!19341
parents
9b20be45
ca466d5d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
12 deletions
+24
-12
kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+2
-2
gcp.rb
app/models/clusters/providers/gcp.rb
+1
-1
sh-fix-secrets-not-working.yml
changelogs/unreleased/sh-fix-secrets-not-working.yml
+5
-0
settings.rb
config/settings.rb
+15
-8
20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
...grate_kubernetes_service_to_new_clusters_architectures.rb
+1
-1
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
414daf34
...
@@ -11,12 +11,12 @@ module Clusters
...
@@ -11,12 +11,12 @@ module Clusters
attr_encrypted
:password
,
attr_encrypted
:password
,
mode: :per_attribute_iv
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base
,
key:
Settings
.
attr_encrypted_db_key_base
_truncated
,
algorithm:
'aes-256-cbc'
algorithm:
'aes-256-cbc'
attr_encrypted
:token
,
attr_encrypted
:token
,
mode: :per_attribute_iv
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base
,
key:
Settings
.
attr_encrypted_db_key_base
_truncated
,
algorithm:
'aes-256-cbc'
algorithm:
'aes-256-cbc'
before_validation
:enforce_namespace_to_lower_case
before_validation
:enforce_namespace_to_lower_case
...
...
app/models/clusters/providers/gcp.rb
View file @
414daf34
...
@@ -11,7 +11,7 @@ module Clusters
...
@@ -11,7 +11,7 @@ module Clusters
attr_encrypted
:access_token
,
attr_encrypted
:access_token
,
mode: :per_attribute_iv
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base
,
key:
Settings
.
attr_encrypted_db_key_base
_truncated
,
algorithm:
'aes-256-cbc'
algorithm:
'aes-256-cbc'
validates
:gcp_project_id
,
validates
:gcp_project_id
,
...
...
changelogs/unreleased/sh-fix-secrets-not-working.yml
0 → 100644
View file @
414daf34
---
title
:
Fix attr_encryption key settings
merge_request
:
author
:
type
:
fixed
config/settings.rb
View file @
414daf34
...
@@ -85,17 +85,24 @@ class Settings < Settingslogic
...
@@ -85,17 +85,24 @@ class Settings < Settingslogic
File
.
expand_path
(
path
,
Rails
.
root
)
File
.
expand_path
(
path
,
Rails
.
root
)
end
end
# Returns a 256-bit key for attr_encrypted
# Ruby 2.4+ requires passing in the exact required length for OpenSSL keys
def
attr_encrypted_db_key_base
# (https://github.com/ruby/ruby/commit/ce635262f53b760284d56bb1027baebaaec175d1).
# Ruby 2.4+ requires passing in the exact required length for OpenSSL keys
# Previous versions quietly truncated the input.
# (https://github.com/ruby/ruby/commit/ce635262f53b760284d56bb1027baebaaec175d1).
#
# Previous versions quietly truncated the input.
# Use this when using :per_attribute_iv mode for attr_encrypted.
#
# We have to truncate the string to 32 bytes for a 256-bit cipher.
# The default mode for the attr_encrypted gem is to use a 256-bit key.
def
attr_encrypted_db_key_base_truncated
# We truncate the 128-byte string to 32 bytes.
Gitlab
::
Application
.
secrets
.
db_key_base
[
0
..
31
]
Gitlab
::
Application
.
secrets
.
db_key_base
[
0
..
31
]
end
end
# This should be used for :per_attribute_salt_and_iv mode. There is no
# need to truncate the key because the encryptor will use the salt to
# generate a hash of the password:
# https://github.com/attr-encrypted/encryptor/blob/c3a62c4a9e74686dd95e0548f9dc2a361fdc95d1/lib/encryptor.rb#L77
def
attr_encrypted_db_key_base
Gitlab
::
Application
.
secrets
.
db_key_base
end
private
private
def
base_url
(
config
)
def
base_url
(
config
)
...
...
db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
View file @
414daf34
...
@@ -48,7 +48,7 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -48,7 +48,7 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
attr_encrypted
:token
,
attr_encrypted
:token
,
mode: :per_attribute_iv
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base
,
key:
Settings
.
attr_encrypted_db_key_base
_truncated
,
algorithm:
'aes-256-cbc'
algorithm:
'aes-256-cbc'
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