-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Feat/theme-photo #2921
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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
Show autofix suggestion
Hide autofix suggestion
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.
- Import the DOMPurify library.
- Use DOMPurify to sanitize the value retrieved from the
data-src
attribute before setting it as thesrc
attribute of theiframe
.
-
Copy modified line R35 -
Copy modified line R246
@@ -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'))) | ||
} |
-
Copy modified lines R45-R46
@@ -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" | ||
}, |
Package | Version | Security advisories |
dompurify (npm) | 3.1.7 | None |
一个图册的主题