Skip to content

Conversation

@imantsk
Copy link
Member

@imantsk imantsk commented Jul 10, 2025

No description provided.

ramiy and others added 28 commits April 28, 2025 21:44
Improve i18n, a11y, and security
Use CSS logical properties to support both LTR & RTL
fix: add missing comma to translation string formatting in safe mode notice

if ('markup' === snippetLanguage) {
snippetCodeModalTag.innerHTML = `<xmp>${snippetCode}</xmp>`
snippetCodeModalTag.innerHTML = `<xmp>${snippetCodeInput.value}</xmp>`

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 5 months ago

To fix the issue, the code should avoid using the xmp tag entirely and instead ensure that the content is safely encoded before adding it to the DOM. Specifically:

  1. Use textContent instead of innerHTML to prevent any interpretation of HTML.
  2. Replace the conditional branch that uses the xmp tag with a safe alternative that ensures the raw code is displayed without escaping it as HTML.

Suggested changeset 1
src/js/services/manage/cloud.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/js/services/manage/cloud.ts b/src/js/services/manage/cloud.ts
--- a/src/js/services/manage/cloud.ts
+++ b/src/js/services/manage/cloud.ts
@@ -29,7 +29,7 @@
 			snippetCodeModalTag.textContent = snippetCodeInput.value
 
 			if ('markup' === snippetLanguage) {
-				snippetCodeModalTag.innerHTML = `<xmp>${snippetCodeInput.value}</xmp>`
+				snippetCodeModalTag.textContent = snippetCodeInput.value
 			}
 
 			if ('php' === snippetLanguage) {
EOF
@@ -29,7 +29,7 @@
snippetCodeModalTag.textContent = snippetCodeInput.value

if ('markup' === snippetLanguage) {
snippetCodeModalTag.innerHTML = `<xmp>${snippetCodeInput.value}</xmp>`
snippetCodeModalTag.textContent = snippetCodeInput.value
}

if ('php' === snippetLanguage) {
Copilot is powered by AI and may make mistakes. Always verify output.
@imantsk imantsk merged commit 5d2e2d0 into feat/wp-playground Jul 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants