Skip to content

Commit c1036a4

Browse files
committed
Fixed issue with System Property substitution during Policy Parsing
Signed-off-by: Pranav Reddy <[email protected]>
1 parent b17f851 commit c1036a4

File tree

1 file changed

+7
-1
lines changed
  • libs/agent-sm/agent-policy/src/main/java/org/opensearch/secure_sm/policy

1 file changed

+7
-1
lines changed

libs/agent-sm/agent-policy/src/main/java/org/opensearch/secure_sm/policy/PolicyFile.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ private static PermissionEntry expandPermissionName(PermissionEntry pe) {
137137
while ((b = pe.name().indexOf("${{", startIndex)) != -1 && (e = pe.name().indexOf("}}", b)) != -1) {
138138
sb.append(pe.name(), startIndex, b);
139139
String value = pe.name().substring(b + 3, e);
140-
sb.append("${{").append(value).append("}}");
140+
String propertyValue = System.getProperty(value);
141+
if (propertyValue != null) {
142+
sb.append(propertyValue);
143+
} else {
144+
// replacement not found
145+
sb.append("${{").append(value).append("}}");
146+
}
141147
startIndex = e + 2;
142148
}
143149

0 commit comments

Comments
 (0)