Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/theme-photo #2921

Merged
merged 7 commits into from
Nov 4, 2024
Merged

Feat/theme-photo #2921

merged 7 commits into from
Nov 4, 2024

Conversation

tangly1024
Copy link
Owner

一个图册的主题

Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
notion-next-home ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 8:58am
notion-next-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 8:58am
notion-next-seo-lesson ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 8:58am

if (item.querySelector('figcaption').textContent.trim() === value) {
item.classList.add('active')
if (iframe) {
iframe.setAttribute('src', iframe.getAttribute('data-src'))

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

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

Copilot Autofix AI 25 days ago

To fix the problem, we need to ensure that the value retrieved from the data-src attribute is properly sanitized before being used as the src attribute of the iframe. One way to do this is to use a library like DOMPurify to sanitize the value. This will help prevent any malicious content from being executed.

  1. Import the DOMPurify library.
  2. Use DOMPurify to sanitize the value retrieved from the data-src attribute before setting it as the src attribute of the iframe.
Suggested changeset 2
themes/photo/index.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/themes/photo/index.js b/themes/photo/index.js
--- a/themes/photo/index.js
+++ b/themes/photo/index.js
@@ -34,2 +34,3 @@
 import { Style } from './style'
+import DOMPurify from 'dompurify'
 
@@ -244,3 +245,3 @@
               if (iframe) {
-                iframe.setAttribute('src', iframe.getAttribute('data-src'))
+                iframe.setAttribute('src', DOMPurify.sanitize(iframe.getAttribute('data-src')))
               }
EOF
@@ -34,2 +34,3 @@
import { Style } from './style'
import DOMPurify from 'dompurify'

@@ -244,3 +245,3 @@
if (iframe) {
iframe.setAttribute('src', iframe.getAttribute('data-src'))
iframe.setAttribute('src', DOMPurify.sanitize(iframe.getAttribute('data-src')))
}
package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -44,3 +44,4 @@
     "react-share": "^4.4.1",
-    "react-tweet-embed": "~2.0.0"
+    "react-tweet-embed": "~2.0.0",
+    "dompurify": "^3.1.7"
   },
EOF
@@ -44,3 +44,4 @@
"react-share": "^4.4.1",
"react-tweet-embed": "~2.0.0"
"react-tweet-embed": "~2.0.0",
"dompurify": "^3.1.7"
},
This fix introduces these dependencies
Package Version Security advisories
dompurify (npm) 3.1.7 None
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

cloudflare-workers-and-pages bot commented Nov 4, 2024

Deploying notionnext with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ccaf6b
Status:⚡️  Build in progress...

View logs

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.

1 participant