Blame SOURCES/flatpak-dir-Use-SHA256-not-SHA1-to-name-the-cache-for-a-filt.patch

0408e5
From 7dd160f33054863b1ea6f75ac279a42121a16430 Mon Sep 17 00:00:00 2001
0408e5
From: Debarshi Ray <debarshir@gnome.org>
0408e5
Date: Mon, 31 Jan 2022 21:17:29 +0100
0408e5
Subject: [PATCH] dir: Use SHA256, not SHA1, to name the cache for a filtered
0408e5
 remote
0408e5
0408e5
SHA1 hashes are considered weak these days. Some distributions have
0408e5
static analysis tools to detect the use of such weak hashes, and they
0408e5
get triggered by flatpak. While this particular use of SHA1 in flatpak
0408e5
is likely not security sensitive, it's also easy to move to SHA256 to
0408e5
avoid any debate.
0408e5
0408e5
Here, the SHA1 hash of a named remote's filter file is used to generate
0408e5
the name of the directory where the refs from that remote are cached.
0408e5
One can reasonably assume that the cache is frequently invalidated
0408e5
because the list of refs on the remote changes all the time. Hence,
0408e5
it's not big problem if it gets invalidated once more because of this
0408e5
change.
0408e5
---
0408e5
 common/flatpak-dir.c | 2 +-
0408e5
 1 file changed, 1 insertion(+), 1 deletion(-)
0408e5
0408e5
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
0408e5
index 18384bd432fc..c6d08e85b41f 100644
0408e5
--- a/common/flatpak-dir.c
0408e5
+++ b/common/flatpak-dir.c
0408e5
@@ -10923,7 +10923,7 @@ remote_filter_load (GFile *path, GError **error)
0408e5
     }
0408e5
 
0408e5
   filter = g_new0 (RemoteFilter, 1);
0408e5
-  filter->checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1, (guchar *)data, data_size);
0408e5
+  filter->checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA256, (guchar *)data, data_size);
0408e5
   filter->path = g_object_ref (path);
0408e5
   filter->mtime = mtime;
0408e5
   filter->last_mtime_check = g_get_monotonic_time ();
0408e5
-- 
0408e5
2.34.1
0408e5