Commit 3a8ad2ed authored by Grzegorz Bizon's avatar Grzegorz Bizon

Ensure that secrets masking does not change bytesize

parent 51ba77d5
...@@ -9,11 +9,7 @@ module Gitlab ...@@ -9,11 +9,7 @@ module Gitlab
# We assume 'value' must be mutable, given # We assume 'value' must be mutable, given
# that frozen string is enabled. # that frozen string is enabled.
## value.gsub!(token, 'x' * token.bytesize)
# TODO We need to remove this because it is going to change checksum of
# a trace.
#
value.gsub!(token, 'x' * token.length)
value value
end end
end end
......
...@@ -22,6 +22,10 @@ RSpec.describe Gitlab::Ci::MaskSecret do ...@@ -22,6 +22,10 @@ RSpec.describe Gitlab::Ci::MaskSecret do
expect(mask('token', nil)).to eq('token') expect(mask('token', nil)).to eq('token')
end end
it 'does not change a bytesize of a value' do
expect(mask('token-ü/unicode', 'token-ü').bytesize).to eq 16
end
def mask(value, token) def mask(value, token)
subject.mask!(value.dup, token) subject.mask!(value.dup, token)
end end
......
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