2018-10-26 00:12:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-06 07:26:15 -04:00
|
|
|
module Gitlab
|
|
|
|
module Ci::MaskSecret
|
|
|
|
class << self
|
|
|
|
def mask!(value, token)
|
|
|
|
return value unless value.present? && token.present?
|
|
|
|
|
2018-10-26 00:12:43 -04:00
|
|
|
# We assume 'value' must be mutable, given
|
|
|
|
# that frozen string is enabled.
|
2020-08-27 20:10:34 -04:00
|
|
|
|
2020-12-15 07:10:17 -05:00
|
|
|
value.gsub!(token, 'x' * token.bytesize)
|
2017-09-06 07:26:15 -04:00
|
|
|
value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|