event-handler-removal

Remove HTML and SVG event handler attributes from HTML content.

836|66|Updated Feb 3, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/html-to-markdown --skill event-handler-removal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-handler-removal
Source: https://github.com/kreuzberg-dev/html-to-markdown/tree/main/.ai-rulez/domains/safety-sanitization/skills/event-handler-removal
Command: npx skills add https://github.com/kreuzberg-dev/html-to-markdown --skill event-handler-removal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the security risk posed by JavaScript event handlers embedded within HTML content, preventing potential cross-site scripting (XSS) attacks and unintended script execution.

Core Features & Use Cases

  • Comprehensive Event Handler Removal: Identifies and removes standard HTML event attributes (e.g., onclick, onload) and SVG event attributes.
  • Robust Pattern Matching: Utilizes wildcard pattern matching to catch variations and encoded forms of event handlers.
  • Use Case: When processing user-submitted HTML content, use this Skill to ensure that no malicious JavaScript can be injected through event attributes, making the content safe for display.

Quick Start

Use the event-handler-removal skill to sanitize the provided HTML content.

Frequently Asked Questions about event-handler-removal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove JavaScript event handlers from HTML to prevent XSS attacks?

To remove JavaScript event handlers from HTML and prevent XSS attacks, you can sanitize the content by stripping standard HTML and SVG event attributes. This process targets common attributes like onclick and onload to ensure safe output.

What is HTML sanitization for event handlers and how does it work?

HTML sanitization for event handlers is the process of removing JavaScript event attributes from HTML content to prevent script injection. It works by using wildcard pattern matching to identify and strip standard HTML, SVG, and encoded event handler variants.

Does event handler removal catch encoded variations of on-click attributes in SVG content?

Yes, event handler removal catches encoded variations of attributes in SVG content by utilizing robust wildcard pattern matching. This ensures that both standard and encoded forms of event handlers are identified and removed for security.

What's the best way to sanitize user-submitted HTML content before displaying it?

The best way to sanitize user-submitted HTML content is to apply pattern matching sanitization logic that removes JavaScript event handlers. This prevents cross-site scripting by targeting common HTML and SVG event attributes before display.

Why does HTML sanitization target SVG event attributes along with standard HTML ones?

HTML sanitization targets SVG event attributes alongside standard HTML ones because both formats support event handlers like onload. Removing these attributes prevents unintended script execution and cross-site scripting through vector graphics.