Skip to content

fix(utils): explain CWD / ROBOVERSE_DATA_DIR mismatches in hf_util instead of reporting traversal - #36

Merged
geng-haoran merged 1 commit into
mainfrom
fix/hf-util-relative-paths
Sep 3, 2026
Merged

fix(utils): explain CWD / ROBOVERSE_DATA_DIR mismatches in hf_util instead of reporting traversal#36
geng-haoran merged 1 commit into
mainfrom
fix/hf-util-relative-paths

Conversation

@geng-haoran

@geng-haoran geng-haoran commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Asset paths in configs are roboverse_data/... and are opened by the backends relative to the current working directory; ROBOVERSE_DATA_DIR only changes where hf_util downloads land. When the two disagree (running from a worktree or another directory with ROBOVERSE_DATA_DIR set), check_and_download_single computed a .. relpath and rejected the asset as a path-traversal attempt — an error that sends people looking for a malformed descriptor instead of the real cause.

  • The traversal branch now distinguishes a relative roboverse_data/... path from a genuine escape and explains the CWD / ROBOVERSE_DATA_DIR mismatch, names the working directory and LOCAL_DIR, points at the asset when it already exists there, and suggests running from the repo root or symlinking ./roboverse_data.
  • The genuine .. guard is unchanged.
  • test_check_and_download_single_falls_back_to_private_roboverse_data pins LOCAL_DIR to the CWD default so it no longer fails whenever the caller has ROBOVERSE_DATA_DIR set (it did here).

Tests

metasim/test/test_hf_util.py, metasim/test/test_hf_util_local_dir.py (+1 regression test for the mismatch message): 22 passed.

Not changed

The underlying design issue — ROBOVERSE_DATA_DIR not being honoured by the backends when they open the files — is out of scope; this PR makes the failure explain itself.

🤖 Generated with Claude Code

https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw

@geng-haoran
geng-haoran force-pushed the fix/hf-util-relative-paths branch from 0958e5f to 88b29f4 Compare September 3, 2026 04:59
@geng-haoran geng-haoran changed the title chore(release): development & release protocol, PR-time CI, release workflow, distribution rename fix(utils): explain CWD / ROBOVERSE_DATA_DIR mismatches in hf_util instead of reporting traversal Sep 3, 2026
@geng-haoran
geng-haoran force-pushed the fix/hf-util-relative-paths branch from 88b29f4 to 377b34b Compare September 3, 2026 19:14
…stead of reporting traversal

A roboverse_data/... asset path evaluated from a working directory that is
not the parent of ROBOVERSE_DATA_DIR was rejected as a path-traversal attempt.
The error now names the working directory, the configured LOCAL_DIR and, when
the asset already exists there, its location, and explains that
ROBOVERSE_DATA_DIR only changes where downloads are stored. The
falls_back_to_private test pins LOCAL_DIR so it no longer depends on the
caller's environment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw
@geng-haoran
geng-haoran force-pushed the fix/hf-util-relative-paths branch from 377b34b to 2d4ab6a Compare September 3, 2026 19:16
@geng-haoran
geng-haoran merged commit 29bb686 into main Sep 3, 2026
5 checks passed
@geng-haoran
geng-haoran deleted the fix/hf-util-relative-paths branch September 3, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant