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