Skip to content

#3345 Harden sanitized attachment file names - #3346

Merged
DenBond7 merged 1 commit into
masterfrom
issue-3345-sanitize-forwarded-attachment-names
Nov 18, 2026
Merged

DenBond7 merged 1 commit into
masterfrom
issue-3345-sanitize-forwarded-attachment-names

Conversation

@martgil

@martgil martgil commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

This PR prevents sanitized attachment names from resolving outside their cache directory.

close #3345


Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities

sanitizeFileName() returned '..', '.', empty and control-character names
that file-path sinks pass to File(directory, name). Return a safe fallback
and route attachment cache writes through getFileInsideDir so canonical
containment also holds for symlinks.
@martgil
martgil force-pushed the issue-3345-sanitize-forwarded-attachment-names branch from 6dbc0eb to 5446a41 Compare November 18, 2026 06:15
@martgil

martgil commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @DenBond7 and @sosnovsky - This one is ready for a review. Thanks!

@DenBond7 DenBond7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@DenBond7
DenBond7 merged commit a26ce77 into master Nov 18, 2026
8 checks passed
@DenBond7
DenBond7 deleted the issue-3345-sanitize-forwarded-attachment-names branch November 18, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve validation of forwarded attachment file names

2 participants