file-upload-security

Validate and re-encode user file uploads to prevent code execution and XSS attacks.

15|Updated May 12, 2026
One-click install
npx skills add https://github.com/GoldenWing-360/claude-security-skills --skill file-upload-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-upload-security
Source: https://github.com/GoldenWing-360/claude-security-skills/tree/main/file-upload-security
Command: npx skills add https://github.com/GoldenWing-360/claude-security-skills --skill file-upload-security

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the critical need to securely handle user-file uploads, preventing remote code execution, stored XSS, and polyglot attacks that can compromise web applications.

Core Features & Use Cases

  • Boundary validation: Implements size limits and content verification to filter malicious files.
  • Content defanging: Re-encodes images, strips EXIF, and sanitizes documents to neutralize embedded payloads.
  • Use Case: A developer adds a file upload endpoint to a web app or migrates storage from local disks to cloud object storage, ensuring security and integrity in the process.

Quick Start

Configure server-side size limits, validate file types based on magic bytes, generate server-controlled storage keys, re-encode images, and serve files from a separate, security-hardened domain with strict headers and signed URLs.

Frequently Asked Questions about file-upload-security

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

FAQPage Schema
How do I secure file uploads in a web application to prevent code execution?

Prevent cross-site scripting from stored files by re-encoding content, sanitizing documents to neutralize embedded payloads, and serving uploads from a separate security-hardened domain with strict headers.

How do I validate file types on the server side to block malicious uploads?

Validate file types on the server side by checking file magic bytes instead of extensions, enforcing strict size limits, and verifying content boundaries to filter malicious files.

What's the best way to sanitize uploaded images and remove embedded payloads?

Sanitize uploaded images by re-encoding the image files and stripping EXIF data, which neutralizes polyglot attacks and removes hidden malicious payloads embedded within the file content.

Does this file upload security approach work when migrating local storage to cloud object storage?

This approach works for migrating local storage to cloud object storage by generating server-controlled storage keys and serving files using signed URLs to maintain security and data integrity.

Why should user uploaded files be served from a separate domain?

User uploaded files should be served from a separate, security-hardened domain with strict headers to isolate untrusted content, preventing stored XSS and polyglot attacks from executing on the main application.