CLI & API for secure file upload validation: check file type (magic bytes, MIME), detect Office macros/malware, audit logging, and CI/CD integration.
Project description
secure-file-check (Python)
CLI + API for file type validation and suspicious Office detection
A lightweight utility to validate file types by comparing extensions against magic bytes and detecting potentially malicious Office documents (e.g., VBA macros). This tool is designed for security-conscious Python applications that handle user uploads, ensuring that a file is exactly what it claims to be.
Features
- Magic Byte Validation: Verifies file content against extensions to prevent spoofing.
- Suspicious Office Detection: Identifies the presence of VBA projects or macros in documents like
.docxor.xlsx. - Structured Output: Emits JSON for easy integration with CI/CD and log aggregators.
- Audit Logging: Writes structured JSON audit lines to stderr or a dedicated log file.
- Supported Types:
png,jpg,jpeg,pdf,docx,xlsx,gif,bmp,tiff,mp3,wav,svg.
Installation
pip install secure-file-check
CLI Usage
secure-file-check --file=path/to/file
API Usage
from secure_file_check.validator import validate_file
result = validate_file("path/to/file.docx")
print(result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secure_file_check-0.1.0.tar.gz.
File metadata
- Download URL: secure_file_check-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca609e387c5917d58beb0afbd47a06a2b70afda11bebcc2909d59e7b6bf254f5
|
|
| MD5 |
ded6bbce9e38cc311b2e61000cc6e485
|
|
| BLAKE2b-256 |
dbd3d55e147f032ebc3fcd93a6072c6669cec659b71e01410be725fc062f3231
|
File details
Details for the file secure_file_check-0.1.0-py3-none-any.whl.
File metadata
- Download URL: secure_file_check-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
861ddf50f6b5cfab332d081d5f343f88e0b4336f812afb47df29efca542f9e0a
|
|
| MD5 |
75c11ca9798a20207e2f3c8d12e3ad22
|
|
| BLAKE2b-256 |
4864c47d7dc5501d8a9a52cb37063d60bfb1fefa2c5cc17360a145e453108278
|