lib/logstop.rb in logstop-0.2.6 vs lib/logstop.rb in logstop-0.2.7

- old
+ new

@@ -2,18 +2,18 @@ require "logstop/railtie" if defined?(Rails) require "logstop/version" module Logstop FILTERED_STR = "[FILTERED]".freeze - FILTERED_URL_STR = "\\1[FILTERED]@".freeze + FILTERED_URL_STR = "\\1[FILTERED]\\2".freeze CREDIT_CARD_REGEX = /\b[3456]\d{15}\b/ CREDIT_CARD_REGEX_DELIMITERS = /\b[3456]\d{3}[\s+-]\d{4}[\s+-]\d{4}[\s+-]\d{4}\b/ - EMAIL_REGEX = /\b[\w][\w+.-]+(@|%40)[a-z\d-]+(\.[a-z\d-]+)*\.[a-z]+\b/i + EMAIL_REGEX = /\b[\w]([\w+.-]|%2B)+(?:@|%40)[a-z\d-]+(?:\.[a-z\d-]+)*\.[a-z]+\b/i IP_REGEX = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/ - PHONE_REGEX = /\b(\+\d{1,2}\s)?\(?\d{3}\)?[\s+.-]\d{3}[\s+.-]\d{4}\b/ + PHONE_REGEX = /\b(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s+.-]\d{3}[\s+.-]\d{4}\b/ SSN_REGEX = /\b\d{3}[\s+-]\d{2}[\s+-]\d{4}\b/ - URL_PASSWORD_REGEX = /((\/\/|%2F%2F)\S+(:|%3A))\S+(@|%40)/ + URL_PASSWORD_REGEX = /((?:\/\/|%2F%2F)\S+(?::|%3A))\S+(@|%40)/ def self.scrub(msg, ip: false, scrubber: nil) msg = msg.to_s.dup # order filters are applied is important