-
Notifications
You must be signed in to change notification settings - Fork 333
Fix/#3167 fixed escaping fields #3204
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
base: release/2.8.1
Are you sure you want to change the base?
Changes from all commits
638f4f9
553d46b
b91323c
ff46b13
50c733b
807c18d
85bb87e
78a433e
41ed7c3
46df75b
c434525
032165e
ea9d0ac
d5d0155
7857b12
5294e59
36df160
308cfd4
a633198
114fce8
53abe05
dbbdeac
44a57fc
2b2db63
a2bd771
336073d
69a5290
4a57878
96836fd
3e9d950
d85d2b4
77a6ade
ff266cd
ef76c36
273e5ec
e2f051a
0f9f0b4
874976b
ad3f73c
30afb6a
0c5c5d4
d62e425
42f80a6
9d00007
0e4a86c
9895c2d
6ed1f8a
238b096
d702f5e
e7106d0
371ad44
5a71e4f
68f8c9f
90ea04a
2760c3a
c23b567
6ee4e58
98909c2
3d1838c
859ceb7
d6d7a42
933da50
fc39b50
4ce8086
e3aac36
91b4d67
d03c24a
92f807e
bb846a3
df73e93
11bb6b0
8f90b7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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('\/','') : ''; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Undefined message key and variable reference. Line 828 contains two critical issues:
🐛 Proposed fixFirst, 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 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| $.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>'); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 3112
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 424
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 5995
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 13716
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 133
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 1862
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 560
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 572
🏁 Script executed:
Repository: SCADA-LTS/Scada-LTS
Length of output: 125
🏁 Script executed:
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 receivenewTitledirectly with no validation before persisting to the database. The DAO layer performs onlytrim()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:
XssProtectUtils.escapeHtml()if storing HTML-unsafe content)Note: The service class has a TODO comment at line 161 acknowledging incomplete validation, confirming this gap.
🤖 Prompt for AI Agents