sanitizer-api VS React

Compare sanitizer-api vs React and see what are their differences.

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
sanitizer-api React
5 1,694
220 221,803
3.6% 1.1%
6.5 9.9
6 days ago 4 days ago
Bikeshed JavaScript
GNU General Public License v3.0 or later MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

sanitizer-api

Posts with mentions or reviews of sanitizer-api. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-06.
  • Mastering DOM manipulation with vanilla JavaScript
    5 projects | news.ycombinator.com | 6 Nov 2023
    That entire post is poor.

    • “Using regular expressions”: it suggests that this approach is acceptable within its limits. It’s not at all. As a simple example, the expression shown is trivially bypassed by "…". This is why, unlike the post claims claims, using regular expressions for cleaning HTML is not a common approach.

    • (“Eliminating the script tags”: not sure quite why you’re against it, but I also want to grumble about using `[...scriptElements].forEach((s) => s.remove())` instead of `for (const s of scriptElements) { s.remove(); }` or even `Array.prototype.forEach.call(scriptElements, (s) => s.remove())`. Creating an array from that HTMLCollection is just unnecessary and a bad habit.)

    • “Removing event handlers”: `value.startsWith('javascript:') || value.startsWith('data:text/html')` is inadequate. Tricks like capitalising in order to bypass such poor checks have been common for decades.

    • “Retrieving the sanitized HTML”: you are now vulnerable to mXSS attacks, which undo all your effort.

    • “Elements and attributes to remove from the DOM tree”: this proposes a blacklist approach and mentions a few examples of things that should be removed. Each example misses adjacent but equally-important things that should be removed. You will not get acceptable filtering if you start from this approach.

    • “Simplifying HTML sanitization with external libraries”: this is pitched merely as easier, faster and cheaper, rather than as the only way to have any confidence in the result.

    • “Conclusion”: as I hope I’ve shown, “The DOMParser API is one tool you can use to get the job done right.” is not an acceptable position.

    Really, the article could be significantly improved by presenting it as what a common developer might think, and then scribbling all over the problematic things with these explanations of why they’re so bad, and ending with the conclusion “so: just use the DOMPurify library; consider nothing else acceptable”. (There have at times been a couple of other libraries of acceptable quality, but as far as I’m concerned, DOMPurify has long been the one that everyone should use. I note also that this article is talking about client-side filtration. I’m not familiar with the state of the art in server-side HTML sanitisation, where you probably don’t have an actual DOM; this is also a reasonable place to wish to do filtering, but the remaining active mXSS vectors might pose a challenge. I’d want to research carefully before doing anything.)

    I look forward to the Sanitizer API <https://wicg.github.io/sanitizer-api/> being completed and deployed, so that DOMPurify can become just a fallback library for older browsers.

  • 5 injection vulnerabilities hackers don't want developers to know about (and how to prevent them)
    3 projects | /r/node | 22 Jun 2023
    The upcoming Sanitizer API - kinda like a native DOMPurify that provides el.setHTML() and Document.parseHTML()
  • Google, Mozilla Close to Finalizing Sanitizer API for Chrome and Firefox Browse
    5 projects | news.ycombinator.com | 20 Oct 2021
    The benefit of doing this client-side instead of server-side is that you can stay up to date with any changes that the client may make to how it's processing HTML that may have security implications. Additionally, you get to use the exact same code that the browser is ultimately using to parse the HTML, so a browser parsing bug, spec nuance, or un-specced legacy behavior that your backend developer didn't consider don't turn into serious security flaws.

    Additionally, the Sanitize API does a much better job of handling contextual parsing then many other similar backend APIs. What happens when you parse an HTML fragment assuming it will live in a `div`, and then it actually get inserted into a `table` cell? The spec goes into this is more detail here: https://wicg.github.io/sanitizer-api/#strings

    The downsides, of course, are those associated with any thick-client/thin-server API design—more logic on the front-end means more logic to reimplement for different consumers.

    Personally, I would probably still stick with Nokogiri for my own applications, but I can see both sides of the trade-off.

React

Posts with mentions or reviews of React. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-26.
  • Building an Email Assistant Application with Burr
    6 projects | dev.to | 26 Apr 2024
    You can use any frontend framework you want — react-based tooling, however, has a natural advantage as it models everything as a function of state, which can map 1:1 with the concept in Burr. In the demo app we use react, react-query, and tailwind, but we’ll be skipping over this largely (it is not central to the purpose of the post).
  • React 18.3.0 Is Out
    2 projects | news.ycombinator.com | 25 Apr 2024
    Oddly, no info on changelog: https://github.com/facebook/react/blob/main/CHANGELOG.md
  • Preact vs React: A Comparative Guide
    2 projects | dev.to | 23 Apr 2024
    In this post, we get to know more about Preact, one of this year's trending libraries. And we'll compare it to React to see which one suits better for our projects.
  • Meet Cheryl Murphy: Full-Stack Developer, lifelong learner, and volunteer Project Team Lead at Web Dev Path
    2 projects | dev.to | 22 Apr 2024
    Cheryl Murphy is not only a dedicated full-stack web developer skilled in technologies like React, Next.js, and NestJs but also a community-driven professional who recently took on the role of volunteer project team lead at Web Dev Path. With a dual Bachelor's degree in Computing and Chemical Engineering from Monash University, Cheryl’s journey in tech is marked by a passion for building accessible solutions and a commitment to fostering community within tech.
  • How to Build an AI FAQ System with Strapi, LangChain & OpenAI
    7 projects | dev.to | 21 Apr 2024
    Basic knowledge of ReactJs
  • Everyone Has JavaScript, Right?
    1 project | news.ycombinator.com | 21 Apr 2024
    Google Translate and many other libraries break React based sites if they are using refs.

    I don't think that point it falls under "written on naive assumptions"

    https://github.com/facebook/react/issues/11538

    the issue says closed but you can easily catch it in various sites and use cases.

  • Integrate Bootstrap with React
    2 projects | dev.to | 19 Apr 2024
    This article serves as your comprehensive guide to mastering the art of combining Bootstrap and React seamlessly. Dive in to uncover the tips, tricks, and best practices to elevate your UI design game effortlessly.
  • React Server Components Example with Next.js
    9 projects | dev.to | 16 Apr 2024
    This isn’t an accident; when Meta introduced React Server Components, Dan Abramov explicitly stated that they collaborated with the Next.js team to develop the RSC webpack plugin.
  • Collab Lab #66 Recap
    7 projects | dev.to | 7 Apr 2024
    JavaScript React Flowbite Tailwind Firebase - Auth, Database, and Hosting Vite
  • New Features in React 19 – Updates with Code Examples
    2 projects | dev.to | 4 Apr 2024
    Official Website Team GitHub Canary Releases

What are some alternatives?

When comparing sanitizer-api and React you can also consider the following projects:

uBlock-issues - This is the community-maintained issue tracker for uBlock Origin

qwik - Instant-loading web apps, without effort

DOMPurify - DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

Alpine.js - A rugged, minimal framework for composing JavaScript behavior in your markup.

html-dom - Common tasks of managing HTML DOM with vanilla JavaScript. Give me 1 ⭐if it’s useful.

Vue.js - This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

hackernews - Hacker News web site source code mirror.

SvelteKit - web development, streamlined

hscrpt

lit-element - LEGACY REPO. This repository is for maintenance of the legacy LitElement library. The LitElement base class is now part of the Lit library, which is developed in the lit monorepo.

Tailwind CSS - A utility-first CSS framework for rapid UI development.

Svelte - Cybernetically enhanced web apps