Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
638f4f9
#3167 Fixed escaping fields
Patrykb0802 Aug 20, 2025
553d46b
#3167 Fixed escaping fields
Patrykb0802 Sep 9, 2025
b91323c
PR #3188: revert client-side escapes; rely on DWR converters (compoun…
Patrykb0802 Sep 19, 2025
ff46b13
#3167 Fixed escaping fields
Patrykb0802 Sep 19, 2025
50c733b
#3167 Fixed escaping fields
Patrykb0802 Sep 29, 2025
807c18d
#3167 Fixed escaping fields
Patrykb0802 Sep 29, 2025
85bb87e
#3167 Fixed escaping fields:
Limraj Oct 20, 2025
78a433e
Merge remote-tracking branch 'origin/release/2.8.1' into fix/#3167_Fi…
Limraj Oct 20, 2025
41ed7c3
#3167 Fixed escaping fields:
Limraj Oct 20, 2025
46df75b
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 22, 2025
c434525
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Patrykb0802 Oct 24, 2025
032165e
#3197 CVE-2021-26829 Mitigation Guidance [System settings]
Patrykb0802 Oct 24, 2025
ea9d0ac
Merge remote-tracking branch 'origin/release/2.8.1' into fix/#3167_Fi…
Limraj Oct 24, 2025
d5d0155
#3167 fixed escaping fields:
Limraj Oct 27, 2025
7857b12
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
5294e59
Merge branch 'fix/#3167_Fixed_escaping_fields' into fix/#3209_Fixed_e…
Patrykb0802 Oct 27, 2025
36df160
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Patrykb0802 Oct 27, 2025
308cfd4
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Patrykb0802 Oct 27, 2025
a633198
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
114fce8
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Patrykb0802 Oct 27, 2025
53abe05
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
dbbdeac
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
44a57fc
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
2b2db63
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 27, 2025
a2bd771
#3167 fixed escaping fields
Limraj Oct 28, 2025
336073d
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 28, 2025
69a5290
#3197 CVE-2021-26829 Mitigation Guidance [System settings]:
Limraj Oct 28, 2025
4a57878
Revert "#3206 Fixed escaping fields in Event handlers, Users profiles…
Limraj Oct 28, 2025
96836fd
Revert "#3206 Fixed escaping fields in Event handlers, Users profiles…
Limraj Oct 28, 2025
3e9d950
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 28, 2025
d85d2b4
#3167 fixed escaping fields:
Limraj Oct 28, 2025
77a6ade
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 28, 2025
ff266cd
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 28, 2025
ef76c36
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 28, 2025
273e5ec
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 28, 2025
e2f051a
#3167 fixed escaping fields:
Limraj Oct 28, 2025
0f9f0b4
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 28, 2025
874976b
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 28, 2025
ad3f73c
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 28, 2025
30afb6a
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 28, 2025
0c5c5d4
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Patrykb0802 Oct 28, 2025
d62e425
#3167 fixed escaping fields:
Limraj Oct 29, 2025
42f80a6
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 29, 2025
9d00007
#3167 fixed escaping fields:
Limraj Oct 29, 2025
0e4a86c
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 29, 2025
9895c2d
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 29, 2025
6ed1f8a
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 29, 2025
238b096
#3167 fixed escaping fields:
Limraj Oct 29, 2025
d702f5e
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 29, 2025
e7106d0
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 30, 2025
371ad44
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Patrykb0802 Oct 30, 2025
5a71e4f
Revert "#3206 Fixed escaping fields in Event handlers, Users profiles…
Patrykb0802 Oct 30, 2025
68f8c9f
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 30, 2025
90ea04a
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 30, 2025
2760c3a
#3206 Fixed escaping fields in Event handlers, Users profiles, watch …
Limraj Oct 30, 2025
c23b567
Merge pull request #3208 from SCADA-LTS/fix/#3206_Fixed_escaping_fiel…
Limraj Oct 30, 2025
6ee4e58
Merge branch 'fix/#3167_Fixed_escaping_fields' into fix/#3209_Fixed_e…
Limraj Oct 30, 2025
98909c2
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Limraj Oct 30, 2025
3d1838c
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Oct 30, 2025
859ceb7
#3197 CVE-2021-26829 Mitigation Guidance [System settings]:
Limraj Oct 30, 2025
d6d7a42
Merge pull request #3211 from SCADA-LTS/fix/#3197_CVE-2021-26829_Miti…
Limraj Oct 31, 2025
933da50
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Patrykb0802 Nov 3, 2025
fc39b50
Merge remote-tracking branch 'origin/fix/#3167_Fixed_escaping_fields'…
Limraj Nov 3, 2025
4ce8086
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Limraj Nov 3, 2025
e3aac36
Merge pull request #3210 from SCADA-LTS/fix/#3209_Fixed_escaping_fiel…
Limraj Nov 3, 2025
91b4d67
#3209 Fixed escaping fields in mailing lists, maintenance events, poi…
Limraj Nov 3, 2025
d03c24a
Merge pull request #3212 from SCADA-LTS/fix/#3209_Fixed_escaping_fiel…
Limraj Nov 3, 2025
92f807e
#3167 fixed escaping fields
Patrykb0802 Nov 10, 2025
bb846a3
#3209 Fixed escaping fields - new UI
Patrykb0802 Nov 14, 2025
df73e93
#3167 fixed escaping fields
Patrykb0802 Nov 28, 2025
11bb6b0
#3167 fixed escaping fields
Patrykb0802 Dec 1, 2025
8f90b7d
#3167 fixed escaping fields
Patrykb0802 Dec 8, 2025
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
79 changes: 49 additions & 30 deletions WebContent/WEB-INF/dwr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

