target path: dot components become _, and the finished path must lie … - #26
Merged
Merged
Conversation
…under the media root pathvalidate.sanitize_filename leaves . and .. alone, so a series, title or part of .. from Audible/MAM walked one level up: inside the media root with the default templates, outside it with a bare-token template. Every rendered template component (disc_folder included, now split on / like the others) goes through myx_utilities.pathComponent, which turns an all-dots name into _. myx_utilities.assertUnderRoot then checks the finished path against the media root (realpath + commonpath, so a root of / or a symlinked root is fine and a folder inside the library that links elsewhere is not) and raises rather than link outside it. In metadata: log mode the CSV paths column is checked the same way against the run's Config/paths media roots. Output for every ordinary path is unchanged. Tests for .. as series/title/part under default and bare-token templates, disc_folder, a media root of /, and a log row aimed outside the library. Reviewed (correctness and security): findings applied, re-review clean. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
…under the media root
pathvalidate.sanitize_filename leaves . and .. alone, so a series, title or part of .. from Audible/MAM walked one level up: inside the media root with the default templates, outside it with a bare-token template. Every rendered template component (disc_folder included, now split on / like the others) goes through myx_utilities.pathComponent, which turns an all-dots name into _. myx_utilities.assertUnderRoot then checks the finished path against the media root (realpath + commonpath, so a root of / or a symlinked root is fine and a folder inside the library that links elsewhere is not) and raises rather than link outside it. In metadata: log mode the CSV paths column is checked the same way against the run's Config/paths media roots.
Output for every ordinary path is unchanged. Tests for .. as series/title/part under default and bare-token templates, disc_folder, a media root of /, and a log row aimed outside the library. Reviewed (correctness and security): findings applied, re-review clean.