<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SheMi</title>
    <description>The latest articles on DEV Community by SheMi (@shemi).</description>
    <link>https://dev.to/shemi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4267970%2F91fe593e-5482-416d-a4dd-edfe032c8dea.webp</url>
      <title>DEV Community: SheMi</title>
      <link>https://dev.to/shemi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shemi"/>
    <language>en</language>
    <item>
      <title>Building a no-photo-upload camera app in Flutter: sandbox storage, binary metadata stripping, and the encryption we removed</title>
      <dc:creator>SheMi</dc:creator>
      <pubDate>Mon, 30 Nov 2026 05:50:22 +0000</pubDate>
      <link>https://dev.to/shemi/building-a-no-photo-upload-camera-app-in-flutter-sandbox-storage-binary-metadata-stripping-and-4335</link>
      <guid>https://dev.to/shemi/building-a-no-photo-upload-camera-app-in-flutter-sandbox-storage-binary-metadata-stripping-and-4335</guid>
      <description>&lt;p&gt;Most "private photo vault" apps work the same way: the photo lands in the camera roll first, then gets copied into a vault. That first landing is the problem — the original sits in the library, syncs to iCloud, and shows up in &lt;code&gt;Recently Deleted&lt;/code&gt; for thirty days. Copying it somewhere else doesn't undo any of that.&lt;/p&gt;

&lt;p&gt;This post is about the other architecture, and the technical decisions behind it.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Capture straight into the sandbox
&lt;/h3&gt;

&lt;p&gt;The app never calls a "save to camera roll" API. Photos taken in-app are written to the application's private container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application Container/
  Library/Application Support/vault/photos/&amp;lt;fileId&amp;gt;.jpg
  Library/Application Support/vault/videos/&amp;lt;fileId&amp;gt;.mp4
  Library/Application Support/vault/thumbs/...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three consequences that matter more than they sound:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No photo-library permission needed for capture.&lt;/strong&gt; The camera writes to our own directory, so the app never asks for "All Photos" access. Import from the library is a separate, explicit flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Excluded from iCloud backup.&lt;/strong&gt; On iOS, the storage directory is marked with &lt;code&gt;URLResourceValues.isExcludedFromBackup = true&lt;/code&gt;. Without that flag, the app container is included in the device's iCloud backup by default — and your "never uploaded" claim would be false, because iCloud backup &lt;em&gt;is&lt;/em&gt; an upload.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No system index.&lt;/strong&gt; Files in the app container aren't indexed by the Photos framework; other apps with photo-library access can't enumerate them.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Metadata stripping at the byte level, not the re-encode level
&lt;/h3&gt;

&lt;p&gt;The naive way to strip EXIF is to decode and re-encode the image. That works, but it costs quality and CPU, and it's a silent second generation of lossy compression on every capture.&lt;/p&gt;

&lt;p&gt;Instead, the stripper operates on the JPEG byte stream directly: walk the marker segments, drop &lt;code&gt;APP1&lt;/code&gt; (EXIF), &lt;code&gt;APP13&lt;/code&gt; (Photoshop IRB / IPTC authorship and captions) and &lt;code&gt;COM&lt;/code&gt; (comment) blocks, keep everything else — including the compressed scan data — untouched. Zero re-encoding, zero quality loss.&lt;/p&gt;

&lt;p&gt;Two details that are easy to get wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep orientation.&lt;/strong&gt; EXIF orientation tells viewers how to rotate the image. Strip it blindly and portrait photos render sideways. We keep orientation (and capture time) by rewriting a minimal APP1 instead of dropping the block wholesale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not everything is a JPEG.&lt;/strong&gt; PNG goes through a chunk filter; HEIC/HEIF is decoded and re-encoded as JPEG first (a real re-encode — there's no cheap byte-level path), and formats that can't be processed safely fail closed rather than shipping metadata through.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stripping runs on capture, on import, and again on export — because the same file can leave through three different doors (camera roll, ZIP, LAN transfer) and only one of them being clean isn't a guarantee.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The passcode layer: PBKDF2, constant-time compare, and the Secure Enclave
&lt;/h3&gt;

&lt;p&gt;Passwords are hashed with PBKDF2 (per-install random salt, high iteration count) and verified with a constant-time comparison so timing can't leak prefix information. Biometric unlock delegates entirely to &lt;code&gt;LocalAuthentication&lt;/code&gt; — the app receives a boolean from the Secure Enclave and never touches biometric data.&lt;/p&gt;

&lt;p&gt;A second passcode opens a second album: two passcodes, two independent spaces, and the real vault is simply absent from the second view rather than locked behind it. The design goal is separation of spaces — not a lock with a sign on it.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The encryption we removed
&lt;/h3&gt;

&lt;p&gt;Early versions of the app had an AES-256-CBC pipeline with a device-held master key. It was removed, and I think the reasoning is worth more than the code was.&lt;/p&gt;

&lt;p&gt;The turning point was a pre-launch audit, which found the storage layer writing plain files to the sandbox — and pointed out the real problem: the product's own framing implied more protection than the storage actually carried. So we had two options: build the encryption properly, or change the words. We changed the words, because the honest threat model pointed the same way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The main threat for this product is &lt;strong&gt;the person holding your unlocked phone&lt;/strong&gt; — someone you just handed it to, or anyone who knows the passcode. File-level encryption with a key stored on the same device does nothing against that person: they open the app, they pass the lock screen, they see plaintext.&lt;/li&gt;
&lt;li&gt;The other threat — physical extraction of the device storage by an attacker with tools — is real, but iOS data protection (the device passcode deriving the file-system key) already covers most of it, and building our own crypto layer on top invites key-management bugs that are worse than the threat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the shipped claim is: sandbox isolation plus the device passcode; no file-level encryption; explicit about what it does not stop. It's a less impressive sentence and a more accurate one.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I'd do differently
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write the security claims after the security code ships&lt;/strong&gt;, not before. Our audit was the right move; doing it pre-launch rather than post-launch was the only reason it was a documentation problem instead of a trust incident.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the "what leaves this app" paths as a matrix.&lt;/strong&gt; Capture / import / export-to-roll / export-ZIP / LAN transfer — each path is independently capable of leaking metadata. We ended up with a fail-closed default plus a per-path test list; it should have been the design from day one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building anything that stores user media locally, the checklist is short: is the storage directory excluded from backup? Does every exit path strip metadata? Can the app enumerate its own files after a restore? Get those three right before optimizing anything else.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;SheMi: Private Photo Vault — &lt;a href="https://www.ruisstech.com/en/" rel="noopener noreferrer"&gt;https://www.ruisstech.com/en/&lt;/a&gt; (iOS, no account, no photo uploads)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>ios</category>
      <category>privacy</category>
      <category>security</category>
    </item>
  </channel>
</rss>
