Skip to content

Commit d0f26f6

Browse files
Ritwik SrivastavaRitwik Srivastava
Ritwik Srivastava
authored and
Ritwik Srivastava
committed
Prevent Xss attack
1 parent bc643de commit d0f26f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

blocks/hotspot/hotspot.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ export default function decorate(block) {
2626
const allowedVideoDomains = ['youtube.com', 'vimeo.com', 'sidekick-library--aem-block-collection--adobe'];
2727
try {
2828
const url = new URL(content);
29-
//the below code can be updated to include more video hosting sites
30-
const isTrustedDomain = allowedVideoDomains.some((domain) => url.hostname.includes(domain));
29+
// the below code can be updated to include more video hosting sites
30+
const domainCheck = (domain) => url.hostname.includes(domain);
31+
const isTrustedDomain = allowedVideoDomains.some(domainCheck);
3132
if (isTrustedDomain) {
3233
video.innerHTML = `
3334
<div class="embed-default">

0 commit comments

Comments
 (0)