Skip to content

Commit

Permalink
Main page: message
Browse files Browse the repository at this point in the history
- to prevent an XSS vulnerability, sanitize the message when provided as a parameter
- system and logout messages may still contain HTML tags
  • Loading branch information
tomas-muller committed Jul 25, 2024
1 parent 07b2e9c commit c17adc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion JavaSource/org/unitime/timetable/action/MainAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.IOException;

import org.apache.commons.text.StringEscapeUtils;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.tiles.annotation.TilesDefinition;
Expand Down Expand Up @@ -78,7 +79,9 @@ public void printInitializationError() throws IOException {
}

public String execute() throws Exception {
if (message == null)
if (message != null && !message.isEmpty())
message = StringEscapeUtils.escapeHtml4(message);
else if (message == null)
message = getSystemMessage();
if ("cas-logout".equals(op)) {
message = MSG.casLoggedOut();
Expand Down
9 changes: 9 additions & 0 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
</description>
</item>
</category>
<category>
<title>Other</title>
<item>
<name>Main page</name>
<description>
<line>To prevent an XSS vulnerability, sanitize the message when provided as a parameter.</line>
</description>
</item>
</category>
</release>
<release>
<version>4.7.109</version>
Expand Down

0 comments on commit c17adc2

Please sign in to comment.