Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(capbench): reject labels that are not plain file names
Marcos Daniel Rivera Gonzalezb9c3f08b45e9
diff --git a/scripts/capbench.py b/scripts/capbench.pyindex bda164fed..f270e14b6 100644--- a/scripts/capbench.py+++ b/scripts/capbench.py@@ -605,6 +605,9 @@ def cmd_run(args):variants = [tuple(item.split("=", 1)) for item in args.variant] or [(args.label, args.bin_dir)]if len({label for label, _ in variants}) != len(variants):sys.exit("variant labels must be unique")+ for label, _ in variants:+ if label in ("", ".", "..") or Path(label).name != label:+ sys.exit(f"label {label!r} must be a plain file name; results are written to <out>/<label>.json")variant_env = parse_variant_env([label for label, _ in variants], args.env)out_root = Path(args.out).resolve()diff --git a/scripts/test-capbench.py b/scripts/test-capbench.pyindex 38c32b185..ce83fa8ad 100644--- a/scripts/test-capbench.py+++ b/scripts/test-capbench.py@@ -132,6 +132,18 @@ class CapbenchTests(unittest.TestCase):capbench.cmd_run(args)self.assertTrue(bins.exists())+ def test_labels_that_are_not_plain_file_names_are_rejected(self):+ with tempfile.TemporaryDirectory() as tmp:+ fixture = Path(tmp) / "reference.cap"+ fixture.mkdir()+ for label in ["feature/gpu", "..", ""]:+ args = SimpleNamespace(+ bench=["decode-display"], out=str(Path(tmp) / "out"), label=label, fixture=str(fixture),+ bin_dir=tmp, variant=[], env=[], screen=None, animate=False, affinity=None,+ )+ with self.assertRaisesRegex(SystemExit, "file name"):+ capbench.cmd_run(args)+def test_startup_check_finds_missing_helpers(self):args = SimpleNamespace(fixture=".", bin_dir=str(Path(__file__).parent), screen=None, animate=False, affinity=None)with self.assertRaisesRegex(FileNotFoundError, "cap-test"):