Skip to content

git-credential-osxkeychain >= 2.45.0 now adds keys/bytes that break the Credential class #391

@pgpx

Description

@pgpx

git-credential-osxkeychain (the MacOS plugin that uses the keychain to store git credentials) introduced 2 changes that can break scmrepo's Credential class:

  • 2.45.0 - can add garbage bytes after the username (fixed in 2.47.0, at least partially in 2.46.1), and these are returned unchanged by scmrepo
  • 2.46.0 - adds additional key/values that Credential.init cannot handle: capability[]=state and state[]=osxkeychain:seen=1

These will cause scmrepo to fail to validate.

Git history of git-credential-osxkeychain: https://github.com/git/git/commits/master/contrib/credential/osxkeychain/git-credential-osxkeychain.c
Git history of homebrew installation: https://github.com/Homebrew/homebrew-core/commits/master/Formula/g/git.rb

Version 2.45.0

Seems to append 0/garbage bytes to the end of the username: git/git@d5b35bb

Install via brew: curl https://raw.githubusercontent.com/Homebrew/homebrew-core/cb9224e6ef81a94887202e4a8b147d7b54e20064/Formula/g/git.rb -o git.rb && brew install ./git.rb --force --build-bottle

echo -n "protocol=https\nhost=myhost\n" | /opt/homebrew/opt/git/libexec/git-core/git-credential-osxkeychain get
password=foo
username=bar\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

(where \x00 is actually a 0-byte)

Version 2.46.0

Added keys capability and state: git/git@e1ab45b

Install via brew: curl https://raw.githubusercontent.com/Homebrew/homebrew-core/9e36b20424dbec7878eb6a72799d0b84b4c6a2d1/Formula/g/git.rb -o git.rb && brew install ./git.rb --force --build-bottle

echo -n "protocol=https\nhost=myhost\n" | /opt/homebrew/opt/git/libexec/git-core/git-credential-osxkeychain get
password=foo
username=bar\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
capability[]=state
state[]=osxkeychain:seen=1

Version 2.46.1

(Maybe partial) fix for 0/garbage bytes after username: git/git@b201316

Install via brew: curl https://raw.githubusercontent.com/Homebrew/homebrew-core/3a5c32fb17709056e5ca4b71f5503d590ac2e361/Formula/g/git.rb -o git.rb && brew install ./git.rb --force --build-bottle

echo -n "protocol=https\nhost=myhost\n" | /opt/homebrew/opt/git/libexec/git-core/git-credential-osxkeychain get
password=foo
username=bar
capability[]=state
state[]=osxkeychain:seen=1

Version 2.47.0

Another fix for bytes after username: git/git@6c3c451

Install via brew: curl https://raw.githubusercontent.com/Homebrew/homebrew-core/1ef2c54d18b723b7585ddb82cb2d33a7c95fd5c2/Formula/g/git.rb -o git.rb && brew install ./git.rb --force --build-bottle

echo -n "protocol=https\nhost=myhost\n" | /opt/homebrew/opt/git/libexec/git-core/git-credential-osxkeychain get
password=foo
username=bar
capability[]=state
state[]=osxkeychain:seen=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions