- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
[Entitlements] Add a check for filesystem mismatch #123744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Entitlements] Add a check for filesystem mismatch #123744
Conversation
| 
           Pinging @elastic/es-core-infra (Team:Core/Infra)  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } | ||
| 
               | 
          ||
| private boolean checkPath(String path, String[] paths) { | ||
| logger.debug(() -> Strings.format("checking [%s] against [%s]", path, String.join(",", paths))); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems more trace level? It could be extremely verbose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I always mix them up! I will fix all 3 of them
| } | ||
| 
               | 
          ||
| private static boolean isParent(String maybeParent, String path) { | ||
| logger.debug(() -> Strings.format("checking isParent [%s] for [%s]", maybeParent, path)); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this could log a lot.
| 
           Removing test-windows as it still fails until we merge #123689 (and we need this to merge it)  | 
    
NIO Files function accept an arbitrary Path object; this objects may be of different classes/come from FileSystems different from the default one, which is the one that provide access to the file systems accessible to the Java virtual machine, and which we are trying to protect.
For example: you can pass a
ZipPath(created by aZipFileSystem) toFiles.exists(Path), to check for contents of a Zip file. This works, but check for entitlements on thatZipPathis not correct.While checking for Files entitlements, we should skip checks on Paths coming from different FileSystems, as they do not intersect with the Paths we are protecting. This PR adds a condition to do that.