Sha256: b874eb3a5cbdc8742cf5c84ea41b7921300acab172d29170141aa30e1695f82e
Contents?: true
Size: 790 Bytes
Versions: 11
Compression:
Stored size: 790 Bytes
Contents
module Vagrant module Util # Utility class to remove credential information from strings class CredentialScrubber # String used to replace credential information REPLACEMENT_TEXT = "*****".freeze # Attempt to remove detected credentials from string # # @param [String] string # @return [String] def self.scrub(string) string = url_scrubber(string) end # Detect URLs and remove any embedded credentials # # @param [String] string # @return [String] def self.url_scrubber(string) string.gsub(%r{(ftp|https?)://[^\s]+@[^\s]+}) do |address| uri = URI.parse(address) uri.user = uri.password = REPLACEMENT_TEXT uri.to_s end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems