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