From 09d76e512a468ad65bedaeda56871de7043849b0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Feb 2024 12:08:18 +0100 Subject: [PATCH] GitArchiveInputScheme: Require a NAR hash --- src/libfetchers/github.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 76f94337bd9..a48c99a0bbe 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -282,7 +282,11 @@ struct GitArchiveInputScheme : InputScheme bool isLocked(const Input & input) const override { - return (bool) input.getRev(); + /* Since we can't verify the integrity of the tarball from the + Git revision alone, we also require a NAR hash for + locking. FIXME: in the future, we may want to require a Git + tree hash instead of a NAR hash. */ + return input.getRev().has_value() && input.getNarHash().has_value(); } std::optional experimentalFeature() const override