Skip to content

Commit 103c376

Browse files
security: replace document.write with appendChild in agreement/index.html (#28)
Replaces the use of document.write and innerHTML for meta tag injection with a safer DOM manipulation method. This addresses a security vulnerability where dynamic content was being written to the document using risky methods. The new implementation uses (doc.head || docEl).appendChild(metaEl), ensuring reliable and safe tag placement. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>
1 parent ecd5fdf commit 103c376

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

agreement/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,7 @@
150150
scale +
151151
", user-scalable=no"
152152
);
153-
if (docEl.firstElementChild) {
154-
docEl.firstElementChild.appendChild(metaEl);
155-
} else {
156-
var wrap = doc.createElement("div");
157-
wrap.appendChild(metaEl);
158-
doc.write(wrap.innerHTML);
159-
}
153+
(doc.head || docEl).appendChild(metaEl);
160154
}
161155

162156
function refreshRem() {

0 commit comments

Comments
 (0)