Skip to content

target path: dot components become _, and the finished path must lie … - #26

Merged
Mancolt merged 2 commits into
mainfrom
fix/target-path-containment
Sep 22, 2026
Merged

Mancolt merged 2 commits into
mainfrom
fix/target-path-containment

Conversation

@Mancolt

@Mancolt Mancolt commented Sep 22, 2026

Copy link
Copy Markdown
Owner

…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.

Mancolt and others added 2 commits September 22, 2026 11:25
…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>
@Mancolt
Mancolt merged commit ee9c309 into main Sep 22, 2026
2 of 3 checks passed
@Mancolt
Mancolt deleted the fix/target-path-containment branch September 22, 2026 16:44
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