Repository navigation
fix(cli): project links are read, not followed, before a LUT path is judged inside the project - #8783
Open
miguel-heygen wants to merge 1 commit into
Open
miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
…judged inside the project
This branch has not been deployed
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.
What
When a grades file names a LUT path that is a link inside the project,
grade-compareand the media-use scripts now read the link's own text to decide where it leads, and refuse it if it leads out of the project, without ever opening the place it points to.Why
The inside-the-project check asked whether the path existed and where it really was. Both calls follow the link to its target first, so a link to a file on another machine was opened before the check said no. On Windows, opening a network share path signs in to that machine. The check now reads links instead of following them, so nothing outside the project is touched while it decides.
Related work
Follows #8724, which made
grade-compareopen a grades file's LUT paths only inside the project. A review note on that PR asked for this.How
insideProjectinmedia-use/lib/record-path.mjswalks the path one part at a time withlstat, and at a link reads it withreadlinkand continues from what it names, up to 40 links, so a loop of links ends in a refusal.grade-compareruns that check before it asks whether the LUT file exists, so a path that leads out is refused before anything opens it.No visible change
grade-compareoutput is the same; only a link leading out of the project is now refused without being opened.Test plan
fails without the fix: with main's
record-path.mjsandgrade-compare.ts, inpackages/cli/src/media-use/lib/record-path.test.mjsa link in the project to a share is refused with only its own text read,a link in the project to another file in it is followedanda loop of links is refusedfail, and inpackages/cli/src/commands/grade-compare.lutPaths.test.tsrefuses a link in the project that leads out of it, reading only the linkfails. With the fix, 3 runs in a row:record-pathandresolve23,grade-compare36. The CLI type check and fallow are clean.