Skip to content

Commit f72ec85

Browse files
authored
Make sure file accesses in DnRoleMapper are done in stack frames with permissions (#112400) (#112441)
* Make sure file accesses are done in stack frames with permissions * Update docs/changelog/112400.yaml * Delete docs/changelog/112400.yaml * Update docs/changelog/112400.yaml
1 parent 253e854 commit f72ec85

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/changelog/112400.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 112400
2+
summary: Make sure file accesses in `DnRoleMapper` are done in stack frames with permissions
3+
area: Infra/Core
4+
type: bug
5+
issues: []

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public static Map<String, List<String>> parseFile(Path path, Logger logger, Stri
114114
}
115115

116116
try {
117-
Settings settings = Settings.builder().loadFromPath(path).build();
117+
// create this here so it's in an allowed stack frame
118+
var file = Files.newInputStream(path);
119+
Settings settings = Settings.builder().loadFromStream(path.getFileName().toString(), file, false).build();
118120

119121
Map<DN, Set<String>> dnToRoles = new HashMap<>();
120122
Set<String> roles = settings.names();

0 commit comments

Comments
 (0)