Skip to content

Commit 1bdca1d

Browse files
authored
#Fix: Sanitize SPA JSON response within HTML response in order to avoid <script> parsing conflicts. (#633)
Issue: 99580
1 parent 83735b3 commit 1bdca1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java/src/main/java/com/genexus/internet/HttpContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.genexus.webpanels.GXWebObjectBase;
2323
import com.genexus.webpanels.WebSession;
2424

25+
import com.genexus.webpanels.WebUtils;
2526
import json.org.json.IJsonFormattable;
2627
import json.org.json.JSONArray;
2728
import json.org.json.JSONException;
@@ -943,7 +944,7 @@ public void SendState()
943944
AddStylesheetsToLoad();
944945
if (isSpaRequest())
945946
{
946-
writeTextNL("<script>gx.ajax.saveJsonResponse(" + getJSONResponse() + ");</script>");
947+
writeTextNL("<script>gx.ajax.saveJsonResponse(" + WebUtils.htmlEncode(JSONObject.quote(getJSONResponse()), true) + ");</script>");
947948
}
948949
else
949950
{

0 commit comments

Comments
 (0)