Article View: linux.gentoo.dev
Article #29[gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key name/remote mappings
From: Zhixu Liu
Date: Fri, 16 Oct 2026 04:50
Date: Fri, 16 Oct 2026 04:50
65 lines
5899 bytes
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
Technical Details
Message-ID:
<NOI3f-5QvG-3@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From: Zhixu Liu <zhixu.liu@gmail.com>
Newsgroups: linux.gentoo.dev
Subject: [gentoo-dev] [PATCH] sec-keys.eclass: detect conflicting key name/remote mappings
Date: Fri, 16 Oct 2026 06:50:01 +0200
Message-ID: <NOI3f-5QvG-3@gated-at.bofh.it>
X-Original-To: gentoo-dev@lists.gentoo.org
Arc-Seal: i=1; a=rsa-sha256; t=1792126051; cv=none;
d=google.com; s=arc-20260327;
b=hlR1T2ruVSaqJxDDQLIF5+pilCU9g9hc1Cgu9LTNoH+pHnuEa9uTIrbMP6w9mV2k//
4zRBWVWof2p7uJPtZ2EhR/stbHOxYizB4LKwSetjB16YhOJxzA1lyzX2lDN/6EjbSbWv
92Hdhqy/PDbJM2lR5luLFLgHCxyA157XYpM/W4Agnz4bsljXCZZzv3IWgCKVun9OU5Rx
gK9Q13JNSbhokWvcLX8xvDVUctuxGHr1YiRYHyeDPDG0+X4hgS2ocUGALFXfGnK1Yd57
rgt8Q8uFnuD5K3OK9k2sgznxyQeIeX1tIgCwVwHyfGqMfYeUvdTDvB1r/qBs8HZPxthN
4oWQ==
Arc-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=to:subject:message-id:date:from:mime-version:dkim-signature;
bh=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wC2bj8xJ0nPZ8dH53IP6Qiuni0=
X-Received: by 2002:a17:903:298e:b0:2e8:3d48:4d92 with SMTP id
d9443c01a7336-2e842bc6da6mr184051255ad.33.1792126051028; Thu, 15 Oct 2026
21:47:31 -0700 (PDT)
List-ID: Gentoo Linux mail <gentoo-dev.gentoo.org>
Reply-To: gentoo-dev@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
MIME-Version: 1.0
X-Gm-Features: AclHuK87xKQ8NpgOML9vXfeDroR5LnEK1gZ5RdOjO4fwDIs8MlFVbAFzkk0HUdU
Content-Type: text/plain; charset="UTF-8"
Approved: robomod@news.nic.it
Lines: 65
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Fri, 16 Oct 2026 12:46:52 +0800
X-Original-Message-ID: <CALMA0xYgyxBnx2OUE4xyKeM_JHaW_bVnx07-GeeEOUf_rsANqA@mail.gmail.com>