From 92a6b81e8ae603fde73485b5394e49f58723e24b Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 26 May 2022 22:26:19 +0200
Subject: [PATCH] gluon-autoupdater: check that good_signatures does not exceed
 number of provided pubkeys

---
 package/gluon-autoupdater/check_site.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/gluon-autoupdater/check_site.lua b/package/gluon-autoupdater/check_site.lua
index 04c88a13d..aaf1763c3 100644
--- a/package/gluon-autoupdater/check_site.lua
+++ b/package/gluon-autoupdater/check_site.lua
@@ -3,8 +3,13 @@ local branches = table_keys(need_table({'autoupdater', 'branches'}, function(bra
 
 	need_string(in_site(extend(branch, {'name'})))
 	need_string_array_match(extend(branch, {'mirrors'}), '^http://')
+
+	local pubkeys = need_string_array_match(in_site(extend(branch, {'pubkeys'})), '^%x+$')
 	need_number(in_site(extend(branch, {'good_signatures'})))
-	need_string_array_match(in_site(extend(branch, {'pubkeys'})), '^%x+$')
+	need(in_site(extend(branch, {'good_signatures'})), function(good_signatures)
+		return good_signatures <= #pubkeys
+	end, nil, string.format('be less than or equal to the number of public keys (%d)', #pubkeys))
+
 	obsolete(in_site(extend(branch, {'probability'})), 'Use GLUON_PRIORITY in site.mk instead.')
 end))
 
-- 
GitLab