(Halloween Edition) Evil HTML vs. Tsugi — Safely Serving Dangerous Uploaded Files @ChuckSeverance
(Halloween Edition) Evil HTML vs. Tsugi — Safely Serving Dangerous Uploaded Files  @ChuckSeverance
Uploaded November 2026 | Updated November 2026, 14 hours ago
In this episode, I take on one of those deceptively small LMS security problems that quickly turns into a much deeper design exercise:

How do you safely let instructors upload and download HTML, ZIP, TAR, and other potentially dangerous files?

Teachers need these files. Source code often comes in ZIP archives. HTML examples are useful in courses. But uploaded HTML can also become a Trojan horse if the browser treats it as trusted application content.

So I start tightening up Tsugi’s file-serving path.

The goals are to allow useful file types while making dangerous behavior much harder:

Warn users before opening risky uploads
Open untrusted content in a separate browser context
Sandbox uploaded HTML
Prevent access to the application’s authenticated origin
Disable MIME sniffing
Force archive formats to download safely
Keep ZIP and TAR files usable without pretending they are harmless

A key part of the solution is browser security headers, including Content Security Policy sandboxing and X-Content-Type-Options: nosniff. The sandbox deliberately avoids allow-same-origin, which prevents uploaded HTML from inheriting Tsugi’s authenticated browser state.

Then the session gets more entertaining.

I ask Cursor to build an intentionally hostile HTML test fixture designed to probe things like cookies, local storage, forms, JavaScript execution, and same-origin access.

Then I ask ChatGPT to make it even more evil.

The goal is defensive: create nasty browser content and verify that Tsugi’s isolation actually stops it from escaping the sandbox or acting with the privileges of a logged-in user.

Along the way I also exercise the file-replacement feature from the previous session, debug MIME-type detection, refine the hostile HTML fixtures, and keep both versions around for future regression testing.

This is a security problem I first ran into in Sakai nearly twenty years ago. Modern browsers give us much stronger tools now, and AI makes it much easier to explore the threat model, build tests, implement the protections, and iterate on the user experience quickly.

Happy Halloween. 🎃
(Halloween Edition) Evil HTML vs. Tsugi — Safely Serving Dangerous Uploaded FilesWeek 10 – PHPshell Outage, Midterm Preparation, and Updated Course ScheduleBehind the Scenes: How I Quickly Edit my Coding with AI Podcast and Upload to YouTube (Using AI)Office Hours with Pranab and Corey: Fixing Video UX and Talking About Teaching with AIVibe Coding to Production: I Shipped It Without Reading the CodeDJ 20.01 Django Marketplace Initial Project Setup with Virtual Environment (9:45)Shelby takes brunch at Red Spire in Traverse City MI #aussie #spoiledpup #dogcationAI Master Programmer with Dr. Chuck:  Making my Udemy Coupon Site One-To-Many with AI in 60 MinutesAI Coding with Dr. Chuck – LTI 1.3 in Tsugi Lessons, AGS Part 2Coding with AI: Modeling LTI Dynamic Registration the Right WayDJ 03.01 Setting Up Django 5.2 on Python Anywhere (31:58)AI Coding with Dr. Chuck: Adding a Notifications Feature to Tsugi
Chuck Severance |

(Halloween Edition) Evil HTML vs. Tsugi — Safely Serving Dangerous Uploaded Files

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER