b15bbd
From f72734ff7712d6aae837f940a45d6e7508bb182c Mon Sep 17 00:00:00 2001
b15bbd
From: Brad King <brad.king@kitware.com>
b15bbd
Date: Thu, 20 Oct 2022 13:38:20 -0400
b15bbd
Subject: [PATCH] Tests: Explicitly allow usage of git file-based protocol in
b15bbd
 test cases
b15bbd
b15bbd
Due to CVE-2022-39253, Git 2.30.6 sets `protocol.file.allow=user` by
b15bbd
default.  The change has also been backported to other Git versions by
b15bbd
distros.  This breaks some of our test cases that use the file-based
b15bbd
protocol locally to simulate real workflows without requiring network
b15bbd
access.  In these cases the file protocol is safe, so explicitly enable
b15bbd
it in the tests.
b15bbd
b15bbd
(cherry picked from commit 79ce0f434e916684d734e136b92e14f472a9d14a)
b15bbd
---
b15bbd
 Tests/CMakeLists.txt | 2 ++
b15bbd
 1 file changed, 2 insertions(+)
b15bbd
b15bbd
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
b15bbd
index 8e7c04fbd0..d011020f99 100644
b15bbd
--- a/Tests/CMakeLists.txt
b15bbd
+++ b/Tests/CMakeLists.txt
b15bbd
@@ -1540,6 +1540,7 @@ if(BUILD_TESTING)
b15bbd
     )
b15bbd
   list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
b15bbd
   set_tests_properties(ExternalProject PROPERTIES
b15bbd
+    ENVIRONMENT GIT_ALLOW_PROTOCOL=file
b15bbd
     RUN_SERIAL 1
b15bbd
     TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
b15bbd
 
b15bbd
@@ -2653,6 +2654,7 @@ if(BUILD_TESTING)
b15bbd
         -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake"
b15bbd
         )
b15bbd
       list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}")
b15bbd
+      set_property(TEST CTest.UpdateGIT PROPERTY ENVIRONMENT GIT_ALLOW_PROTOCOL=file)
b15bbd
     endif()
b15bbd
 
b15bbd
     # Test CTest Update with HG
b15bbd
-- 
b15bbd
2.31.1
b15bbd