Article may be outdated

This article is 46 days old. Some details may have changed since publication.

Hacker News·3 min read·medium

Is It Safe to Host HTML That Runs Its Own JavaScript?

H
HenningWitzel
Is It Safe to Host HTML That Runs Its Own JavaScript?
AI Summary

A developer explains their strategy for hosting user-uploaded HTML and JavaScript by utilizing sandboxed iframes rather than attempting to sanitize the code. This approach treats all uploaded content as inherently hostile to prevent security breaches.

Why it matters

It offers a practical, security-first architectural solution for platforms that rely on user-generated interactive content.

Dive DeeperCreate a free account to unlock

We host whatever HTML people upload, JavaScript and all, and most of it is generated by an AI and never read line by line first. So the honest answer to 'what stops that code from injecting something or hijacking a session' is not that we scrub it clean. It is that we assume every page is hostile and make that assumption not matter. Here is exactly how.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologybusiness
Political Bias
Center
LeftLean LCenterLean RRight
Confidence: 80%

The content is a technical explanation of a security strategy with no political or social agenda.

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in