Skip to content

Tighten path containment in Live Migration file route#367

Open
nvharikrishna wants to merge 2 commits into
apache:trunkfrom
nvharikrishna:lm-file-resolver-double-encoded-path-traversal
Open

Tighten path containment in Live Migration file route#367
nvharikrishna wants to merge 2 commits into
apache:trunkfrom
nvharikrishna:lm-file-resolver-double-encoded-path-traversal

Conversation

@nvharikrishna

Copy link
Copy Markdown
Contributor

Making this change as part of CEP-40.

CASSSIDECAR-479 Tightens the path check on the Live Migration file route so that symlinks inside a data directory cannot point to files outside the configured directory.

Earlier, the route only checked the URL text for .. patterns. That check does not catch symlinks, so a symlink within the data dir could still resolve to a file elsewhere on disk. The route now also resolves the path with toRealPath() and confirms the resolved path stays inside the configured base directory.

…based path traversal by validating that the canonical resolved path stays within the configured directory. Return clearer HTTP status codes - 400 for malformed URLs, 403 for symlink escapes, 404 for missing or excluded files - with consistent JSON error responses. Preserve operator-configured directory paths in exclusion matching and logs so behavior stays predictable when data dirs sit behind symlinks.
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