Skip to content

fix: Fix path traversal on attachment - #3013

Open
FabianDevel wants to merge 6 commits into
mainfrom
fix-path-traversal-on-attachment
Open

fix: Fix path traversal on attachment#3013
FabianDevel wants to merge 6 commits into
mainfrom
fix-path-traversal-on-attachment

Conversation

@FabianDevel

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings August 4, 2026 11:25
@FabianDevel FabianDevel added enhancement Improve or expand upon an existing feature security Related to security issues labels Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens attachment handling against path traversal and unsafe filenames.

Changes:

  • Adds filename sanitization and path-containment utilities with tests.
  • Applies safe names across storage, downloads, uploads, headers, and UI.
  • Propagates nullable cache paths to callers.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
FileNameUtils.kt Adds sanitization and containment helpers.
FileNameUtilsTest.kt Tests filename and path security.
LocalStorageUtils.kt Secures cache and upload paths.
AttachableExtensions.kt Adds safe attachment names and cache paths.
AttachmentExt.kt Handles nullable cache files and safe labels.
NewMessageViewModel.kt Sanitizes imported attachment names.
MainViewModel.kt Sanitizes download filenames.
MessageWebViewClient.kt Handles rejected cache paths.
AttachmentDetailsView.kt Displays sanitized names.
AttachmentAdapter.kt Uses sanitized accessibility labels.
ApiRepository.kt Sanitizes attachment filename headers.

Comment thread app/src/main/java/com/infomaniak/mail/utils/FileNameUtils.kt Outdated
Comment thread app/src/main/java/com/infomaniak/mail/utils/FileNameUtils.kt
Comment thread app/src/test/java/com/infomaniak/mail/utils/FileNameUtilsTest.kt Outdated
Comment thread app/src/main/java/com/infomaniak/mail/utils/FileNameUtils.kt Outdated
@FabianDevel
FabianDevel force-pushed the fix-path-traversal-on-attachment branch from fddd5b8 to 60cb8c8 Compare August 4, 2026 12:34
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve or expand upon an existing feature security Related to security issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants