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
b7f35e89
Commit
b7f35e89
authored
Nov 28, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expire application settings after encrypting tokens
parent
7d2b37bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
app/models/concerns/token_authenticatable_strategies/encrypted.rb
...ls/concerns/token_authenticatable_strategies/encrypted.rb
+3
-0
lib/gitlab/background_migration/models/encrypt_columns/settings.rb
...b/background_migration/models/encrypt_columns/settings.rb
+5
-0
No files found.
app/models/concerns/token_authenticatable_strategies/encrypted.rb
View file @
b7f35e89
...
...
@@ -25,6 +25,9 @@ module TokenAuthenticatableStrategies
#
# In that case we are using insecure strategy, but this should only happen
# in tests, because otherwise `encrypted_field` is going to exist.
#
# Another use case is when we are caching resources / columns, like we do
# in case of ApplicationSetting.
return
super
if
instance
.
has_attribute?
(
encrypted_field
)
...
...
lib/gitlab/background_migration/models/encrypt_columns/settings.rb
View file @
b7f35e89
...
...
@@ -9,10 +9,15 @@ module Gitlab
#
class
Settings
<
ActiveRecord
::
Base
include
::
EachBatch
include
::
CacheableAttributes
self
.
table_name
=
'application_settings'
self
.
inheritance_column
=
:_type_disabled
after_commit
do
ApplicationSetting
.
expire
end
def
runners_registration_token
=
(
value
)
self
.
runners_registration_token_encrypted
=
::
Gitlab
::
CryptoHelper
.
aes256_gcm_encrypt
(
value
)
...
...
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