Read, return, forget: processing passport scans without storing the image
Originally published at Read, return, forget: processing passport scans without storing the image A passport photo is the most sensitive file most apps ever receive. It carries a face, a full name, a date of birth and a document number, and it is enough to open an account somewhere else. Yet in many upload flows the picture is copied five or six times before anyone asks whether it needs to exist…
Processing passport scans without storing the image image has become a concern for many apps. The GDPR doesn't outright forbid storing a passport image, but it encourages data minimisation. This means keeping only what is necessary for the specific purpose, and no longer than needed. In practice, this can be achieved through a "read, return, forget" pattern.
Instead of copying the image multiple times, read the needed information (like name, date of birth and document number) from the image and immediately return the result. The image itself should not be stored anywhere. If storage is unavoidable, give the image a very short lifespan - minutes, for example, and delete it as soon as the request is completed.
Understand where passport images typically end up in your system. Common places include upload buckets, request logs, error reports, queues/retries, backups/snapshots, support tickets, and analytics/session replay. These are places you can control, so make sure not to store the image there. If you must use a vendor service for OCR or similar processing, ask them about their storage practices. Ensure the image is only in memory for the request and does not leave the request in any form.
Remember, the GDPR and upcoming anti-money-laundering law require you to be able to explain why you keep personal data. By following the "read, return, forget" pattern, you can demonstrate compliance by showing there were no unnecessary copies of the image to keep.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.