python-filename-sanitization

Community

Safely sanitize user filenames in Python apps

AuthorViktorBarzin
Version1.0.0
Installs0

System Documentation

What problem does it solve?

User-provided filenames can contain malicious characters that enable path traversal, shell injection, or filesystem corruption. Directly using user input in file operations is a security risk.

Core Features & Use Cases

  • Whitelist-based sanitization: Allows only safe characters and preserves file extensions.
  • Safe integration with Python file operations: Uses pathlib to avoid shell commands and prevent directory traversal.
  • Real-world use case: When handling file uploads or renaming files in a web app, sanitize the input before saving to disk.

Quick Start

Use sanitize_filename to clean a user-provided filename before saving it.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: python-filename-sanitization
Download link: https://github.com/ViktorBarzin/infra/archive/main.zip#python-filename-sanitization

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.