fastlane-community / security

A Ruby library for interacting with the macOS Keychain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

library hides relevant failure information

lacostej opened this issue · comments

We ran into a problem on Mac OSX Sierra where the library returned incoherent results: a structure with empty password:

2.3.3 :001 > module Security
2.3.3 :002?>     class InternetPassword < Password
2.3.3 :003?>     class << self
2.3.3 :004?>             def find(options)
2.3.3 :005?>                 output = `security 2>&1 find-internet-password -g #{flags_for_options(options)}`
2.3.3 :006?>                 puts "Status #{$?.exitstatus}"
2.3.3 :007?>                 puts "output #{output}"
2.3.3 :008?>                 password_from_output(output)
2.3.3 :009?>               end
2.3.3 :010?>       end
2.3.3 :011?>       end
2.3.3 :012?>   end
 => :find 
2.3.3 :013 > 
2.3.3 :014 >   puts Security::InternetPassword.find(server: 'deliver.USER@DOMAIN.com').inspect
Status 36
output 
#<Security::InternetPassword:0x007f8c461d1dc8 @keychain=#<Security::Keychain:0x007f8c461d1d78 @filename=nil>, @attributes={}, @password=nil>
 => nil 
2.3.3 :015 > `security error 36`
 => "Error: 0x00000024 36 CSSM_ERRCODE_OBJECT_ACL_REQUIRED\n" 

The library should handle status codes to detect errors, not just output.