diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js
index 51abb8a..77933f2 100644
--- a/src/js/whiteboard.js
+++ b/src/js/whiteboard.js
@@ -5,6 +5,7 @@ import InfoService from "./services/InfoService";
import ThrottlingService from "./services/ThrottlingService";
import ConfigService from "./services/ConfigService";
import html2canvas from "html2canvas";
+import DOMPurify from "dompurify";
const RAD_TO_DEG = 180.0 / Math.PI;
const DEG_TO_RAD = Math.PI / 180.0;
@@ -774,6 +775,14 @@ const whiteboard = {
_this.setTextboxFontSize(_this.latestActiveTextBoxId, thickness);
}
},
+ imgWithSrc(url) {
+ return $(
+ DOMPurify.sanitize('', {
+ ALLOWED_TAGS: ["img"],
+ ALLOWED_ATTR: ["src"], // kill any attributes malicious url introduced
+ })
+ );
+ },
addImgToCanvasByUrl: function (url) {
var _this = this;
var oldTool = _this.tool;
@@ -784,14 +793,14 @@ const whiteboard = {
finalURL = imageURL + url;
}
+ var img = this.imgWithSrc(finalURL).css({ width: "100%", height: "100%" });
+ finalURL = img.attr("src");
+
_this.setTool("mouse"); //Set to mouse tool while dropping to prevent errors
_this.imgDragActive = true;
_this.mouseOverlay.css({ cursor: "default" });
var imgDiv = $(
'