AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
High 74 Monero

fix(desktop qr): scan Windows camera frames from the preview in memory

Public commit record

What the developer wrote

Authored by sneurlax

100/100 · Strong
fix(desktop qr): scan Windows camera frames from the preview in memory

camera_windows' takePicture() always saves a JPEG in the user's Pictures
folder. Deleting it afterwards still puts a QR code, which may hold a seed
or private key, on disk, where OneDrive sync, file recovery or the indexer
can pick it up. Show the live preview texture instead and capture it in
memory with RepaintBoundary.toImage(), at the camera's own resolution
capped at 1280 px. camera_windows mirrors its preview, so the capture is
flipped back before decoding. Drop the capture cleanup code and its test.

Errors are drawn over the preview rather than replacing it, so capture
keeps running and the error clears when frames come back. Blank frames
(nothing drawn yet, or a covered lens) are logged once and skipped with
the usual delay, and a spinner shows until the first frame arrives.

Tested on Windows 11 with a USB webcam under Impeller and Skia: preview
captures are 640x480, two QR codes (one about 260 characters) scan in the
add-node view, and nothing is written to Pictures.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a privacy/security bug in Stack Wallet's Windows QR scanner. Previously, every time the app scanned a QR code on Windows, it called the camera plugin's takePicture(), which permanently saved a JPEG of the QR code (which could contain a wallet seed or private key) to the user's Pictures folder. Even deleting the file afterward left a window where OneDrive, search indexing, file recovery tools, or other software could access it. The fix captures the live camera preview directly in memory, scans it without writing anything to disk, and adds tests for the new in-memory frame handling.

Recommended action

Treat this as a security fix and include it in the next release. Users on Windows should be advised that prior versions may have left QR-code JPEGs in their Pictures folder; they should review and clear that folder if they scanned sensitive QR codes. No immediate user action is required after updating.

Security signals we found

01

Sensitive data (QR codes containing seeds/private keys) was previously persisted to disk via camera_windows takePicture() JPEG writes

02

Prior deletion of the JPEG was best-effort and left residual exposure to sync, indexing, and recovery tools

03

Fix moves QR capture entirely to in-memory preview frames on Windows

04

Added blank-frame detection to avoid scanning empty or privacy-shutter-closed frames

05

Added tests covering mirror correction, buffer validation, and QR decode round-trip

Risk score

Why this scored 74/100

Our methodology →
Potential impact 25/30
Exploitability 15/25
Stealth signal 10/15
Affected reach 10/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.