Project ideas from Hacker News discussions.

Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection in Firefox 148

📝 Discussion Summary (Click to expand)

1. Safety vs. “sanitisation” is still a moving target

“I’m also rather sceptical of things that ‘sanitise’ HTML, both because there’s a long history of them having holes, and because it’s not immediately clear what that means, and what exactly is considered ‘safe’.” – entuno
“If you still want to allow some markup, you can configure the sanitizer… but you still need to be careful.” – itishappy

2. Naming matters – the API should make danger obvious

“The ‘unsafe’ suffix conveys information to the reader, whereas innerHTML does not.” – orf
“The only way to make the unsafe path feel unsafe is to name it that way.” – kevincloudsec

3. Legacy, compatibility and browser support are real hurdles

“At this point that API has been around for decades and is probably impossible to deprecate without breaking fairly large amounts of the web.” – entuno
“It might be a while before browser support is widely distributed enough to rely on it being present.” – simonw

4. When and why you’d actually use the new API

“Use setHTML when you need to render HTML that is potentially unsafe (e.g. forum posts or IM messages).” – chrisldgk
“If you want to allow <strong> and <em> in a forum post but not <script>, this is the right tool.” – benmmurphy

These four themes capture the core of the discussion: the ongoing debate over XSS safety, the importance of clear naming, the practical limits of adoption, and the specific scenarios where the new API is useful.


🚀 Project Ideas

SafeDOM Linter Plugin

Summary

  • Detects unsafe DOM manipulation (innerHTML, insertAdjacentHTML, etc.) and flags them in code.
  • Suggests safe alternatives (textContent, setHTML, setHTMLUnsafe) and auto‑fixes.
  • Integrates with ESLint, Prettier, and popular IDEs.

Details

Key Value
Target Audience Front‑end developers, teams using React/Vue/Vanilla JS
Core Feature Static analysis + auto‑fix for unsafe DOM APIs
Tech Stack ESLint plugin, TypeScript, Node.js, VS Code extension
Difficulty Medium
Monetization Revenue‑ready: $15/month per team

Notes

  • HN users complain about “innerHTML” being unsafe and hard to refactor.
  • “I want a linter that explicitly bans innerHTML” (thenewnewguy).
  • The tool would surface the exact line, show a diff, and offer a quick fix, reducing XSS risk.

InnerHTML Blocker Browser Extension

Summary

  • Globally disables or warns against innerHTML usage on any visited page.
  • Provides a toggle to enable safe rendering or to block dangerous content.
  • Helps developers test sites for accidental unsafe DOM writes.

Details

Key Value
Target Audience Developers, security auditors, QA teams
Core Feature Runtime interception of innerHTML assignments
Tech Stack Chrome/Firefox extension APIs, JavaScript, WebExtension
Difficulty Low
Monetization Hobby

Notes

  • “Delete Element.prototype.innerHTML” idea (austin‑cheney) shows the need for a quick toggle.
  • Users can see a banner when a page tries to use innerHTML, making the risk visible.

Sanitizer‑API as a Service

Summary

  • Web service that sanitizes arbitrary HTML snippets using the browser’s native Sanitizer API.
  • Offers customizable configurations (allowlist, disallowlist) and validation.
  • Returns safe HTML or a detailed report of removed elements.

Details

Key Value
Target Audience CMS developers, forum software, content platforms
Core Feature Server‑side sanitization via headless browser
Tech Stack Node.js, Puppeteer, Express, Docker
Difficulty Medium
Monetization Revenue‑ready: $0.01 per 1,000 sanitizations or $5/month plan

Notes

  • “I want a tool that validates HTML snippets” (intrasight).
  • The service removes the need to ship custom sanitizers and guarantees consistency with browser parsing.

AI‑Assisted Refactor: InnerHTML → setHTML

Summary

  • AI‑driven CLI that scans a codebase, identifies innerHTML usage, and proposes safe replacements (setHTML, textContent).
  • Provides a diff preview, allows selective acceptance, and updates tests automatically.

Details

Key Value
Target Audience Legacy code maintainers, open‑source projects
Core Feature LLM‑powered refactoring with context awareness
Tech Stack Python, OpenAI API, Git hooks, Diff tooling
Difficulty High
Monetization Revenue‑ready: $50/month for enterprise usage

Notes

  • “AI shines for find and replace” (charcircuit).
  • The tool addresses the “my code still uses innerHTML” pain point and reduces manual refactoring effort.

Read Later