Skip to content

test: contain symlink-resolved ingest URIs - #806

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/symlink-ingest-traversal-tests-eb5b
Closed

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/symlink-ingest-traversal-tests-eb5b

Conversation

@cursor

@cursor cursor Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Summary

Adds tests that refuse an ingest URI whose real path leaves the data root. A directory symlink plus parent segments (episodes-in/../neighbor.mcap) and an in-root file symlink (episodes-in/alias.mcap) are both covered. The sync worker, the in-process hflow ingest command, and POST /api/v1/runtime/ingest must not open that outside recording or republish it for the workspace server to download.

These tests fail on purpose until that containment is fixed. No production code is changed here.

Why

Lexical normalization keeps episodes-in/../neighbor.mcap inside the data root, and the batch planner sizes that normalized key, but episode processing joins the original spelling to the data root and resolves it. Resolution follows the directory symlink and opens a recording outside the workspace. The same open follows a file symlink that is lexically inside the root. The workspace server authenticates nobody, so a caller who can reach it can submit the URI, and a successful sync copies the outside recording into the workspace and serves the canonical file.

Validation

The tests fail on 3aacb69fa91841704013b02085bd039f2810ad21 because the outside recording is opened:

uv run pytest tests/test_symlink_ingest_traversal.py -p no:xdist

uv run ruff check tests/test_symlink_ingest_traversal.py and uv run ty check tests/test_symlink_ingest_traversal.py pass. A local containment check that rejects a resolved path outside the real data root makes the same pytest command pass; that check is not in this branch.

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements.
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.
Open in Web Open in Cursor 

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Cover directory-symlink parent segments and in-root file symlinks on the
sync worker, the in-process ingest CLI, and the unauthenticated runtime
ingest route. The tests fail until those paths stop opening and republishing
a recording whose real path is outside the data root.
@kstonekuan

Copy link
Copy Markdown
Contributor

Tracking the fix and regression coverage in #809.

@kstonekuan kstonekuan closed this Nov 20, 2026
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.

2 participants