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

Add HTML Embedding Whitelist for Enhanced XSS Security #326

Open
devleejb opened this issue Aug 31, 2024 · 0 comments
Open

Add HTML Embedding Whitelist for Enhanced XSS Security #326

devleejb opened this issue Aug 31, 2024 · 0 comments
Labels
enhancement 🌟 New feature or request good first issue 🐤 Good for newcomers

Comments

@devleejb
Copy link
Member

What would you like to be added:
To improve XSS security, we have introduced rehype-sanitize. However, this implementation has restricted the usage of beneficial HTML embedding features, such as StrawPoll and Google Calendar. It is crucial to explore solutions that would allow us to securely utilize this functionality.

The following adjustments to the sanitization schema have been proposed:

[
  rehypeSanitize,
  {
      ...defaultSchema,
      tagNames: [...(defaultSchema.tagNames ?? []), "iframe", "div"],
      attributes: {
          ...defaultSchema.attributes,
          iframe: [
              "src",
              "width",
              "height",
              "frameborder",
              "allow",
              "allowfullscreen",
              "allowtransparency",
              "style",
          ],
          div: ["style"],
      },
      protocols: {
          ...defaultSchema.protocols,
          src: [
              ...(defaultSchema.protocols?.src || []),
              "https://strawpoll.com",
              "https://cdn.strawpoll.com",
          ],
      },
  },
]

With these changes, StrawPoll functionality works, but it is necessary to verify security implications. Additionally, we should consider a scalable structure that allows for the inclusion of other certified sites.

Why is this needed:

Providing a secure and flexible HTML embedding feature will enhance user experience while maintaining safety against XSS attacks. By integrating trusted sources, we can offer richer functionalities without compromising security.

Additional Information:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature or request good first issue 🐤 Good for newcomers
Projects
Status: Backlog
Status: Backlog
Development

No branches or pull requests

1 participant