<dwr>
<init>
<converter id="localizableMessage" class="com.serotonin.web.dwr.LocalizableMessageConverter"/>
<converter id="protocolVersionConverter" class="com.serotonin.mango.web.dwr.ProtocolVersionConverter"/>
<converter id="xssDataPointVoConverter" class="com.serotonin.mango.web.dwr.XssDataPointVoConverter"/>
<converter id="xssDataPointBeanConverter" class="com.serotonin.mango.web.dwr.XssDataPointBeanConverter"/>
<converter id="opcUaDataTypeConverter" class="com.serotonin.mango.web.dwr.OpcUaDataTypeConverter"/>
<converter id="xssLocalizableMessageString" class="org.scada_lts.web.security.dwr.XssLocalizableMessageConverter"/>
<converter id="protocolVersionEnum" class="com.serotonin.mango.web.dwr.ProtocolVersionConverter"/>
<converter id="opcUaDataTypeEnum" class="com.serotonin.mango.web.dwr.OpcUaDataTypeConverter"/>
<converter id="xssBean" class="org.scada_lts.web.security.dwr.XssBeanConverter"/>
</init>

<allow>
Expand Down Expand Up @@ -111,8 +110,8 @@
<convert converter="bean" match="org.scada_lts.ds.polling.protocol.opcua.vo.OpcUaItem" />
<convert converter="bean" match="br.org.scadabr.api.vo.*" />

<convert converter="bean" match="com.serotonin.db.IntValuePair"/>
<convert converter="bean" match="com.serotonin.db.KeyValuePair"/>
<convert converter="xssBean" match="com.serotonin.db.IntValuePair"/>
<convert converter="xssBean" match="com.serotonin.db.KeyValuePair"/>

<convert converter="bean" match="com.serotonin.mango.rt.dataSource.http.HttpReceiverPointSample"/>
<convert converter="bean" match="com.serotonin.mango.rt.dataSource.onewire.OneWireContainerInfo"/>
Expand All @@ -139,28 +138,28 @@
<convert converter="bean" match="com.serotonin.mango.vo.dataSource.virtual.*"/>

