Skip to content

Commit

Permalink
Sanitize monitor messages from server and fix processid
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Carlos Rodríguez del Pino committed Apr 30, 2024
1 parent 5dabf64 commit 5faaaf1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion amd/build/vplide.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/vplide.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/vplui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/vplui.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions amd/src/vplide.js
Original file line number Diff line number Diff line change
Expand Up @@ -2024,8 +2024,8 @@ define(
'setResult': self.setResult,
'ajaxurl': options.ajaxurl,
'run': function(content, coninfo, ws) {
var parsed = /^([^:]*):?(.*)/i.exec(content);
var type = parsed[1];
var parsed = /^([^:]*):?(.*)/.exec(content);
var type = VPLUtil.sanitizeText(parsed[1]);
if (type == 'terminal' || type == 'webterminal') {
if (lastConsole && lastConsole.isOpen()) {
lastConsole.close();
Expand Down Expand Up @@ -2055,7 +2055,7 @@ define(
});
} else if (type == "browser") {
var URL = (coninfo.secure ? "https" : "http") + "://" + coninfo.server + ":" + coninfo.portToUse + "/";
URL += parsed[2] + "/httpPassthrough";
URL += VPLUtil.sanitizeText(parsed[2]) + "/httpPassthrough";
if (isTeacher) {
URL += "?private";
}
Expand Down
8 changes: 4 additions & 4 deletions amd/src/vplui.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ define(
var messageActions = {
'message': function(content) {
var parsed = /^([^:]*):?([^]*)/.exec(content);
var state = parsed[1];
var detail = parsed[2];
var state = VPLUtil.sanitizeText(parsed[1]);
var detail = VPLUtil.sanitizeText(parsed[2]);
if (state == 'running') {
state = running;
}
Expand All @@ -607,7 +607,7 @@ define(
}
},
'retrieve': function() {
var data = {"processid": VPLUtil.getProcessId()};
var data = {"processid": coninfo.processid};
pb.close();
delegated = true;
VPLUI.requestAction('retrieve', '', data, externalActions.ajaxurl)
Expand All @@ -627,7 +627,7 @@ define(
'close': function() {
VPLUtil.log('ws close message from jail');
ws.close();
var data = {"processid": VPLUtil.getProcessId()};
var data = {"processid": coninfo.processid};
VPLUI.requestAction('cancel', '', data, externalActions.ajaxurl, true);
}
};
Expand Down

0 comments on commit 5faaaf1

Please sign in to comment.