Skip to content

fix(calibration): refuse config names that escape the calibration dir - #141

Open
parvpatodia wants to merge 1 commit into
huggingface:mainfrom
physical-hardware-intelligence:fix/validate-calibration-name
Open

parvpatodia wants to merge 1 commit into
huggingface:mainfrom
physical-hardware-intelligence:fix/validate-calibration-name

Conversation

@parvpatodia

Copy link
Copy Markdown

start_calibration passes config_file straight into the LeRobot device id, and LeRobot builds the calibration path as calibration_dir / f"{id}.json". A name containing ../ therefore points the calibration file outside the calibration directory. With lerobot 0.6.0, SO101Follower(SO101FollowerConfig(port=..., id="../../escaped", calibration_dir=d)).calibration_fpath resolves to d/../../escaped.json.

The calibration-config delete endpoint (server.py) and the robot-record helpers already reject these names with is_valid_robot_name. This applies the same guard at the start of start_calibration, before any status change or worker thread, and returns {"success": False, "message": "Invalid configuration name"}.

Test: test_calibration_manager_rejects_unsafe_config_name, parametrized over "", ../escape, .., a/b, a\b and " padded". It checks that no calibration starts. It fails 6/6 without the change. Full suite: 331 passed. ruff 0.14.1 check and format are clean.

start_calibration passed config_file straight into the LeRobot device id, and
LeRobot builds the calibration path as calibration_dir / f"{id}.json", so a
name containing ../ pointed the calibration file outside the calibration
directory. Apply the same is_valid_robot_name guard the delete endpoint and
robot records already use, before any state changes.
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