🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.gentoo.dev
3 messages
3 total messages Started by Zhixu Liu Fri, 16 Oct 2026 04:50
[gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key name/remote mappings
#29
Author: Zhixu Liu
Date: Fri, 16 Oct 2026 04:50
65 lines
5899 bytes
Detect conflicting SEC_KEYS_VALIDPGPKEYS entries where the same
name/remote pair maps to different OpenPGP fingerprints.

For keyserver-based remotes (gentoo, openpgp and Ubuntu), the
fingerprint is part of the download URL while the target filename
is derived only from the key name and remote. So multiple
fingerprints for the same name/remote pair would overwrite each
other. Github downloads are keyed by user name only and
can include multiple fingerprints, so the overwrite is harmless.

Reject such configurations early with a descriptive error message.

Closes: https://bugs.gentoo.org/979441
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
---
 eclass/sec-keys.eclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/eclass/sec-keys.eclass b/eclass/sec-keys.eclass
index b53b7143bea65..0f93183e560b2 100644
--- a/eclass/sec-keys.eclass
+++ b/eclass/sec-keys.eclass
@@ -63,7 +63,8 @@ inherit eapi9-pipestatus edo
 #  - manual -- do not add to SRC_URI, the ebuild will provide a custom
 #    download location
 _sec_keys_set_globals() {
-       local key fingerprint name loc locations=() remote
+       local -A name_loc_fpr=()
+       local key key_id fingerprint name loc locations=() remote

        for key in "${SEC_KEYS_VALIDPGPKEYS[@]}"; do
                fingerprint=${key%%:*}
@@ -80,6 +81,23 @@ _sec_keys_set_globals() {
                                manual) continue;;
                                *) die "${ECLASS}: unknown PGP key
remote: ${loc}";;
                        esac
+
+                       # github remote depends only on the user name.
Other remotes include the
+                       # fingerprint in the URL, so prevent multiple
fingerprints from mapping
+                       # to the same output file.
+                       key_id="${name}:${loc}"
+                       case ${loc} in
+                               gentoo|openpgp|ubuntu)
+                                       if [[ -v "name_loc_fpr[${key_id}]" ]] &&
+                                               [[
${name_loc_fpr["${key_id}"]} != "${fingerprint}" ]]
+                                       then
+                                               die "${ECLASS}:
${key_id} maps to multiple fingerprints: " \
+
"${name_loc_fpr["${key_id}"]} and ${fingerprint}"
+                                       fi
+                                       name_loc_fpr["${key_id}"]=${fingerprint}
+                                       ;;
+                       esac
+
                        SRC_URI+="
                                ${remote} ->
openpgp-keys-${name}-${loc}-${PV}.asc
                        "
--
2.49.1
Re: [gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key name/remote mappings
#135
Author: Sam James
Date: Sat, 07 Nov 2026 05:30
86 lines
4643 bytes
--=-=-=
Content-Type: text/plain

Zhixu Liu <zhixu.liu@gmail.com> writes:

> Detect conflicting SEC_KEYS_VALIDPGPKEYS entries where the same
> name/remote pair maps to different OpenPGP fingerprints.
>
> For keyserver-based remotes (gentoo, openpgp and Ubuntu), the
> fingerprint is part of the download URL while the target filename
> is derived only from the key name and remote. So multiple
> fingerprints for the same name/remote pair would overwrite each
> other. Github downloads are keyed by user name only and
> can include multiple fingerprints, so the overwrite is harmless.
>
> Reject such configurations early with a descriptive error message.
>

Eli, any comments?

> Closes: https://bugs.gentoo.org/979441
> Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
> ---
>  eclass/sec-keys.eclass | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/sec-keys.eclass b/eclass/sec-keys.eclass
> index b53b7143bea65..0f93183e560b2 100644
> --- a/eclass/sec-keys.eclass
> +++ b/eclass/sec-keys.eclass
> @@ -63,7 +63,8 @@ inherit eapi9-pipestatus edo
>  #  - manual -- do not add to SRC_URI, the ebuild will provide a custom
>  #    download location
>  _sec_keys_set_globals() {
> -       local key fingerprint name loc locations=() remote
> +       local -A name_loc_fpr=()
> +       local key key_id fingerprint name loc locations=() remote
>
>         for key in "${SEC_KEYS_VALIDPGPKEYS[@]}"; do
>                 fingerprint=${key%%:*}
> @@ -80,6 +81,23 @@ _sec_keys_set_globals() {
>                                 manual) continue;;
>                                 *) die "${ECLASS}: unknown PGP key
> remote: ${loc}";;
>                         esac
> +
> +                       # github remote depends only on the user name.
> Other remotes include the
> +                       # fingerprint in the URL, so prevent multiple
> fingerprints from mapping
> +                       # to the same output file.
> +                       key_id="${name}:${loc}"
> +                       case ${loc} in
> +                               gentoo|openpgp|ubuntu)
> +                                       if [[ -v "name_loc_fpr[${key_id}]" ]] &&
> +                                               [[
> ${name_loc_fpr["${key_id}"]} != "${fingerprint}" ]]
> +                                       then
> +                                               die "${ECLASS}:
> ${key_id} maps to multiple fingerprints: " \
> +
> "${name_loc_fpr["${key_id}"]} and ${fingerprint}"
> +                                       fi
> +                                       name_loc_fpr["${key_id}"]=${fingerprint}
> +                                       ;;
> +                       esac
> +
>                         SRC_URI+="
>                                 ${remote} ->
> openpgp-keys-${name}-${loc}-${PV}.asc
>                         "

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmrutbgbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkAXR
AP0TBK5c8H/GqlrVBgdn4Z20Ict7zmBfhP0gRbeV7tRBmQD/asG0EMyup5KHfvWA
FE2O82oYe6UhSmlJZSZWzyVAfwE=
=Cxl3
-----END PGP SIGNATURE-----
--=-=-=--
Re: [gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key name/remote mappings
#214
Author: Eli Schwartz
Date: Sun, 22 Nov 2026 16:10
78 lines
5139 bytes
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------TTOipUIif7itSd33TDt2qxwY
Content-Type: multipart/mixed; boundary="------------XmPy0ZzUlrQXsgCeWwnJ8q5x";
 protected-headers="v1"; hp="clear"
Message-ID: <04b8b36f-8684-43d7-9aaf-f23442bbcb87@gentoo.org>
Date: Sun, 22 Nov 2026 10:59:27 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key
 name/remote mappings
To: gentoo-dev@lists.gentoo.org
References: <CALMA0xYgyxBnx2OUE4xyKeM_JHaW_bVnx07-GeeEOUf_rsANqA@mail.gmail.com>
 <875wy9tdtz.fsf@gentoo.org>
Content-Language: en-US
From: Eli Schwartz <eschwartz@gentoo.org>
Autocrypt: addr=eschwartz@gentoo.org; keydata=
 xjMEZmeRNBYJKwYBBAHaRw8BAQdAYNZ7pUDWhx1i2f3p6L2ZLu4FcY18UoeGC04Gq/khqwfN
 I0VsaSBTY2h3YXJ0eiA8ZXNjaHdhcnR6QGdlbnRvby5vcmc+wpYEExYKAD4CGwMFCwkIBwMF
 FQoJCAsFFgIDAQACHgUCF4AWIQTvUdMIsc4jCIi+DYTqQj6ToWND8QUCauABDQUJCJCIWQAK
 CRDqQj6ToWND8bXlAQDhi6hUxiss56cdPbsemrWdVQe3CtkpqlQccxV/4a4/QgD/dUCR+SGn
 YxNZj6lir6i/TBr0yfSSrMtKgGO1+lClSwLOOARmZ5E0EgorBgEEAZdVAQUBAQdATT46Z06b
 1X9xjXFCYFxmq/Tj3tSEKZInDWTpoHQp4l8DAQgHwn4EGBYKACYCGwwWIQTvUdMIsc4jCIi+
 DYTqQj6ToWND8QUCauABGAUJCJCIZAAKCRDqQj6ToWND8c4xAQCWj7iWpgEJUM+wf2bZCkgM
 EKEVVdv5aBJrj6Xa22UhIQEA0bIv2t9jUqUeBMHl/6i0L28s5Mrtr0ZSX3Sg/zeyrAM=
X-Clacks-Overhead: GNU Terry Pratchett
In-Reply-To: <875wy9tdtz.fsf@gentoo.org>

--------------XmPy0ZzUlrQXsgCeWwnJ8q5x
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 11/7/26 12:23 AM, Sam James wrote:
> Zhixu Liu <zhixu.liu@gmail.com> writes:
>=20
>> Detect conflicting SEC_KEYS_VALIDPGPKEYS entries where the same
>> name/remote pair maps to different OpenPGP fingerprints.
>>
>> For keyserver-based remotes (gentoo, openpgp and Ubuntu), the
>> fingerprint is part of the download URL while the target filename
>> is derived only from the key name and remote. So multiple
>> fingerprints for the same name/remote pair would overwrite each
>> other. Github downloads are keyed by user name only and
>> can include multiple fingerprints, so the overwrite is harmless.
>>
>> Reject such configurations early with a descriptive error message.
>>
>=20
> Eli, any comments?


The patch doesn't apply (not sent with git send-email? it has a lot of
line-wrapping that throws off both git and my ability to read it.)

=46rom a quick skim I don't love the overall idea, but I don't hate it.

Zhixu Liu, please resend for discussion. https://git-send-email.io may
be helpful.


--=20
Eli Schwartz

--------------XmPy0ZzUlrQXsgCeWwnJ8q5x--

--------------TTOipUIif7itSd33TDt2qxwY
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature.asc"

-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQTnFNnmK0TPZHnXm3qEp9ErcA0vVwUCawMRXwUDAAAAAAAKCRCEp9ErcA0vV4ty
AP9sbz6+qQq18msfzN1URE3QyeKiK47vW+19ZdzdS/RyqQEAsrw3S37mwMJLHc17DBswUp1EvuNX
caeJciiKCq5pwA0=
=8vlV
-----END PGP SIGNATURE-----

--------------TTOipUIif7itSd33TDt2qxwY--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads