diff --git a/gns3server/controller/link.py b/gns3server/controller/link.py index 03c5f12c1..90ec12fcc 100644 --- a/gns3server/controller/link.py +++ b/gns3server/controller/link.py @@ -18,6 +18,7 @@ import os import re import uuid +import html import asyncio import aiohttp @@ -83,7 +84,7 @@ class Link: "x": -10, "y": -10, "rotation": 0, - "text": "{}/{}".format(adapter_number, port_number), + "text": html.escape("{}/{}".format(adapter_number, port_number)), "style": "font-size: 10; font-style: Verdana" } diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index 9b330cf2b..23b8e8b1e 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -17,6 +17,7 @@ import aiohttp import asyncio +import html import copy import uuid import os @@ -229,7 +230,7 @@ class Node: self._label = { "y": round(self._height / 2 + 10) * -1, - "text": self._name, + "text": html.escape(self._name), "style": style, "x": None, # None: mean the client should center it "rotation": 0 diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 79d57d7f7..32c2ddf7a 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -16,6 +16,7 @@ # along with this program. If not, see . import os +import html import json import copy import uuid @@ -434,7 +435,7 @@ def _convert_1_3_later(topo, topo_path): size=int(font_info[1]), weight=weight, style=style, - text=note["text"] + text=html.escape(note["text"]) ) new_note = { "drawing_id": str(uuid.uuid4()), @@ -521,7 +522,7 @@ def _convert_label(label): """ style = qt_font_to_style(label.get("font"), label.get("color")) return { - "text": label["text"], + "text": html.escape(label["text"]), "rotation": 0, "style": style, "x": int(label["x"]),