Enforce DOM integrity, move 3rd party scripts to cdn.jottocraft.com, remove more dead code
Change-Id: I60aedea97116b50e0b1b7cfe3071d9eb3ea80499
Reviewed-on: https://src.jottocraft.com/c/dtps/+/138
Reviewed-by: spike <[email protected]>
diff --git a/scripts/people.js b/scripts/people.js
index 09d4591..992f3f5 100644
--- a/scripts/people.js
+++ b/scripts/people.js
@@ -106,7 +106,7 @@
jQuery(".classContent").html(/*html*/`
<div style="--size: 250px; margin: 0px 20px;" class="grid flex">
<div class="block status card">
- <h2 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="main">${currentSection || "--"}</h2>
+ <h2 style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="main">${DOMPurify.sanitize(currentSection || "--")}</h2>
<h5 class="bottom"><i class="fluid-icon">contact_page</i> Your section</h5>
</div>
<div class="block status">
@@ -121,13 +121,13 @@
` + sections.map(section => (
/*html*/`
<div class="card">
- <h5><b>${section.title}</b> (${section.users.length} ${section.users.length == 1 ? "person" : "people"})</h5>
+ <h5><b>${DOMPurify.sanitize(section.title)}</b> (${section.users.length} ${section.users.length == 1 ? "person" : "people"})</h5>
${section.users.map(user => (
/*html*/`
<div>
<p>
- <img style="width: 30px; border-radius: 50%; vertical-align: middle; margin-right: 5px;" src="${user.photoURL}" />
- <a href="${user.url}" style="color: var(--text); vertical-align: middle;">${user.name}</a>
+ <img style="width: 30px; border-radius: 50%; vertical-align: middle; margin-right: 5px;" src="${dtps.escapeAttr(user.photoURL)}" />
+ <a href="${dtps.escapeAttr(dtps.safeURL(user.url))}" style="color: var(--text); vertical-align: middle;">${DOMPurify.sanitize(user.name)}</a>
</p>
</div>
`