fastlane-community / security

A Ruby library for interacting with the macOS Keychain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing issue with non-ASCII passwords

baarde opened this issue · comments

When retrieving a non-ASCII password, Security::Password::password_from_output fails to decode the password field.

The security command outputs non-ASCII values in hexadecimal.

$ security find-internet-password -s example.com -g
keychain: "/Users/nicolas/Library/Keychains/login.keychain"
class: "inet"
attributes:
    0x00000007 <blob>="example.com"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="nicolas"
    "atyp"<blob>="dflt"
    "cdat"<timedate>=0x32303135303931373135333431355A00  "20150917153415Z\000"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x32303135303931373135333431355A00  "20150917153415Z\000"
    "nega"<sint32>=<NULL>
    "path"<blob>=<NULL>
    "port"<uint32>=0x00000000 
    "prot"<blob>=<NULL>
    "ptcl"<uint32>="htps"
    "scrp"<sint32>=<NULL>
    "sdmn"<blob>=<NULL>
    "srvr"<blob>="example.com"
    "type"<uint32>=<NULL>
password: 0x5B455850555247C3895D  "[EXPURG\303\211]"

But the hexadecimal value prevents the regex from matching and my password isn't decoded.