Skip to content

Commit 9ea1587

Browse files
committed
address comments
1 parent 60532c3 commit 9ea1587

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private FileAccessTree(FilesEntitlement filesEntitlement, PathLookup pathLookup)
5353
this.writePaths = pruneSortedPaths(writePaths).toArray(new String[0]);
5454
}
5555

56-
public static List<String> pruneSortedPaths(List<String> paths) {
56+
private static List<String> pruneSortedPaths(List<String> paths) {
5757
List<String> prunedReadPaths = new ArrayList<>();
5858
if (paths.isEmpty() == false) {
5959
String currentPath = paths.get(0);

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public void testPrunedPaths() {
104104
assertThat(tree.canWrite(path("foo/bar")), is(false));
105105
assertThat(tree.canRead(path("foo/baz")), is(true));
106106
assertThat(tree.canWrite(path("foo/baz")), is(false));
107+
// also test a non-existent subpath
108+
assertThat(tree.canRead(path("foo/barf")), is(true));
109+
assertThat(tree.canWrite(path("foo/barf")), is(false));
107110

108111
tree = accessTree(entitlement("foo", "read", "foo/bar", "read_write"));
109112
assertThat(tree.canRead(path("foo")), is(true));

0 commit comments

Comments
 (0)