Sha256: 4b525f05a0a1cc779ea4d87e09efc9c5c3d226cd9c204d3d7a3a92b623db9851

Contents?: true

Size: 367 Bytes

Versions: 8

Compression:

Stored size: 367 Bytes

Contents

# Scans for occurrences of a password baked into a URI (e.g. a database
# connection string), of the form `scheme://username:PASSWORD@hostname`.
class Carwash::UriPasswordDiscoverer
  URI_PASSWORD_PATTERN= %r{:([0-9a-z_\.\-~%]+?)@}i

  def discover(line)
    line.scan(URI_PASSWORD_PATTERN).map(&:first).map { |password|
      CGI::unescape(password)
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
carwash-1.0.7 lib/carwash/uri_password_discoverer.rb
carwash-1.0.6 lib/carwash/uri_password_discoverer.rb
carwash-1.0.5 lib/carwash/uri_password_discoverer.rb
carwash-1.0.4 lib/carwash/uri_password_discoverer.rb
carwash-1.0.3 lib/carwash/uri_password_discoverer.rb
carwash-1.0.2 lib/carwash/uri_password_discoverer.rb
carwash-1.0.1 lib/carwash/uri_password_discoverer.rb
carwash-1.0.0 lib/carwash/uri_password_discoverer.rb