Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updated keyScan to ignore trailing spaces in KEYINFO attributes#10

Open
dovys wants to merge 6 commits intoprep:master from
monzo:master
Open

Updated keyScan to ignore trailing spaces in KEYINFO attributes #10
dovys wants to merge 6 commits intoprep:master from
monzo:master

Conversation

@dovys
Copy link

@dovys dovys commented Feb 12, 2019
edited
Loading

Hey,
I've recently ran into a rather odd issue where some keys have a trailing space at the end of the card ID:

> keyinfo --show-fpr --list --ssh-fpr
S KEYINFO 61D048F46EE1DCE... T D2760001240102010006064000390000 OPENPGP.3 - - MD5:9b:c8:3c:7b:44:... - -

This breaks key scanning as the scanner thinks there are 11 parts to it instead of 10. This change should be safe as gpg-agent returns a dash (-) when the value is actually empty.

I've recently ran into a rather odd issue where some keys have
a trailing space at the end of the card ID:
> keyinfo --show-fpr --list --ssh-fpr
S KEYINFO 61D048F46EE1DCE... T D2760001240102010006064000390000 OPENPGP.3 - - MD5:9b:c8:3c:7b:44:... - -
This breaks key scanning as the scanner thinks there are 11 parts to it
instead of 10. This change should be safe as gpg-agent returns a dash
when the value is actually empty.
Copy link
Owner

prep commented Feb 17, 2019

That's odd. However, looking at your code, wouldn't it be simpler to change this line

	parts := strings.Split(line, " ")

to this?

	parts := strings.Split(strings.TrimSpace(line), " ")

jackkleeman and others added 5 commits February 27, 2019 15:46
...lely querying the yubikey, thus ignoring any cached keys.
Keygrips function for finding all keys on card
Newer versions of GPG can add an extra field to the KEYPAIRINFO lines,
for example:
S KEYPAIRINFO F877E5110AE0878B14C75747397DA0755EC51613 OPENPGP.3 sa
vs
S KEYPAIRINFO A6D4D888546D31DA593F65246BB13DB2F98DB42E OPENPGP.3
This change makes our parser tolerate this format. It adds extra
validation on the card ID and keygrip fields, ignoring ones that
are invalid.
I could not run the tests and gave up after five minutes. 🙈
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /