junaid-simamdigital commited on
Commit
292f9ee
·
verified ·
1 Parent(s): 3f211cb

test: cover capture path traversal

Browse files
tests/test_validate_capture_manifest.py CHANGED
@@ -82,3 +82,13 @@ def test_capture_manifest_checks_optional_image_hash(tmp_path):
82
  valid, errors = validate_capture_manifest(manifest, check_files=True)
83
  assert valid is False
84
  assert any("SHA-256" in error for error in errors)
 
 
 
 
 
 
 
 
 
 
 
82
  valid, errors = validate_capture_manifest(manifest, check_files=True)
83
  assert valid is False
84
  assert any("SHA-256" in error for error in errors)
85
+
86
+
87
+ def test_capture_manifest_rejects_image_path_escape(tmp_path):
88
+ record_a = _record("a", "train")
89
+ record_a["image"] = "../outside.png"
90
+ manifest = tmp_path / "capture.json"
91
+ manifest.write_text(json.dumps({"project": "Simam3D", "views": [record_a, _record("b", "held_out")]}), encoding="utf-8")
92
+ valid, errors = validate_capture_manifest(manifest, check_files=True)
93
+ assert valid is False
94
+ assert any("escapes manifest directory" in error for error in errors)