aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld2013-04-08 22:18:21 +0200
committerJason A. Donenfeld2013-04-08 22:53:07 +0200
commitdd1f0e5f1b4de00c98fe7444915864b7271e09fe (patch)
tree5dd6c7885a2bd4f368fc83725ccaefdcd914fd3a
parent9844c60755cbad8000bca759741bfe113035a8eb (diff)
downloadcgit-dd1f0e5f1b4de00c98fe7444915864b7271e09fe.tar
cgit-dd1f0e5f1b4de00c98fe7444915864b7271e09fe.tar.gz
cgit-dd1f0e5f1b4de00c98fe7444915864b7271e09fe.zip
tests: Make sure that git does not access $HOME
With the latest changes to prevent git from accessing configuration files that it should not, it's important to be sure that we won't have further breakage in the future. Use strace to implement a test to make sure cgit does not access() anything built from $HOME. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rwxr-xr-xtests/t0109-gitconfig.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/t0109-gitconfig.sh b/tests/t0109-gitconfig.sh
new file mode 100755
index 0000000..cdd570b
--- /dev/null
+++ b/tests/t0109-gitconfig.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+test_description='Ensure that git does not access $HOME'
+. ./setup.sh
+
+test -n "$(which strace 2>/dev/null)" || {
+ skip_all='Skipping access validation tests: strace not found'
+ test_done
+ exit
+}
+
+test_expect_success 'no access to $HOME' '
+ non_existant_path="/path/to/some/place/that/does/not/possibly/exist"
+ while test -d "$non_existant_path"; do
+ non_existant_path="$non_existant_path/$(date +%N)"
+ done
+ strace \
+ -E HOME="$non_existant_path" \
+ -E CGIT_CONFIG="$PWD/cgitrc" \
+ -E QUERY_STRING="url=foo/commit" \
+ -e access -f -o strace.out cgit
+ test_must_fail grep "$non_existant_path" strace.out
+'
+
+test_done
'#n165'>165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298