lib/logstop.rb in logstop-0.3.0 vs lib/logstop.rb in logstop-0.3.1

- old
+ new

@@ -1,8 +1,8 @@ -require "logstop/formatter" -require "logstop/railtie" if defined?(Rails) -require "logstop/version" +require_relative "logstop/formatter" +require_relative "logstop/railtie" if defined?(Rails) +require_relative "logstop/version" module Logstop FILTERED_STR = "[FILTERED]".freeze FILTERED_URL_STR = "\\1[FILTERED]\\2".freeze @@ -11,10 +11,10 @@ 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/ E164_PHONE_REGEX = /(?:\+|%2B)[1-9]\d{6,14}\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)/ MAC_REGEX = /\b[0-9a-f]{2}(?:(?::|%3A)[0-9a-f]{2}){5}\b/i def self.scrub(msg, url_password: true, email: true, credit_card: true, phone: true, ssn: true, ip: false, mac: false, scrubber: nil) msg = msg.to_s.dup