A secure and robust tool that renames Trade Republic PDF documents to a structured, machine-readable format:
yyyy_mm_dd_[TYPE]_[ISIN]_[ASSET].pdf
- Automated PDF Processing: Recursively processes all PDF files in a directory
- Intelligent Document Type Recognition: Supports various Trade Republic document types
- ISIN Validation: Validates and includes ISIN codes when available
- Security-Hardened: Input validation, path sanitization, and protection against common attack vectors
- Safe File Operations: Prevents directory traversal attacks and validates all file paths
- Comprehensive Error Handling: Graceful handling of malformed PDFs and edge cases
Kauf– Standard buy executionKauf_Sparplan– Savings-plan executionsKauf_Saveback– Saveback purchasesVerkauf– Sell transactions (if present in source PDF)Dividende– Dividend payouts (single or summary)Zinsen/Zinszahlung– Interest payouts (single or summary)Kapitalmaßnahme– Corporate actionsDepottransfer– Incoming depot transfersDepotauszug– Depot statements (falls back to assetDepot)Steuerliche_Optimierung– Tax optimisation noticesKosteninformation_Saveback– Cost information for saveback plansEx_Post_Kosteninformation– Ex-post cost statements (auto-detect year)Jahressteuerbescheinigung– Annual tax certificates (auto-detect year)Steuerreport– Steuerreport/Steuerübersicht (auto-detect year)Kontoauszug– Trade Republic cash account statements (IBAN-based asset)- Summary payout statements combining Zinsen/Dividende (handled automatically)
git clone https://github.com/ArdentEmpiricist/TR_PDF_Rename.git
cd TR_PDF_Rename
cargo build --release./target/release/tr_pdf_rename <path_to_folder>./target/release/tr_pdf_rename ~/Documents/TradeRepublic/This tool implements several security measures to ensure safe operation:
- File Size Limits: Rejects files larger than 100MB to prevent DoS attacks
- Path Validation: Ensures all operations stay within the target directory
- Character Sanitization: Removes dangerous characters from filenames
- Length Limits: Validates filename and path lengths
- Directory Traversal Protection: Prevents
../attacks through path canonicalization - Extension Validation: Validates file extensions to prevent malicious files
- ISIN Validation: Proper validation of ISIN codes using checksum verification
- Graceful Degradation: Continues processing other files if one fails
- Input Sanitization: Removes control characters and Unicode exploits
- Memory Safety: Uses
#![forbid(unsafe_code)]for guaranteed memory safety
Run the comprehensive test suite including security tests:
cargo testRun with verbose output:
cargo test -- --nocapture- Fork the repository
- Create a feature branch
- Implement your changes with tests
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.