Repository navigation
fix(attachments): on Linux, opened attachments are decrypted into XDG_RUNTIME_DIR, not onto disk - #43
Merged
Merged
Conversation
…_RUNTIME_DIR, not onto disk A received attachment opened with another app was decrypted into the profile folder (~/.local/share/.../anhaenge/.klar). Linux has no hook for closing the window, so the plaintext copy stayed on disk until the next app start (security assessment 2026-11-23, SEC-M2). On Linux the copies now go to $XDG_RUNTIME_DIR/bitdm-klar-<hash of the database path>: a tmpfs owned by the user (0700) that disappears at logout and reboot. Without that variable, and on Android and Windows, the old place stays (Android needs it for the FileProvider). Lock and wipe clean the new folder as before, and wipe now also removes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Addresses SEC-M2 from the external security assessment of 16–23 Nov 2026: "opened files remain as plaintext copies on Linux until next app start".
Confirmed
Opening a received attachment with another app decrypts it into
<app support>/anhaenge/.klar/(~/.local/share/com.bitdm.bitdm/...). Copies are removed on lock, dispose and the next start. Linux has no hook for closing the window (my_application.cchas no delete-event handler,AppState.disposeis never called), so after simply closing BitDM the plaintext stayed on disk until it was started again.Fix
$XDG_RUNTIME_DIR/bitdm-klar-<hash of the database path>. That is a tmpfs owned by the user (0700) and disappears at logout and reboot, so the plaintext never reaches the disk.XDG_RUNTIME_DIR), it falls back to the old place, so opening never fails because of it.files/anhaenge/for the FileProvider).anhaenge/.klar, for copies left by an older version, and wipe now removes the runtime folder too.Tests
test/core/klartext_ordner_test.dart: withXDG_RUNTIME_DIRthe folder is outside the profile; one folder per database, stable across starts; without a usable variable or outside Linux, the old place.test/net/anhang_end_to_end_test.dartnow checks that on Linux withXDG_RUNTIME_DIRthe copy lies there.Run in CT 107:
flutter analyzeshows only the 29 existing hints. WithXDG_RUNTIME_DIRset: both files green, and no file left in the runtime folder afterwards. Without it:anhang_end_to_end_test,test/anhang,test/core358 green. With an unusableXDG_RUNTIME_DIR(/proc/1) the app falls back as intended; the E2E check then fails, because it expects the runtime folder, which is a test-environment limitation.Not changed
delete-eventhandler).🤖 Generated with Claude Code