What does the image check actually establish?
Someone shares a drawing or an image library with you. Before importing it, you want to know whether its assets are present and what the application will do with their bytes. Those are different questions. A complete drawing can still contain an image that needs careful handling.
Where this question started
In April 2022, Excalidraw maintainer dwelle opened an issue for image support in libraries. The checklist included investigating sanitization. That December, I asked whether this meant guarding against malicious image content; dwelle confirmed it did. Packaging and persistence across browsers, exports and host apps were also part of the discussion.
I opened a pull request for the feature in December 2022. By February 2023, I was describing an experiment in that thread: storing files, including images, in restic with Excalidraw as the front end. The connection between drawings, stored files and the software that interprets them was already there.
That history motivates this lesson’s question: what evidence do we need before letting another application process a shared image? The Rails case below gives us a concrete failure to investigate. It is a separate case, not evidence of an Excalidraw vulnerability.
Start with the Rails/MATLAB evidence
In the Rails/MATLAB investigation, an upload declared image/png reached
libvips’ MATLAB loader. That loader and matio interpreted different parts of
the same header differently. The resulting HDF5 read returned bytes from a
test-owned dummy file through a Rails image variant.
We start with the same canary bytes, regenerated by that investigation’s
craft_mat_canary.py. Their SHA-256 matches both retained MATLAB runs:
f1c62ebc5fb7ab50655d505f3c30498713cdef232d3bdef585935024bd007fcc.
Renaming the file rails-canary.png changes neither its bytes nor that identity.
One file, two questions
What claims do its bytes make? The checker implements the existing
CraftedMatFile header predicates. The leading text selects libvips’ matload,
while the version and endian bytes select matio’s MAT 7.3/HDF5 reader. It reports
that disagreement even when the filename is canary.mat. A second, weaker
check notices that a file named .png lacks the PNG signature.
What happened when Rails processed it? That requires execution evidence. The original investigation retained these four outcomes:
| Input | Untrusted loaders | Retained outcome |
|---|---|---|
| MATLAB canary | Allowed | Variant returned the dummy file’s bytes; trace recorded the file open |
| Same MATLAB canary | Blocked | Loader refused; no dummy file open |
| PNG control | Allowed | PNG variant succeeded; no dummy file open |
| Same PNG control | Blocked | PNG variant succeeded; no dummy file open |
The observations, source hashes, configuration identity and syscall traces live
in the CIT-294 investigation.
Its Reconcile.pkl and cit294.test.pkl check those retained observations.
Running today’s image checker does not rerun Rails or establish that a
private file was read. The header finding is a reason to inspect loader policy.
This is why the control is to block untrusted loaders. Adding another file-type opinion does not resolve the disagreement between downstream readers.
Extend the investigation to a local image folder
The panel below is generated by executing the checker. It includes the original canary, a freshly encoded 2×2 black PNG control, an SVG with active-content patterns, an actual upstream Excalidraw export and a scene with a missing asset. The fresh PNG is a local checker control; it is not presented as the exact historical Rails PNG input.
The SVG check reports common script, event-handler and remote-reference patterns. It is not an XML sanitizer and can miss other active content. The Excalidraw check reads both legacy JSON and compressed scene metadata, then reports referenced assets absent from its file map. An undecodable scene is reported as an incomplete check. Present assets are not decoded or validated.
This separates two concerns from the library discussion: keeping the assets together and handling their contents safely. Finding a missing asset helps with the first. Neither that check nor the SVG pattern scan resolves the sanitization question raised in the original issue.
Scene coordinates cannot be compared directly to PNG dimensions: exports have their own scale, origin and padding. This checker makes no claim that the embedded scene visually matches the rendered pixels.
A matching signature does not prove an image is valid. No finding means only that these particular checks found nothing. It is not permission to trust or share a file without further review.
Run it on your files
From the repository’s tutorial-app directory:
npm cinpm run image-claims -- /path/to/downloaded-image.png /path/to/drawing.svgThe command reads local bytes without rendering the files. Exit status is
0 for no findings, 1 for findings, and 2 for a usage or read error.
For the lesson’s examples and reproducibility check:
npm run image-claims -- src/stories/fixtures/image-claims/rails-canary.png src/stories/fixtures/image-claims/control.pngnpm run image-claims:checknpm run image-claims:renderThe first command should report the canary and exit 1. The second runs the
regressions and checks the displayed panel against a fresh execution; the third
regenerates it after an intentional change.
Where Proton Drive fits
For an encrypted folder, these checks can run locally before upload or after files are downloaded. The command above accepts those downloaded paths. Encryption protects a different boundary from the one explored here: the application processing the downloaded bytes still needs an appropriate loader policy. The intended workflow is to download, inspect locally, review the findings, and then decide which application should open the file.
This lesson demonstrates the local check; it does not perform a Proton Drive login, download, upload, or automatic sharing decision. Preserving the original bytes and the checker output lets a later investigation ask what was checked, with which version, and what still needs evidence—just as the Rails case does.
One live round trip is recorded in
test/protondrive/fixtures/image-claims-20261016T050720Z:
the three files were uploaded with Proton Drive CLI 0.9.0, downloaded again,
and had identical SHA-256 hashes on both sides. Running the checker on the
downloaded bytes reported the same two canary findings and nothing for the
Excalidraw export or the PNG control.