<convert converter="bean" match="com.serotonin.mango.vo.event.handlers.*"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.CompoundEventDetectorVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.EventHandlerVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.EventTypeVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.MaintenanceEventVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.PointEventDetectorVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.event.ScheduledEventVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.hierarchy.PointFolder"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.CompoundEventDetectorVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.EventHandlerVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.EventTypeVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.MaintenanceEventVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.PointEventDetectorVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.event.ScheduledEventVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.hierarchy.PointFolder"/>
<convert converter="bean" match="com.serotonin.mango.vo.link.PointLinkVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.mailingList.*"/>
<convert converter="bean" match="com.serotonin.mango.vo.permission.DataPointAccess"/>
<convert converter="bean" match="com.serotonin.mango.vo.publish.PublishedPointVO"/>
<convert converter="bean" match="com.serotonin.mango.vo.publish.PublisherVO">
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.PublishedPointVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.PublisherVO">
<param name="exclude" value="type,eventCodes"/>
</convert>
<convert converter="bean" match="com.serotonin.mango.vo.publish.httpSender.*"/>
<convert converter="bean" match="com.serotonin.mango.vo.publish.pachube.*"/>
<convert converter="bean" match="com.serotonin.mango.vo.publish.persistent.*"/>
<convert converter="bean" match="com.serotonin.mango.vo.report.*"/>
<convert converter="xssDataPointVoConverter" match="com.serotonin.mango.vo.DataPointVO">
<convert converter="xssBean" match="com.serotonin.mango.vo.DataPointVO">
<param name="include" value="id,xid,name,extendedName,dataSourceId,enabled,dataTypeMessage,pointLocator,engineeringUnits"/>
</convert>
<convert converter="xssDataPointBeanConverter" match="com.serotonin.mango.web.dwr.beans.DataPointBean">
<convert converter="xssBean" match="com.serotonin.mango.web.dwr.beans.DataPointBean">
<param name="include" value="id,xid,name,settable,dataType,dataTypeMessage,chartColour"/>
</convert>
<convert converter="bean" match="com.serotonin.mango.vo.User">
Expand All @@ -172,16 +171,16 @@
<convert converter="bean" match="br.org.scadabr.vo.permission.ViewAccess">
<param name="include" value="id,permission"/>
</convert>
<convert converter="bean" match="com.serotonin.mango.view.View">
<convert converter="xssBean" match="com.serotonin.mango.view.View">
<param name="include" value="id,name"/>
</convert>
<convert converter="bean" match="br.org.scadabr.vo.usersProfiles.UsersProfileVO">
<convert converter="xssBean" match="br.org.scadabr.vo.usersProfiles.UsersProfileVO">
<param name="include" value="id,name,dataSourcePermissions,dataPointPermissions, watchlistPermissions, viewPermissions"/>
</convert>
<convert converter="bean" match="com.serotonin.mango.vo.WatchList">
<convert converter="xssBean" match="com.serotonin.mango.vo.WatchList">
<param name="include" value="id,name"/>
</convert>
<convert converter="bean" match="com.serotonin.mango.vo.UserComment"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.UserComment"/>

<convert converter="bean" match="com.serotonin.mango.web.dwr.beans.*"/>
<convert converter="bean" match="com.serotonin.mango.web.dwr.longPoll.LongPollRequest"/>
Expand All @@ -190,8 +189,8 @@
<convert converter="bean" match="com.serotonin.web.dwr.DwrMessageI18n"/>
<convert converter="bean" match="com.serotonin.web.dwr.DwrResponseI18n"/>

