-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Prune extraneous files entitlements paths to prevent incorrect binary search #123177
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
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Hi @jdconrad, I've created a changelog YAML for you. |
rjernst
left a comment
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
| assertThat(tree.canRead(path("foo/bar")), is(true)); | ||
| assertThat(tree.canWrite(path("foo/bar")), is(false)); | ||
| assertThat(tree.canRead(path("foo/baz")), is(true)); | ||
| assertThat(tree.canWrite(path("foo/baz")), is(false)); |
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.
Can we test a path has read access that is not explicitly entitled? ie that would be hit by the bug
| this.writePaths = pruneSortedPaths(writePaths).toArray(new String[0]); | ||
| } | ||
|
|
||
| public static List<String> pruneSortedPaths(List<String> 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 can be private?
This prevents an incorrect binary search by pruning files entitlements paths at the time of construction.
As an example:
This would previously cause
/foo/bazto see/foo/baras its parent instead of/foo.This change prunes
/foo/barfrom the read list since/foois already available. And nowfoo/bazwill seefooas its parent.