Skip to content

Security: sumedhmhatre01/Universal_File_Converter

Security

security.md

πŸ”’ Security

Universal File Converter

This document describes the security features and best practices implemented in the Universal File Converter project.


Security Overview

The Universal File Converter has been designed with secure file handling, input validation, and modular architecture to provide a safe and reliable file conversion experience.


Implemented Security Features

1. File Type Validation

Only supported file types are accepted for processing.

Supported formats include:

  • PDF
  • DOCX
  • TXT
  • JPG
  • JPEG
  • PNG
  • BMP
  • WEBP
  • TIFF
  • CSV
  • XLSX
  • JSON
  • XML

Unsupported file types are rejected before processing begins.


2. Input Validation

Every conversion request is validated before processing.

Validation includes:

  • Supported input format
  • Supported output format
  • Valid conversion path
  • Existing input file

Example:

  • PDF β†’ DOCX βœ…
  • PDF β†’ PNG ❌

3. Filename Sanitization

Uploaded filenames are sanitized before saving.

The application removes invalid filename characters to prevent filesystem errors and unsafe filenames.

Example:

my:file?.pdf

becomes

my_file_.pdf

4. Unique Filename Generation

If an output filename already exists, the application automatically generates a unique filename.

Example:

report.pdf
report_1.pdf
report_2.pdf

This prevents accidental overwriting of existing files.


5. Password-Protected PDF Detection

The application detects encrypted PDF files before conversion.

Password-protected PDFs are not processed.

Users receive an informative error message instead of an application failure.


6. PDF Merge Validation

The application validates every uploaded PDF before merging.

Validation includes:

  • Minimum of two PDF files
  • PDF format verification
  • Existing file validation
  • Password-protected PDF detection
  • Safe sequential page merging

If validation fails, the merge operation is stopped and a user-friendly error message is displayed.


7. Exception Handling

All converters implement exception handling.

Common errors handled include:

  • Corrupted files
  • Unsupported formats
  • Read errors
  • Write errors
  • Conversion failures
  • Invalid PDF merge requests

The application displays user-friendly error messages instead of crashing.


8. Temporary File Storage

Uploaded files are processed inside a dedicated temporary directory.

Benefits include:

  • Separation from application files
  • Easier cleanup
  • Reduced risk of modifying original files

9. Automatic Cleanup

Old temporary and output files are automatically removed after the configured retention period.

Benefits:

  • Reduced disk usage
  • Better privacy
  • Cleaner application environment

10. Manual Cleanup

Users can manually clear generated output files using the application interface.

This helps maintain a clean working directory.


11. Output Isolation

Converted files are saved separately from uploaded files.

Original files remain unchanged throughout the conversion process.

Merged PDF files are created as new output files without modifying the original uploaded PDFs.


12. Modular Converter Design

Each converter only processes the formats it supports.

Converters include:

  • Image Converter
  • PDF Converter
  • PDF Merge Converter
  • Document Converter
  • Spreadsheet Converter
  • Data Converter

This minimizes unexpected processing behavior and keeps responsibilities isolated.


13. No Shell Command Execution

The application never executes shell commands using user-provided input.

No use of:

  • Command Prompt
  • PowerShell
  • Bash
  • Shell execution from uploaded filenames

This significantly reduces the risk of command injection.


14. Local File Processing

All conversions are performed locally within the application.

Files are not uploaded to third-party services or external APIs during conversion or PDF merging.


15. Session Isolation

Each Streamlit session maintains its own application state.

User sessions are isolated from one another during normal application use.


Security Best Practices

The project follows several software engineering best practices:

  • Input validation
  • Output validation
  • Exception handling
  • Modular architecture
  • Separation of concerns
  • Safe file handling
  • Temporary storage
  • Automatic cleanup
  • Filename sanitization
  • Password-protected PDF detection
  • PDF merge validation
  • Reusable utility functions
  • Object-oriented design

Current Security Level

Feature Status
File Type Validation βœ…
Input Validation βœ…
Filename Sanitization βœ…
Unique Filename Generation βœ…
Password-Protected PDF Detection βœ…
PDF Merge Validation βœ…
Exception Handling βœ…
Temporary Storage βœ…
Automatic Cleanup βœ…
Manual Cleanup βœ…
Output Isolation βœ…
Modular Architecture βœ…
No Shell Command Execution βœ…
Local Processing βœ…
Session Isolation βœ…

Planned Security Improvements

Future versions may include:

  • MIME type verification
  • Maximum upload file size limits
  • Automatic deletion immediately after download
  • Malware scanning integration
  • Secure random filenames
  • User authentication
  • Audit logging
  • Rate limiting
  • Cloud storage encryption
  • Digital signature verification
  • PDF splitting
  • PDF compression
  • PDF rotation
  • PDF page extraction

Deployment Security

When deployed using Render:

  • HTTPS encryption is provided by the hosting platform.
  • Files are processed on the server's temporary filesystem.
  • Uploaded and converted files are not intended for long-term storage.
  • Temporary files are automatically removed during cleanup.
  • Merged PDF files are generated on the server and stored only in the configured output directory.

Disclaimer

This project is intended for educational, portfolio, and general-purpose file conversion use.

Users should avoid uploading confidential or highly sensitive documents to any publicly deployed instance unless they fully trust the hosting environment and understand its security characteristics.


Version

Version: 1.1.0

Last Updated: 17 July 2026

There aren't any published security advisories