Introduction

Contents

Introduction#

PythonCodeAudit Badge OpenSSF Best Practices PyPI - Version Documentation License

Python File Audit: Build secure Python applications by default. Validate files before you use them.

A robust file-validation library designed to protect your Python applications and scripts against untrusted or malicious input.

logo

Getting Started

In the Getting Started section you can find installation instructions and a high-level overview of the main concepts.

User Guide

Check out the User Guides for in-depth information.

API Reference

The API reference guide contains detailed information on all methods and checks possible. All possible with a simple decorator method @validate_..() or API call validate..()

Contributor’s Guide

Want to improve the documentation? Want to add a validation for another file extension? Found a bug? Improve existing functionalities? The contributing guidelines will guide you!

Python programs are not immune to cybersecurity threats.

File validation shouldn’t be a security afterthought. Make it effortless, make it default.

Python File Audit offers a powerful yet straightforward security solution:

  • Ease of Use: Simple to operate for quick audits.

  • Extensibility: Easy to customize and adapt for diverse use cases.

  • Impactful Analysis: Powerful detection of security weaknesses that have the potential to become critical vulnerabilities.

Enjoying Python File Audit Support us with a GitHub star! It’s a simple way to help others find us and contributes to a more secure Python ecosystem. ⭐️

Features#

Python File Audit protects you from using insecure files and file-based attacks with a comprehensive set of safety checks

  • File size limit – Prevents oversized files from being processed

  • GZip decompression ratio – Guards against decompression bombs

  • Tar member count – Limits the number of entries inside tar archives

  • Total extracted size – Caps the overall size of extracted content

  • Individual file size – Enforces a maximum size per extracted file

  • Path traversal protection – Blocks ../ and absolute path tricks

  • Reject symlinks – Disallows symbolic links

  • Reject hardlinks – Disallows hard links

  • Reject device files – Blocks device nodes

  • Reject FIFOs – Blocks named pipes

  • Filename length – Enforces a maximum filename length

  • Directory depth – Limits how deeply nested directories can be

These checks work can be used by a simple API or adding a decorator function without changing your current code!

Background#

The availability of well-maintained, open source simple file validation tools for Python code is very limited.

Note

This Python File Audit tool is built to be fast, lightweight, and easy to use.

Donate

Our mission is to make cybersecurity simpler and more robust. Join us in building a better open-source solution—your support makes it possible. All donations will be used strictly to fund the development and maintenance of Python Code Audit.

Make A Donation

If you are unable to make a small donation, that’s fine. Just enjoy this tool and spread the word!