Skip to content

Commit 178512a

Browse files
committed
#Fix: Sanitize SPA JSON response within HTML response in order to avoid <script> parsing conflicts.
Issue: 99580
1 parent 6d340cd commit 178512a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.genexus.webpanels.GXWebObjectBase;
2929
import com.genexus.webpanels.WebSession;
3030

31+
import com.genexus.webpanels.WebUtils;
3132
import json.org.json.IJsonFormattable;
3233
import json.org.json.JSONArray;
3334
import json.org.json.JSONException;
@@ -933,7 +934,7 @@ public void SendState()
933934
AddStylesheetsToLoad();
934935
if (isSpaRequest())
935936
{
936-
writeTextNL("<script>gx.ajax.saveJsonResponse(" + getJSONResponse() + ");</script>");
937+
writeTextNL("<script>gx.ajax.saveJsonResponse(" + WebUtils.htmlEncode(JSONObject.quote(getJSONResponse()), true) + ");</script>");
937938
}
938939
else
939940
{

0 commit comments

Comments
 (0)