Skip to content

Commit

Permalink
Merge pull request ManageIQ#377 from mkanoor/constant
Browse files Browse the repository at this point in the history
Use a constant mask for encrypted fields
  • Loading branch information
kbrock authored Sep 28, 2018
2 parents cf57796 + 1305359 commit b66b7ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/gems/pending/util/miq-password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class MiqPasswordError < StandardError; end
REGEXP = /v([0-2]):\{([^}]*)\}/
REGEXP_PASSWORD = /v[0-2](:\{[^}]*\}|%3A%7B.*?%7D)/ # for "v2:{...}" or its URL encoded string
REGEXP_START_LINE = /^#{REGEXP}/
MASK = '********'.freeze

attr_reader :encStr

Expand Down Expand Up @@ -82,11 +83,11 @@ def self.sysprep_crypt(str)
end

def self.sanitize_string(s)
s.gsub(REGEXP_PASSWORD, '********')
s.gsub(REGEXP_PASSWORD, MASK)
end

def self.sanitize_string!(s)
s.gsub!(REGEXP_PASSWORD, '********')
s.gsub!(REGEXP_PASSWORD, MASK)
end

def self.try_decrypt(str)
Expand Down

0 comments on commit b66b7ad

Please sign in to comment.