bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60852: git-authenticate edge case for certain key setup.


From: Hilton Chain
Subject: bug#60852: git-authenticate edge case for certain key setup.
Date: Mon, 16 Jan 2023 15:29:40 +0800

I encountered the issue when adding a new key to my Guix channel.  Though I
haven't figured out what happened exactly, I'm currently able to reproduce the
issue with the following steps.

1. Generate two keypairs.  Key One with the preset "ECC and ECC", Key Two with
"ECC (set your own capabilities)" and only keep the Certify capability, then
add a Sign subkey to Key Two.  All Curve 25519.

#+RESULTS:
: /tmp/test/pubring.kbx
: ---------------------
: sec   ed25519/676A52381FFD80C5 2023-01-16 [SC]
:       Key fingerprint = 21D3 9304 CED7 A5CF 50B6  0B80 676A 5238 1FFD 80C5
: uid                 [ultimate] Key One
: ssb   cv25519/BA35E2E29D6E4CE4 2023-01-16 [E]
:       Key fingerprint = 450A DF8C 6FE4 AEFF EC75  EBD9 BA35 E2E2 9D6E 4CE4
:
: sec   ed25519/06DE4CED9A91AB7B 2023-01-16 [C]
:       Key fingerprint = 4A45 EC76 DA2B 389A FE2F  C887 06DE 4CED 9A91 AB7B
: uid                 [ultimate] Key Two
: ssb   ed25519/3BE8CD60E408A705 2023-01-16 [S]
:       Key fingerprint = 405C B557 DE1F 1254 B012  640A 3BE8 CD60 E408 A705


2. Create a new git repository, commit public keys of the two to the "keyring"
branch.  Then commit file ".guix-authorizations" to the "main" branch with the
following code:
#+begin_src scheme
  (authorizations
   (version 0)
   (("21D3 9304 CED7 A5CF 50B6  0B80 676A 5238 1FFD 80C5"
     (name "Key One"))))
#+end_src

Configure git to sign commits with Key One, change the ".guix-authorizations"
file to the following and commit:
#+begin_src scheme
  (authorizations
   (version 0)
   (("21D3 9304 CED7 A5CF 50B6  0B80 676A 5238 1FFD 80C5"
     (name "Key One")))
   (("405C B557 DE1F 1254 B012  640A 3BE8 CD60 E408 A705"
     (name "Key Two"))))
#+end_src

Then change the signing key to Key Two and add a new commit.

Now there're three commits:
#+RESULTS:
: commit 5240baeebc055187fb738e66e7dbfbb57c0aeba3 (HEAD -> main)
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:53:49 2023 +0800
:
:     test
:
: commit a6794b64f9dfa828a5721e3f02c27ab74db9a487
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:53:17 2023 +0800
:
:     Authorize Key Two.
:
: commit c9476062a2f341e9ee95a60d17cf2233b7c55ff4
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:51:02 2023 +0800
:
:     Authorize Key One.


3. Invoke `guix git authenticate`...with error.

#+begin_src shell
  guix git authenticate c9476062a2f341e9ee95a60d17cf2233b7c55ff4 "21D3 9304 
CED7 A5CF 50B6  0B80 676A 5238 1FFD 80C5"
#+end_src

#+RESULTS:
: Authenticating commits c947606 to 5240bae (1 new commits)...
: 
[##############################################################################]guix
 git: error: commit 5240baeebc055187fb738e66e7dbfbb57c0aeba3 not signed by an 
authorized key: 405C B557 DE1F 1254 B012  640A 3BE8 CD60 E408 A705


4. However, if I swap positions of the two fingerprints, it works.

New ".guix-authorizations" file:
#+begin_src scheme
  (authorizations
   (version 0)
   (("405C B557 DE1F 1254 B012  640A 3BE8 CD60 E408 A705"
     (name "Key Two")))
   (("21D3 9304 CED7 A5CF 50B6  0B80 676A 5238 1FFD 80C5"
     (name "Key One"))))
#+end_src

New commits history:
#+RESULTS:
: commit 7e4d98eea0e89652554d822503096371e5d59f3b (HEAD -> main)
: Author: Test <test@example.com>
: Date:   Mon Jan 16 14:52:37 2023 +0800
:
:     test
:
: commit a44434b1a9bd955cc897dea4c44abe64d6ab8112
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:53:49 2023 +0800
:
:     Swap positions of the two fingerprints.
:
: commit a6794b64f9dfa828a5721e3f02c27ab74db9a487
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:53:17 2023 +0800
:
:     Authorize Key Two.
:
: commit c9476062a2f341e9ee95a60d17cf2233b7c55ff4
: Author: Test <test@example.com>
: Date:   Mon Jan 16 13:51:02 2023 +0800
:
:     Authorize Key One.

And a new `guix git authenticate` result:
#+RESULTS:
: Authenticating commits c947606 to 7e4d98e (2 new commits)...

🥴





reply via email to

[Prev in Thread] Current Thread [Next in Thread]