Skip to content

fix(lock): locking clears the contact address, wipe code word and restore words fields - #45

Merged
Henner4746 merged 1 commit into
mainfrom
fix/sperre-vergisst-eingaben
Nov 30, 2026
Merged

Henner4746 merged 1 commit into
mainfrom
fix/sperre-vergisst-eingaben

Conversation

@Henner4746

Copy link
Copy Markdown
Owner

Addresses SEC-M5 from the external security assessment of 16–23 Nov 2026 ("app password and chat text remain in memory after lock"), as far as the app can.

What the code shows

On lock, AppState.sperreWieder already drops histories, contacts, groups, search results, previews and the fresh phrase; the core closes the database and zeroes the attachment and device-info keys; the UI clears search, PIN and both password fields. Not cleared were the add-contact field (addCtl), the remote-wipe code word field (codeCtl) and the restore screen's twelve words (phraseCtl). They stayed in their controllers, and on screen after unlocking.

Fix

_raeumeOberflaecheAuf (lock and wipe) now clears these three as well.

Limits (stated in the code)

  • Dart strings cannot be overwritten. Clearing drops the references; the old string objects stay in the heap until the garbage collector reuses the memory. A memory dump shortly after locking can still contain them. Nothing in Dart changes that.
  • The message draft (draftCtl) is kept on purpose, so an auto-lock after a minute's pause does not cost a half-written message. Whether a draft should be dropped on lock is a decision for Henrik.

Test

test/oberflaeche/sperre_oberflaeche_test.dart (SEC-M5): type an address into the add-contact field, lock with an app password, unlock, and the field is empty. At origin/main it fails ("die Eingabe ueberlebte das Sperren…"); on this branch it passes.

Run in CT 107: flutter analyze shows only the 29 existing hints; test/oberflaeche and test/lock: 369 green.

🤖 Generated with Claude Code

…tore words fields

On lock the UI cleared search, PIN and password fields but kept what was
typed into the add-contact field, the remote-wipe code word field and the
twelve words on the restore screen. They stayed in the controllers (and on
screen after unlocking) as long as the app ran (security assessment
2026-11-23, SEC-M5).

_raeumeOberflaecheAuf now clears these too. The message draft is kept on
purpose, so an auto-lock after a short pause does not cost a half-written
message. Dart strings cannot be overwritten; this only drops the references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@Henner4746
Henner4746 merged commit 6a60097 into main Nov 30, 2026
11 of 12 checks passed
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.

1 participant