<convert converter="localizableMessage" match="com.serotonin.web.i18n.LocalizableMessage"/>
<convert converter="bean" match="br.org.scadabr.vo.scripting.ScriptVO">
<convert converter="xssLocalizableMessageString" match="com.serotonin.web.i18n.LocalizableMessage"/>
<convert converter="xssBean" match="br.org.scadabr.vo.scripting.ScriptVO">
<param name="exclude" value="type"/>
</convert>
<!-- MBus4J stuff-->
Expand All @@ -216,8 +215,8 @@
<convert converter="enum" match="org.scada_lts.ds.messaging.protocol.amqp.DurabilityType" />
<convert converter="enum" match="org.scada_lts.ds.messaging.protocol.amqp.MessageAckType" />
<convert converter="enum" match="org.scada_lts.ds.messaging.protocol.amqp.AmqpVersion" />
<convert converter="protocolVersionConverter" match="org.scada_lts.ds.messaging.protocol.ProtocolVersion" />
<convert converter="opcUaDataTypeConverter" match="org.scada_lts.ds.polling.protocol.opcua.vo.OpcUaDataType" />
<convert converter="protocolVersionEnum" match="org.scada_lts.ds.messaging.protocol.ProtocolVersion" />
<convert converter="opcUaDataTypeEnum" match="org.scada_lts.ds.polling.protocol.opcua.vo.OpcUaDataType" />
<convert converter="enum" match="org.scada_lts.ds.polling.protocol.opcua.vo.OpcUaIdentifierType" />
<convert converter="enum" match="org.scada_lts.ds.polling.protocol.opcua.security.OpcUaMessageSecurityType" />
<convert converter="enum" match="org.scada_lts.ds.polling.protocol.opcua.security.OpcUaSecurityPolicyType" />
Expand All @@ -240,15 +239,35 @@
<convert converter="enum" match="net.sf.fhz4j.FhzDeviceTypes" />
<!- - Fhz4J stuff-->

<convert converter="xssBean" match="com.serotonin.mango.web.dwr.beans.EventSourceBean"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.mailingList.AddressEntry"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.mailingList.MailingList"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.mailingList.UserEntry"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.report.ReportInstance"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.report.ReportVO"/>
<convert converter="xssBean" match="com.serotonin.mango.web.dwr.beans.RecipientListEntryBean"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.bean.PointHistoryCount"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.bean.ImageValueBean"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.httpSender.HttpSenderVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.httpSender.HttpPointVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.pachube.PachubeSenderVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.pachube.PachubePointVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.persistent.PersistentSenderVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.publish.persistent.PersistentPointVO"/>
<convert converter="xssBean" match="com.serotonin.mango.util.ExportCodes"/>
<convert converter="xssBean" match="com.serotonin.mango.util.ExportCodes.Element"/>
<convert converter="enum" match="com.serotonin.mango.vo.publish.PublisherVO$Type"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.dataSource.http.HttpReceiverPointLocatorVO"/>
<convert converter="xssBean" match="com.serotonin.mango.vo.dataSource.sql.SqlPointLocatorVO"/>


<convert converter="exception" match="java.lang.Exception">
<param name="include" value="message"/>
</convert>

<convert converter="bean" match="org.scada_lts.dao.model.UserIdentifier"/>
<convert converter="bean" match="org.scada_lts.web.mvc.api.dto.MailingListJson"/>
<convert converter="bean" match="org.scada_lts.web.mvc.api.dto.EmailRecipientJson"/>
<convert converter="xssBean" match="org.scada_lts.dao.model.UserIdentifier"/>
<convert converter="xssBean" match="org.scada_lts.web.mvc.api.dto.MailingListJson"/>
<convert converter="xssBean" match="org.scada_lts.web.mvc.api.dto.UserEntryJson"/>
<convert converter="xssBean" match="org.scada_lts.web.mvc.api.dto.AddressEntryJson"/>
</allow>
<signatures>
<![CDATA[
Expand Down
2 changes: 1 addition & 1 deletion WebContent/WEB-INF/jsp/compoundEvents.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
editingCompoundEvent = ced;

$set("xid", ced.xid);
$set("name", ced.name);
$set("name", unescapeHtml(ced.name));
$set("alarmLevel", ced.alarmLevel);
$set("rtn", ced.returnToNormal);
$set("condition", ced.condition);
Expand Down
4 changes: 2 additions & 2 deletions WebContent/WEB-INF/jsp/dataSourceEdit/editHttpReceiver.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@
}

function editPointCBImpl(locator) {
$set("parameterName", locator.parameterName);
$set("parameterName", unescapeHtml(locator.parameterName));
$set("dataTypeId", locator.dataTypeId);
$set("binary0Value", locator.binary0Value);
$set("binary0Value", unescapeHtml(locator.binary0Value));
changeDataTypeId();
}

Expand Down
6 changes: 3 additions & 3 deletions WebContent/WEB-INF/jsp/dataSourceEdit/editSql.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
}

function editPointCBImpl(locator) {
$set("fieldName", locator.fieldName);
$set("timeOverrideName", locator.timeOverrideName);
$set("updateStatement", locator.updateStatement);
$set("fieldName", unescapeHtml(locator.fieldName));
$set("timeOverrideName", unescapeHtml(locator.timeOverrideName));
$set("updateStatement", unescapeHtml(locator.updateStatement));
$set("dataTypeId", locator.dataTypeId);
}

Expand Down
8 changes: 4 additions & 4 deletions WebContent/WEB-INF/jsp/eventHandlers.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
var pointNode, dataSourceNode, publisherNode, etNode, wid;

allPoints = data.allPoints;

emailRecipients = new mango.erecip.EmailRecipients("emailRecipients",
"<spring:message code="eventHandlers.recipTestEmailMessage" />",
data.mailingLists, data.users);
Expand Down Expand Up @@ -228,7 +228,7 @@
img = "images/cog_process.png";

var node = dojo.widget.createWidget("TreeNode", {
title: "<img src='"+ img +"'/> <span id='"+ handler.id +"Msg'>"+ handler.message +"</span>",
title: "<img src='"+ img +"'/> <span id='"+ handler.id +"Msg'>"+ unescapeHtml(handler.message) +"</span>",
widgetId: "h"+ handler.id,
object: handler
});
Expand Down Expand Up @@ -286,7 +286,7 @@
$set("handlerTypeSelect", handler.handlerType);
$("handlerTypeSelect").disabled = true;
$set("xid", handler.xid);
$set("alias", handler.alias);
$set("alias", unescapeHtml(handler.alias));
$set("disabled", handler.disabled);
if (handler.handlerType == <c:out value="<%= EventHandlerVO.TYPE_SET_POINT %>"/>) {
$set("targetPointSelect", handler.targetPointId);
Expand Down Expand Up @@ -527,7 +527,7 @@
selectedHandlerNode.onTitleClick();
}
else
$set(handler.id +"Msg", handler.message);
$set(handler.id +"Msg", unescapeHtml(handler.message));

setUserMessage("<spring:message code="eventHandlers.saved"/>");
selectedHandlerNode.object = handler;
Expand Down
18 changes: 9 additions & 9 deletions WebContent/WEB-INF/jsp/include/settingsEditor.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@

this.updatePointList = function(dataTypes) {
dwr.util.removeAllOptions("settingsPointList");
for (i=0; i<settingsEditor.pointList.length; i++) {
if (contains(dataTypes, settingsEditor.pointList[i].dataType)) {
jQuery("#settingsPointList").append( new Option(
settingsEditor.pointList[i].name,
settingsEditor.pointList[i].id) );
}
}
jQuery("#settingsPointList").append( new Option('',-1) );

for (let i = 0; i < settingsEditor.pointList.length; i++) {
const p = settingsEditor.pointList[i];
if (contains(dataTypes, p.dataType)) {
const label = unescapeHtml(p.name);
jQuery("#settingsPointList").append(new Option(label, p.id));
}
}
jQuery("#settingsPointList").append( new Option('',-1) );
};
}
var settingsEditor = new SettingsEditor();
Expand Down
8 changes: 6 additions & 2 deletions WebContent/WEB-INF/jsp/mailingLists.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
editingMailingList = ml;

