Reject empty roots in workspace containment prefix check - #512
Merged
Conversation
An empty root made root+sep equal sep (e.g. "/" on Unix), so every absolute path matched and containment became allow-all. Filter empty roots before the compare in inKnownRoots.
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.
An empty root in the workspace roots list made
root + sepequalsep(e.g. "/" on Unix), so every absolute path started with it and containment became allow-all.inKnownRootsinsrc/permission/path-restriction.tsnow filters empty roots before the prefix compare.Adds regression tests: a sensitive absolute path resolved against
""roots is denied, and a root of exactly "/" is confirmed not to be the same bug (it does not act as an allow-all prefix).Fixes CL-6700
https://linear.app/abklabs/issue/CL-6700