Skip to content

Commit 51b6027

Browse files
committed
Skip absolute/relative path validation if platform is "any" (null)
1 parent c81d28d commit 51b6027

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/FilesEntitlement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ public static FilesEntitlement build(List<Object> paths) {
284284
}
285285

286286
Path relativePath = Path.of(relativePathAsString);
287-
if ((platform == null || platform.isCurrent()) && relativePath.isAbsolute()) {
287+
if (platform != null && platform.isCurrent() && relativePath.isAbsolute()) {
288288
throw new PolicyValidationException("'relative_path' [" + relativePathAsString + "] must be relative");
289289
}
290290
fileData = FileData.ofRelativePath(relativePath, baseDir, mode);
291291
} else if (pathAsString != null) {
292292
Path path = Path.of(pathAsString);
293-
if ((platform == null || platform.isCurrent()) && path.isAbsolute() == false) {
293+
if (platform != null && platform.isCurrent() && path.isAbsolute() == false) {
294294
throw new PolicyValidationException("'path' [" + pathAsString + "] must be absolute");
295295
}
296296
fileData = FileData.ofPath(path, mode);

modules/repository-azure/src/main/plugin-metadata/entitlement-policy.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ io.netty.common:
44
- files:
55
- path: "/etc/os-release"
66
mode: "read"
7-
platform: linux
87
- path: "/usr/lib/os-release"
98
mode: "read"
10-
platform: linux
119
- path: "/proc/sys/net/core/somaxconn"
1210
mode: read
13-
platform: linux
1411
com.azure.identity:
1512
- files:
1613
- relative_path: "storage-azure/" #/config/storage-azure/azure-federated-token

modules/transport-netty4/src/main/plugin-metadata/entitlement-policy.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ io.netty.common:
99
- files:
1010
- path: "/etc/os-release"
1111
mode: "read"
12-
platform: linux
1312
- path: "/usr/lib/os-release"
1413
mode: "read"
15-
platform: linux
1614
- path: "/proc/sys/net/core/somaxconn"
1715
mode: read
18-
platform: linux

x-pack/plugin/security/src/main/plugin-metadata/entitlement-policy.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ io.netty.common:
1515
- files:
1616
- path: "/etc/os-release"
1717
mode: "read"
18-
platform: linux
1918
- path: "/usr/lib/os-release"
2019
mode: "read"
21-
platform: linux
2220
- path: "/proc/sys/net/core/somaxconn"
2321
mode: read
24-
platform: linux
2522
org.opensaml.xmlsec.impl:
2623
- write_system_properties:
2724
properties:

0 commit comments

Comments
 (0)