Commit 08873630 authored by Matt Kasa's avatar Matt Kasa

Change runners_token prefix for Group and Project

This changes the runners_token prefix for Group
and Project to a value that cannot be parsed as
an Integer and is unlikely to already exist in
the database.

Relates to https://gitlab.com/gitlab-org/security/gitlab/-/issues/608

Changelog: security
parent 518468d3
...@@ -23,9 +23,9 @@ class Group < Namespace ...@@ -23,9 +23,9 @@ class Group < Namespace
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
# Prefix for runners_token which can be used to invalidate existing tokens. # Prefix for runners_token which can be used to invalidate existing tokens.
# The value chosen here is a hex encoded YYYYMMDD date corresponding to # The value chosen here is GR (for Gitlab Runner) combined with the rotation
# the date before which tokens are invalidated. # date (20220225) decimal to hex encoded.
RUNNERS_TOKEN_PREFIX = '1348940' RUNNERS_TOKEN_PREFIX = 'GR1348941'
def self.sti_name def self.sti_name
'Group' 'Group'
......
...@@ -90,9 +90,9 @@ class Project < ApplicationRecord ...@@ -90,9 +90,9 @@ class Project < ApplicationRecord
DEFAULT_SQUASH_COMMIT_TEMPLATE = '%{title}' DEFAULT_SQUASH_COMMIT_TEMPLATE = '%{title}'
# Prefix for runners_token which can be used to invalidate existing tokens. # Prefix for runners_token which can be used to invalidate existing tokens.
# The value chosen here is a hex encoded YYYYMMDD date corresponding to # The value chosen here is GR (for Gitlab Runner) combined with the rotation
# the date before which tokens are invalidated. # date (20220225) decimal to hex encoded.
RUNNERS_TOKEN_PREFIX = '1348940' RUNNERS_TOKEN_PREFIX = 'GR1348941'
cache_markdown_field :description, pipeline: :description cache_markdown_field :description, pipeline: :description
......
...@@ -34,7 +34,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do ...@@ -34,7 +34,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do
end end
context 'when a prefix is required' do context 'when a prefix is required' do
let(:options) { { encrypted: :required, prefix: '1348940' } } let(:options) { { encrypted: :required, prefix: 'GR1348941' } }
it 'finds the encrypted resource by cleartext' do it 'finds the encrypted resource by cleartext' do
allow(model).to receive(:where) allow(model).to receive(:where)
...@@ -79,7 +79,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do ...@@ -79,7 +79,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do
end end
context 'when a prefix is required' do context 'when a prefix is required' do
let(:options) { { encrypted: :optional, prefix: '1348940' } } let(:options) { { encrypted: :optional, prefix: 'GR1348941' } }
it 'finds the encrypted resource by cleartext' do it 'finds the encrypted resource by cleartext' do
allow(model).to receive(:where) allow(model).to receive(:where)
...@@ -120,7 +120,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do ...@@ -120,7 +120,7 @@ RSpec.describe TokenAuthenticatableStrategies::Encrypted do
end end
context 'when a prefix is required' do context 'when a prefix is required' do
let(:options) { { encrypted: :migrating, prefix: '1348940' } } let(:options) { { encrypted: :migrating, prefix: 'GR1348941' } }
it 'finds the encrypted resource by cleartext' do it 'finds the encrypted resource by cleartext' do
allow(model).to receive(:where) allow(model).to receive(:where)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment