commit 1265843: [WebUI] Escape HTML characters in errors history

moisseev moiseev at mezonplus.ru
Mon Jul 29 17:55:16 UTC 2024


Author: moisseev
Date: 2024-04-09 09:14:07 +0300
URL: https://github.com/rspamd/rspamd/commit/126584384ea4d7e26289771b4d663e796f2f65f6 (refs/pull/4913/head)

[WebUI] Escape HTML characters in errors history

---
 interface/js/app/history.js | 4 ++++
 interface/js/app/libft.js   | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/interface/js/app/history.js b/interface/js/app/history.js
index 6366f6723..185922087 100644
--- a/interface/js/app/history.js
+++ b/interface/js/app/history.js
@@ -262,6 +262,10 @@ define(["jquery", "app/common", "app/libft", "footable"],
                                 sortValue: item.ts
                             }
                         };
+                        for (const prop in item) {
+                            if (!{}.hasOwnProperty.call(item, prop)) continue;
+                            if (typeof item[prop] === "string") item[prop] = common.escapeHTML(item[prop]);
+                        }
                     });
                     if (Object.prototype.hasOwnProperty.call(common.tables, "errors")) {
                         common.tables.errors.rows.load(rows);
diff --git a/interface/js/app/libft.js b/interface/js/app/libft.js
index e45a1718d..1e81cfd26 100644
--- a/interface/js/app/libft.js
+++ b/interface/js/app/libft.js
@@ -491,9 +491,7 @@ define(["jquery", "app/common", "footable"],
                         });
                         break;
                     default:
-                        if (typeof item[prop] === "string") {
-                            item[prop] = common.escapeHTML(item[prop]);
-                        }
+                        if (typeof item[prop] === "string") item[prop] = common.escapeHTML(item[prop]);
                 }
             }
 


More information about the Commits mailing list