$set("xid", ml.xid);
$set("name", ml.name);
$set("name", unescapeHtml(ml.name));
$set("dailyLimitSentEmailsNumber", ml.dailyLimitSentEmailsNumber);
$set("cronPattern", ml.cronPattern);
$set("collectInactiveEmails", ml.collectInactiveEmails);
Expand Down Expand Up @@ -98,7 +98,10 @@
if (!found)
availUsers[availUsers.length] = user;
}
dwr.util.addOptions($("userList"), availUsers, "id", "username");
dwr.util.addOptions($("userList"), availUsers,
function(u) { return u.id; },
function(u) { return unescapeHtml(u.username); }
);
}

function saveMailingList() {
Expand Down Expand Up @@ -226,6 +229,7 @@
referenceAddress : addr
};
editingMailingList.entries[editingMailingList.entries.length] = addressEntry;
addressEntry.referenceAddress = escapeHtml(addressEntry.referenceAddress);
appendAddressEntry(addressEntry);
updateEmptyListMessage();
}
Expand Down
13 changes: 8 additions & 5 deletions WebContent/WEB-INF/jsp/maintenanceEvents.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
oncedays[oncedays.length] = new OptionData(i, i);

MaintenanceEventsDwr.getMaintenanceEvents(function(response) {
dwr.util.addOptions("dataSourceId", response.data.dataSources, "key", "value");
var ds = response.data.dataSources.map(function(o) {
return { key: o.key, value: unescapeHtml(o.value) };
});
dwr.util.addOptions("dataSourceId", ds, "key", "value");

var events = response.data.events;
for (var i=0; i<events.length; i++) {
Expand All @@ -77,9 +80,9 @@

updateToggle(response.data.activated);

$set("xid", me.xid);
$set("xid", unescapeHtml(me.xid));
$set("dataSourceId", me.dataSourceId);
$set("alias", me.alias);
$set("alias", unescapeHtml(me.alias));
$set("alarmLevel", me.alarmLevel);
updateAlarmLevelImage();
$set("scheduleType", me.scheduleType);
Expand All @@ -92,14 +95,14 @@
$set("activeHour", me.activeHour);
$set("activeMinute", me.activeMinute);
$set("activeSecond", me.activeSecond);
$set("activeCron", me.activeCron);
$set("activeCron", unescapeHtml(me.activeCron));
$set("inactiveYear", me.inactiveYear);
$set("inactiveMonth", me.inactiveMonth);
$set("inactiveDay", me.inactiveDay);
$set("inactiveHour", me.inactiveHour);
$set("inactiveMinute", me.inactiveMinute);
$set("inactiveSecond", me.inactiveSecond);
$set("inactiveCron", me.inactiveCron);
$set("inactiveCron", unescapeHtml(me.inactiveCron));

setUserMessage();
});
Expand Down
4 changes: 2 additions & 2 deletions WebContent/WEB-INF/jsp/pointEdit/pointProperties.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</td>
</tr>

<spring:bind path="form.name">
<spring:bind path="form.name" htmlEscape="false">
<tr>
<td class="formLabelRequired"><spring:message code="pointEdit.props.name"/></td>
<div>
Expand All @@ -59,7 +59,7 @@
</tr>
</spring:bind>

<spring:bind path="form.description">
<spring:bind path="form.description" htmlEscape="false">
<tr>
<td class="formLabelRequired"><spring:message code="pointEdit.props.description"/></td>
<td class="formField"><input type="text" class="formLong" name="description" value="<c:out value="${status.value}"/>"/></td>
Expand Down
42 changes: 27 additions & 15 deletions WebContent/WEB-INF/jsp/pointHierarchySLTS.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -815,21 +815,33 @@ var messages = {
dialog.getButton('btn-Close').disable();
var $button = this;
$button.disable();
$button.spin();
dialog.setClosable(false);
$.ajax({
type: "POST",
dataType: "json",
url:myLocation+"pointHierarchy/new/0/"+dialog.getModalBody().find('input').val(),
success: function(msg){
var titleNewNode = dialog.getModalBody().find('input').val();
dialog.getModalBody().html('<div><h3>'+messages.folder+':</h3><ul><li>'+messages.key+':<b>'+msg+'</b></li><li>'+messages.title+':<b>'+titleNewNode+'</b></li></ul></div>');
$button.hide();
$button.stopSpin();
dialog.setClosable(true);
dialog.getButton('btn-Close').enable();
dialog.close();
reload();
$button.spin();
dialog.setClosable(false);
let inputs = dialog.getModalBody().find('input');
let titleNewNode;
if(inputs.length == 1) {
let inputNode = inputs[0];
titleNewNode = inputNode.value ? inputNode.value.replaceAll('\\','').replaceAll('\/','') : '';
}
Comment on lines +820 to +825
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for the pointHierarchy/new endpoint handler
rg -n 'pointHierarchy.*new' --type=java | head -30

Repository: SCADA-LTS/Scada-LTS

Length of output: 3112


🏁 Script executed:

#!/bin/bash
# Search for class/controller that handles point hierarchy endpoints
rg -n 'class.*PointHierarchy.*Controller|class.*PointHierarchy.*Service' --type=java -i

Repository: SCADA-LTS/Scada-LTS

Length of output: 424


🏁 Script executed:

#!/bin/bash
# Search for handler methods that process titleNewNode or similar path parameters
rg -n '@.*Mapping.*pointHierarchy|@.*Mapping.*hierarchy' --type=java -A 10 | head -50

Repository: SCADA-LTS/Scada-LTS

Length of output: 5995


🏁 Script executed:

#!/bin/bash
# Search for XssProtectUtils and validation utilities that might be in use
rg -n 'XssProtectUtils|XssBeanConverter|ValidationUtils|SanitizationUtils' --type=java

Repository: SCADA-LTS/Scada-LTS

Length of output: 13716


🏁 Script executed:

#!/bin/bash
# Get full PointHierarchyController.java file to see complete endpoint implementation
wc -l src/org/scada_lts/web/mvc/controller/PointHierarchyController.java

Repository: SCADA-LTS/Scada-LTS

Length of output: 133


🏁 Script executed:

#!/bin/bash
# Read the addPointHierarchy and editPointHierarchy methods completely
sed -n '137,170p' src/org/scada_lts/web/mvc/controller/PointHierarchyController.java

Repository: SCADA-LTS/Scada-LTS

Length of output: 1862


🏁 Script executed:

#!/bin/bash
# Find and read PointHierarchyService.add() method
rg -n 'public.*add\(' src/org/scada_lts/service/pointhierarchy/PointHierarchyService.java -A 15 | head -60

Repository: SCADA-LTS/Scada-LTS

Length of output: 560


🏁 Script executed:

#!/bin/bash
# Check PointHierarchyService.edt() method as well (used in editPointHierarchy)
rg -n 'public.*edt\(' src/org/scada_lts/service/pointhierarchy/PointHierarchyService.java -A 15

Repository: SCADA-LTS/Scada-LTS

Length of output: 572


🏁 Script executed:

#!/bin/bash
# Find the PointHierarchyXidDAO implementation
find src -name '*PointHierarchyXidDAO*' -type f

Repository: SCADA-LTS/Scada-LTS

Length of output: 125


🏁 Script executed:

#!/bin/bash
# Search for the insert and updateTitle method implementations
rg -n 'insert|updateTitle' src/org/scada_lts/dao/pointhierarchy/ -A 10 | head -80

Repository: SCADA-LTS/Scada-LTS

Length of output: 6677


Server-side validation is missing—implement comprehensive input validation on the endpoint.

The server endpoint /pointHierarchy/new/{newParentId}/{newTitle} and its edit counterpart receive newTitle directly with no validation before persisting to the database. The DAO layer performs only trim() and relies on JDBC parameterized queries (which protect against SQL injection but not invalid data).

Add server-side validation in the service or controller to enforce:

  • Non-empty, length limits
  • Character encoding validation
  • XSS protection (e.g., XssProtectUtils.escapeHtml() if storing HTML-unsafe content)
  • Rejection of dangerous characters if needed

Note: The service class has a TODO comment at line 161 acknowledging incomplete validation, confirming this gap.

🤖 Prompt for AI Agents
In @WebContent/WEB-INF/jsp/pointHierarchySLTS.jsp around lines 820 - 825, The
endpoint handlers for /pointHierarchy/new/{newParentId}/{newTitle} and the edit
counterpart accept newTitle raw and lack server-side validation; update the
controller/service that handles these routes to validate and sanitize newTitle
(enforce non-empty and max length, verify/normalize character encoding, reject
or strip dangerous characters, and apply XSS escaping via
XssProtectUtils.escapeHtml() before persisting), implement these checks where
the TODO at line 161 indicates incomplete validation, and return clear 4xx
responses on validation failure instead of persisting invalid input.


if(!titleNewNode) {
dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>'+ messages.errorThrown +':'+errorThrown+'</p></div>');
dialog.setClosable(true);
dialog.getButton('btn-Close').enable();
return;
}
Comment on lines +827 to +832
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Undefined message key and variable reference.

Line 828 contains two critical issues:

  1. messages.folderNotAdd is not defined in the messages object (lines 523-559). This will display "undefined" to users.
  2. errorThrown is referenced but doesn't exist in this scope—it only exists in the error callback at line 846.
🐛 Proposed fix

First, add the missing message key to the messages object (around line 559):

  areYouSureToMoveElement: "<spring:message code="pointHierarchySLTS.areYouSureToMoveElement"/>",
- movedElement: "<spring:message code="pointHierarchySLTS.movedElement"/>"
+ movedElement: "<spring:message code="pointHierarchySLTS.movedElement"/>",
+ folderNotAdd: "<spring:message code="pointHierarchySLTS.folderNotAdd"/>"

Then fix the error message construction at line 828:

 if(!titleNewNode) {
-  dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>'+ messages.errorThrown +':'+errorThrown+'</p></div>');
+  dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>Title cannot be empty</p></div>');
   dialog.setClosable(true);
   dialog.getButton('btn-Close').enable();
   return;
 }

Note: You'll also need to add the corresponding i18n message key pointHierarchySLTS.folderNotAdd to your properties files.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(!titleNewNode) {
dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>'+ messages.errorThrown +':'+errorThrown+'</p></div>');
dialog.setClosable(true);
dialog.getButton('btn-Close').enable();
return;
}
if(!titleNewNode) {
dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>Title cannot be empty</p></div>');
dialog.setClosable(true);
dialog.getButton('btn-Close').enable();
return;
}
🤖 Prompt for AI Agents
In @WebContent/WEB-INF/jsp/pointHierarchySLTS.jsp around lines 827 - 832, The
dialog uses an undefined UI string and an out-of-scope error variable: add a new
message key (e.g., messages.folderNotAdd or
messages.pointHierarchySLTS.folderNotAdd) to the messages object and to i18n
properties, and replace the out-of-scope errorThrown reference in the dialog
HTML with a defined value (either a new messages key like
messages.errorThrown/messageGeneric or the actual error parameter from the AJAX
error callback); ensure the dialog construction in the branch that checks
titleNewNode uses only defined message keys/variables.


$.ajax({
type: "POST",
dataType: "json",
url:myLocation+"pointHierarchy/new/0/"+titleNewNode,
success: function(msg){
$button.hide();
$button.stopSpin();
dialog.setClosable(true);
dialog.getButton('btn-Close').enable();
dialog.close();
reload();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
dialog.getModalBody().html('<div><h3>'+messages.folderNotAdd+'</h3><p>'+ messages.errorThrown +':'+errorThrown+'</p></div>');
Expand Down
Loading
Loading