Skip to content

Commit db4f96b

Browse files
committed
Skip absolute/relative path validation if platform is "any" (null)
1 parent 342a23a commit db4f96b

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
@@ -276,13 +276,13 @@ public static FilesEntitlement build(List<Object> paths) {
276276
}
277277

278278
Path relativePath = Path.of(relativePathAsString);
279-
if ((platform == null || platform.isCurrent()) && relativePath.isAbsolute()) {
279+
if (platform != null && platform.isCurrent() && relativePath.isAbsolute()) {
280280
throw new PolicyValidationException("'relative_path' [" + relativePathAsString + "] must be relative");
281281
}
282282
fileData = FileData.ofRelativePath(relativePath, baseDir, mode);
283283
} else if (pathAsString != null) {
284284
Path path = Path.of(pathAsString);
285-
if ((platform == null || platform.isCurrent()) && path.isAbsolute() == false) {
285+
if (platform != null && platform.isCurrent() && path.isAbsolute() == false) {
286286
throw new PolicyValidationException("'path' [" + pathAsString + "] must be absolute");
287287
}
288288
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)