Skip to content

#3364 Cap untrusted attachment sizes and stream copies - #3365

Draft
martgil wants to merge 3 commits into
masterfrom
issue-3364-improve-attachment-handling
Draft

martgil wants to merge 3 commits into
masterfrom
issue-3364-improve-attachment-handling

Conversation

@martgil

@martgil martgil commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

This PR caps attachment sizes with Long arithmetic and bounds stream copies from untrusted providers.

close #3364


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

Use Long arithmetic for attachment size checks, normalize invalid provider reports, and enforce a hard byte ceiling on every copy of a provider-supplied stream.
…ments

Track remaining bytes across the send-time cache loop so several attachments cannot each consume the full limit, and make the stream ceiling count skipped bytes.
@martgil
martgil marked this pull request as draft November 27, 2026 12:23
…bytes

Delete partial ciphertext on encryption failure, count plaintext bytes read against the cumulative budget, and cover stored-byte accounting with tests.
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 attachment handling from external intents

1 participant