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-10521 Escape HTTP Characters in REST Interface #7216

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- appServer/serverInstAdminPassword.jsf -->

Expand Down Expand Up @@ -80,7 +81,7 @@
<!-- Text Field section -->
<sun:propertySheetSection id="propertSectionTextField">
<sun:property id="userIdProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18nc.domain.Userid}">
<sun:staticText id="UserId" text="#{sessionScope.userName}"/>
<sun:staticText id="UserId" text="#{sessionScope.sanitisedUserName}"/>
</sun:property>
<sun:property id="groupListProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18nc.domain.GroupList}">
<sun:staticText id="GroupList" text="#{pageSession.group}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
-->

<!-- Portions Copyright [2016-2017] [Payara Foundation] -->
<!-- Portions Copyright 2016-2025 Payara Foundation and/or its affiliates -->

<ui:event type="initPage">
setResourceBundle(key="i18n" bundle="org.glassfish.admingui.core.Strings");
Expand Down Expand Up @@ -165,6 +165,8 @@
</ui:event>
<!-- Masthead Integration Point -->
<ui:event type="afterCreate">
gf.sanitiseProperty(systemProperty="#{userName}", result="#{sanitisedVal}");
setSessionAttribute(key="sanitisedUserName", value="#{sanitisedVal}");
includeFirstIntegrationPoint(type="org.glassfish.admingui:masthead" root="$this{component}");
includeFirstIntegrationPoint(type="org.glassfish.admingui:favicon" root="#{view}");
</ui:event>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2020] [Payara Foundation and/or its affiliates]
Portions Copyright 2020-2025 Payara Foundation and/or its affiliates
-->

<sun:masthead id="Masthead" productImageURL="#{request.contextPath}/resource/payara-enterprise-theme/images/masthead-product_name_open-new.png"
style="border-width: 0px"
productImageDescription="$resource{theme.productName}"
productImageWidth="191"
productImageHeight="91"
userInfo="#{userName}" userInfoLabel="$resource{i18n.masthead.userInfoLabel}"
userInfo="#{sanitisedUserName}" userInfoLabel="$resource{i18n.masthead.userInfoLabel}"
roleInfo="#{domainName}" roleInfoLabel="$resource{i18n.masthead.domainInfoLabel}"
serverInfo="#{hostName}" serverInfoLabel="$resource{i18n.masthead.serverInfoLabel}"
dateTime="$boolean{false}" notificationMsg="$attribute{null}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
only if the new code is made subject to such option by the copyright
holder.
Portions Copyright [2016-2022] [Payara Foundation and/or its affiliates]
Portions Copyright 2016-2025 Payara Foundation and/or its affiliates
-->

<sun:masthead id="Masthead" productImageURL="#{request.contextPath}/resource/community-theme/images/masthead-product_name_open-new.png"
style="border-width: 0px"
productImageDescription="$resource{theme.productName}"
userInfo="#{userName}" userInfoLabel="$resource{i18n.masthead.userInfoLabel}"
userInfo="#{sanitisedUserName}" userInfoLabel="$resource{i18n.masthead.userInfoLabel}"
roleInfo="#{domainName}" roleInfoLabel="$resource{i18n.masthead.domainInfoLabel}"
serverInfo="#{hostName}" serverInfoLabel="$resource{i18n.masthead.serverInfoLabel}"
dateTime="$boolean{false}" notificationMsg="$attribute{null}">
Expand Down
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 [2019-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright 2019-2025 Payara Foundation and/or its affiliates

package org.glassfish.admin.rest.provider;

Expand Down Expand Up @@ -330,7 +330,7 @@ protected String processChildren(List<ActionReport.MessagePart> parts) {
result.append("<li><table border=\"1\" style=\"border-collapse: collapse\">")
.append("<tr><td>Message</td>")
.append("<td>")
.append(part.getMessage())
.append(ResourceUtil.encodeString(part.getMessage()))
.append("</td></tr><td>Properties</td><td>")
.append(getHtml(part.getProps()))
.append("</td></tr>");
Expand Down Expand Up @@ -369,7 +369,7 @@ protected String getHtmlRepresentation(Object object) {
result = getHtml((Map) object);
}
} else {
result = object.toString();
result = ResourceUtil.encodeString(object.toString());
}

return result;
Expand Down