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

HotSpot Block- Whitelist Domain and Prevent Xss attack #109

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

RitwikSrivastava
Copy link

@RitwikSrivastava RitwikSrivastava commented Oct 7, 2024

When isVideoVariant is true, the code creates a new URL object from the content string. This can help prevent XSS attacks because it ensures that the content string is a properly formatted URL. If it's not, an error will be thrown and caught, preventing any potentially malicious code from being executed.

Additionally, the code checks if the hostname of the URL is included in a list of allowed video domains. This is another measure that can help prevent XSS attacks, as it restricts the sources of the videos to trusted domains

Fix #

Test URLs:

Copy link

aem-code-sync bot commented Oct 7, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link

aem-code-sync bot commented Oct 7, 2024

Page Scores Audits Google
📱 /hotspot-block/hotspot PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /hotspot-block/hotspot PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@RitwikSrivastava RitwikSrivastava changed the title HotSpot Block- Allowed Domain and Prevent Xss attack HotSpot Block- Whitelist Domain and Prevent Xss attack Oct 7, 2024
</iframe>
</div>`;
} else {
console.warn('Untrusted video URL:', url.href);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address linting errors.

@RitwikSrivastava RitwikSrivastava merged commit d778732 into main Oct 10, 2024
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.

2 participants