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.
|
2017-09-06 07:26:15 -04:00
|
|
|
value.gsub!(token, 'x' * token.length)
|
|
|
|
value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|