diff --git a/docs/source/environments/thinkingbox.md b/docs/source/environments/thinkingbox.md index df4fbc128..4a99cc315 100644 --- a/docs/source/environments/thinkingbox.md +++ b/docs/source/environments/thinkingbox.md @@ -86,11 +86,14 @@ because tasks are selected deterministically by UID. Concurrent sessions are stacked independent environment instances, one trajectory per instance; they are not multiplexed trajectories. -Executable assets come from the pinned `thinkingbox-bench-v1.0` release in -[`microsoft/thinkingbox-data`](https://github.com/microsoft/thinkingbox-data). -The [Hugging Face `microsoft/ThinkingBox-Bench` -dataset](https://huggingface.co/datasets/microsoft/ThinkingBox-Bench) is a -viewer-friendly representation, while GitHub remains the executable source. +Executable assets come from the pinned `thinkingbox-bench-v1.0` release, +downloaded from +[`MrSergSanch/thinkingbox-data`](https://github.com/MrSergSanch/thinkingbox-data), +the copy linked from Microsoft's +[ThinkingBox post](https://huggingface.co/blog/microsoft/thinkingbox). The +environment checks the bundle against its pinned SHA-256, so it only accepts +that release. `microsoft/thinkingbox-data` and the Hugging Face +`microsoft/ThinkingBox-Bench` viewer dataset are not public at the moment. ## Configuration @@ -131,9 +134,9 @@ Please cite the paper if ThinkingBox is useful in your experiments. for Agents in Stateful Business Workflows](https://arxiv.org/abs/2608.19741) - Framework: [`microsoft/thinkingbox`](https://github.com/microsoft/thinkingbox) - Executable benchmark: - [`microsoft/thinkingbox-data`](https://github.com/microsoft/thinkingbox-data) -- Viewer dataset: - [`microsoft/ThinkingBox-Bench`](https://huggingface.co/datasets/microsoft/ThinkingBox-Bench) + [`MrSergSanch/thinkingbox-data`](https://github.com/MrSergSanch/thinkingbox-data) + (`microsoft/thinkingbox-data` is not public at the moment) +- Blog post: [ThinkingBox on Hugging Face](https://huggingface.co/blog/microsoft/thinkingbox) ```bibtex @misc{li2026successisntreliabilitythinkingbox, diff --git a/envs/thinkingbox_env/README.md b/envs/thinkingbox_env/README.md index 0b4289e8c..e40c058d3 100644 --- a/envs/thinkingbox_env/README.md +++ b/envs/thinkingbox_env/README.md @@ -97,11 +97,14 @@ because tasks are selected deterministically by UID. Concurrent sessions are stacked independent environment instances, one trajectory per instance; they are not multiplexed trajectories. -Executable assets come from the pinned `thinkingbox-bench-v1.0` release in -[`microsoft/thinkingbox-data`](https://github.com/microsoft/thinkingbox-data). -The [Hugging Face `microsoft/ThinkingBox-Bench` -dataset](https://huggingface.co/datasets/microsoft/ThinkingBox-Bench) is a -viewer-friendly representation, while GitHub remains the executable source. +Executable assets come from the pinned `thinkingbox-bench-v1.0` release, +downloaded from +[`MrSergSanch/thinkingbox-data`](https://github.com/MrSergSanch/thinkingbox-data), +the copy linked from Microsoft's +[ThinkingBox post](https://huggingface.co/blog/microsoft/thinkingbox). The +environment checks the bundle against its pinned SHA-256, so it only accepts +that release. `microsoft/thinkingbox-data` and the Hugging Face +`microsoft/ThinkingBox-Bench` viewer dataset are not public at the moment. ## Configuration @@ -142,9 +145,9 @@ Please cite the paper if ThinkingBox is useful in your experiments. for Agents in Stateful Business Workflows](https://arxiv.org/abs/2608.19741) - Framework: [`microsoft/thinkingbox`](https://github.com/microsoft/thinkingbox) - Executable benchmark: - [`microsoft/thinkingbox-data`](https://github.com/microsoft/thinkingbox-data) -- Viewer dataset: - [`microsoft/ThinkingBox-Bench`](https://huggingface.co/datasets/microsoft/ThinkingBox-Bench) + [`MrSergSanch/thinkingbox-data`](https://github.com/MrSergSanch/thinkingbox-data) + (`microsoft/thinkingbox-data` is not public at the moment) +- Blog post: [ThinkingBox on Hugging Face](https://huggingface.co/blog/microsoft/thinkingbox) ```bibtex @misc{li2026successisntreliabilitythinkingbox, diff --git a/envs/thinkingbox_env/benchmark_data.py b/envs/thinkingbox_env/benchmark_data.py index c8912a114..62ec40c6d 100644 --- a/envs/thinkingbox_env/benchmark_data.py +++ b/envs/thinkingbox_env/benchmark_data.py @@ -305,6 +305,10 @@ def _extract_archive(archive: Path, destination: Path) -> None: relative_parts = path.parts[1:] if not relative_parts or relative_parts[0] not in _ALLOWED_TOP_LEVELS: continue + # _bundle_sha256 does not hash bytecode, so never extract it: an + # unverified .pyc next to the bundled servers could be imported. + if "__pycache__" in relative_parts or path.suffix in {".pyc", ".pyo"}: + continue if ( member.issym() or member.islnk() diff --git a/envs/thinkingbox_env/models.py b/envs/thinkingbox_env/models.py index e72debbac..7856ca20d 100644 --- a/envs/thinkingbox_env/models.py +++ b/envs/thinkingbox_env/models.py @@ -15,7 +15,9 @@ DATA_BUNDLE_SHA256 = "16803d95d161ca06309d95f0dbbcbbb7b3fdf8a61e2b4eacfe920781b12f18ff" DATA_MANIFEST_PATH = "releases/thinkingbox_bench_v1/testlist_thinkingbox_bench_v1.yaml" DATA_ARCHIVE_URL = ( - f"https://codeload.github.com/microsoft/thinkingbox-data/tar.gz/{DATA_COMMIT}" + # microsoft/thinkingbox-data is not public. This is the copy Microsoft's + # ThinkingBox post links, DATA_BUNDLE_SHA256 checks it is the pinned release. + f"https://codeload.github.com/MrSergSanch/thinkingbox-data/tar.gz/{DATA_COMMIT}" ) diff --git a/tests/envs/test_thinkingbox_env.py b/tests/envs/test_thinkingbox_env.py index 10e252fa5..17c3deeee 100644 --- a/tests/envs/test_thinkingbox_env.py +++ b/tests/envs/test_thinkingbox_env.py @@ -1753,6 +1753,31 @@ def test_archive_extraction_keeps_safe_members_beneath_destination( assert not (destination / "README.md").exists() +def test_archive_extraction_skips_bytecode_the_bundle_hash_ignores( + tmp_path: Path, +) -> None: + archive = tmp_path / "bytecode.tar.gz" + payload = b"bytes" + with tarfile.open(archive, "w:gz") as output: + for name in ( + "root/servers/tool.py", + "root/servers/__pycache__/tool.cpython-312.pyc", + "root/dataset/case.pyc", + "root/dataset/case.pyo", + ): + member = tarfile.TarInfo(name) + member.size = len(payload) + output.addfile(member, io.BytesIO(payload)) + + destination = tmp_path / "out" + _extract_archive(archive, destination) + + assert (destination / "servers/tool.py").read_bytes() == payload + assert not (destination / "servers/__pycache__").exists() + assert not (destination / "dataset/case.pyc").exists() + assert not (destination / "dataset/case.pyo").exists() + + def test_archive_extraction_rejects_resolved_target_escape(tmp_path: Path) -> None: archive = tmp_path / "symlink-parent.tar.gz" payload = b"bad"