Describe the bug: Attachment filenames used directly when saving to disk. Could contain path traversal characters like "../" or invalid filesystem chars.
To reproduce:
- Receive email with attachment named "../../evil.txt"
- Save attachment
- May write outside intended directory
Expected behavior: Sanitize filename:
- Strip path separators (/ )
- Remove invalid chars for current OS
- Limit length to filesystem max
- Handle collisions with (1), (2) suffix
Additional context:
- File: view/html.go or attachment handling code
- Use filepath.Base() and validate chars
- Severity: Medium - path traversal risk
- Complexity: Easy - filename sanitization
Describe the bug: Attachment filenames used directly when saving to disk. Could contain path traversal characters like "../" or invalid filesystem chars.
To reproduce:
Expected behavior: Sanitize filename:
Additional context: