From 9875f360b416305c83ee59f65d91c65a30f3e44c Mon Sep 17 00:00:00 2001 From: RyanC Date: Thu, 12 Dec 2013 13:36:04 -0800 Subject: [PATCH] remove insecure credential storage support --- lib/atlassian/cli/credentials.rb | 43 -------------------------------- 1 file changed, 43 deletions(-) diff --git a/lib/atlassian/cli/credentials.rb b/lib/atlassian/cli/credentials.rb index cfa509d..fe2d238 100644 --- a/lib/atlassian/cli/credentials.rb +++ b/lib/atlassian/cli/credentials.rb @@ -1,4 +1,3 @@ - module Atlassian module Cli class Credentials @@ -7,7 +6,6 @@ class Credentials def initialize @credential_getters = [] - @credential_getters << NetRc.new() @credential_getters << Prompt.new() end @@ -34,47 +32,6 @@ def get_credentials(provided_user = nil, provided_pw = nil) # implementations - class NetRc - - NETRC_PATH = '.netrc' - NETRC_HOST = 'atlassian-cli.example.com' - - # netrc ignores provided username - def get_credentials(provided_user = nil, provided_pw = nil) - File.open(File.join(Dir.home, NETRC_PATH)) do |f| - found_start = false - username = nil - password = nil - f.each_line do |l| - break if found_start && username && password - - if l.match("^machine #{NETRC_HOST}$") - found_start = true - next - end - - next unless found_start - - if l.match("^login (.*)$") - username = $1 - next - end - - if l.match("^password (.*)$") - password = $1 - next - end - end - - if found_start && username && password - return [username, password] - end - return [nil, nil] - end - end - - end # end class NetRc - class Prompt def get_credentials(provided_user = nil, provided_pw = nil)