Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-9553 Sanitise properties in admin console #6943

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright 2018-2022 Payara Foundation and/or affiliates
// Portions Copyright 2018-2024 Payara Foundation and/or affiliates

/*
* UtilHandlers.java
Expand Down Expand Up @@ -1164,4 +1164,16 @@ public static String escapePropertyValue(String str){
}

private static final String PATH_SEPARATOR = "${path.separator}";

@Handler(id = "gf.sanitiseProperty",
input = {
@HandlerInput(name = "systemProperty", type = String.class, required = true)
},
output = {
@HandlerOutput(name = "result", type = String.class)
}
)
public static void sanitiseProperty(HandlerContext handlerCtx) {
handlerCtx.setOutputValue("result", escapePropertyValue(((String)handlerCtx.getInputValue("systemProperty"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2018-2024] [Payara Foundation and/or its affiliates]
-->

<sun:table id="sysPropsTable" style="padding: 10pt" title="$resource{i18n.common.AdditionalProperties}"
Expand All @@ -62,7 +63,8 @@
foreach(var="prop", list="#{pageSession.sysProps}") {
createMap(result="#{row}");
mapPut(map="#{row}", key="name", value="#{prop.name}");
mapPut(map="#{row}", key="currentValue", value="#{!empty prop.value ? prop.value : prop.defaultValue}");
gf.sanitiseProperty(systemProperty="#{!empty prop.value ? prop.value : prop.defaultValue}", result="#{currentVal}");
mapPut(map="#{row}", key="currentValue", value="#{currentVal}");
mapPut(map="#{row}", key="overrideValue", value="#{!empty prop.value ? prop.value : ''}");
listAdd(list="#{pageSession.tableList}", value="#{row}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2018-2024] [Payara Foundation and/or its affiliates]
-->

<!-- iiopServerPageNode.jsf -->
Expand All @@ -59,6 +60,8 @@
listAdd(value="#{pageSession.iiopListenerAttrs.data.extraProperties.entity['port']}" list="#{pageSession.iiopPortsList}");
}
gf.resolveTokens(tokens="#{pageSession.iiopPortsList}" endPoint="#{sessionScope.REST_URL}/servers/server/#{pageSession.instanceName}" resolvedTokens="#{pageSession.iiopResolvedPortsList}");
convertListToCommaString(list="#{pageSession.iiopResolvedPortsList}" commaString="#{pageSession.iiopPorts}");
convertListToCommaString(list="#{pageSession.iiopResolvedPortsList}" commaString="#{iiopPorts}");
gf.sanitiseProperty(systemProperty="#{iiopPorts}", result="#{pageSession.iiopPorts}");

/>
</sun:property>
5 changes: 3 additions & 2 deletions appserver/admingui/web/src/main/resources/serverPageNode.jsf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2018] [Payara Foundation and/or its affiliates]
Portions Copyright [2018-2024] [Payara Foundation and/or its affiliates]
-->

<!-- serverPageNode.jsf -->
Expand All @@ -60,6 +60,7 @@
listAdd(value="#{pageSession.tmpPort}" list="#{pageSession.httpPortsList}");
}
gf.resolveTokens(tokens="#{pageSession.httpPortsList}" endPoint="#{sessionScope.REST_URL}/servers/server/#{pageSession.instanceName}" resolvedTokens="#{pageSession.httpResolvedPortsList}");
convertListToCommaString(list="#{pageSession.httpResolvedPortsList}" commaString="#{pageSession.httpPorts}");
convertListToCommaString(list="#{pageSession.httpResolvedPortsList}" commaString="#{portList}");
gf.sanitiseProperty(systemProperty="#{portList}", result="#{pageSession.httpPorts}");
/>
</sun:property>