Repository navigation
test: contain symlink-resolved ingest URIs - #806
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
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.
6 tasks done
Contributor
|
Tracking the fix and regression coverage in #809. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-processhflow ingestcommand, andPOST /api/v1/runtime/ingestmust 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.mcapinside 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
3aacb69fa91841704013b02085bd039f2810ad21because the outside recording is opened:uv run ruff check tests/test_symlink_ingest_traversal.pyanduv run ty check tests/test_symlink_ingest_traversal.pypass. 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
uv run ruff check --fix,uv run ruff format, anduv run ty check.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.