Skip to content

fix(agent): sanitize scene IDs in wire capture and transcript paths (#370) - #373

Open
Adityakk9031 wants to merge 1 commit into
robocurve:mainfrom
Adityakk9031:feature/370-safe-scene-ids
Open

fix(agent): sanitize scene IDs in wire capture and transcript paths (#370)#373
Adityakk9031 wants to merge 1 commit into
robocurve:mainfrom
Adityakk9031:feature/370-safe-scene-ids

Conversation

@Adityakk9031

@Adityakk9031 Adityakk9031 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes: #370

Description

LLMAgentPolicy was constructing transcript and wire capture filesystem paths from the raw scene_id value. Since scene_id is unvalidated task-author input, unusual strings or directory traversal patterns could write files outside the intended log directories.

This PR sanitizes the scene IDs using the plugin's _safe helper (matching core's FrameStore and eval.py sanitization logic) before constructing side-car paths and metadata pointers.

Changes

  • inspect-robots-agent:
    • Imported _safe from _capture in policy.py.
    • Modified on_trial_start to pass _safe(scene_id) instead of scene_id to _capture.begin_trial.
    • Modified on_trial_end to construct the trial_id transcript filename with _safe(record.scene_id).
    • Added a new test test_scene_id_sanitization_prevents_directory_traversal in tests/test_policy_e2e.py to assert that paths are safely resolved within the target run directory and directory traversal is blocked.
    • Documented the fix in CHANGELOG.md.

Verification

  • Ran the agent plugin test suite:
    • pytest plugins/inspect-robots-agent/tests -> 486 passed.
  • Formatting and check verification:
    • ruff check plugins/inspect-robots-agent -> Passed.
    • ruff format --check plugins/inspect-robots-agent -> Passed.

…obocurve#370)

LLMAgentPolicy was building side-car paths from the raw scene ID,
which is unvalidated task-author input. Hostile or unusual IDs
(e.g., featuring path separators or parent directory segments)
could lead to directory traversal.

Resolve this by sanitizing scene IDs with the \_safe()\ helper
(equivalent to core's FrameStore/eval.py sanitization) when
constructing filenames and metadata pointers for both wire captures
and transcripts. Add test coverage ensuring traversal is blocked
and files reside under the correct run directories.
@Adityakk9031

Copy link
Copy Markdown
Contributor Author

@jeqcho have a look

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.

Agent plugin side-cars use raw scene ids in filesystem paths (transcripts + wire capture)

1 participant