How to check whether a web tool uploads your file (DevTools + a fetch/XHR hook)
Lots of web tools say "your file never leaves your browser". You don't have to take their word for it: it takes a few minutes to check from the outside. Below is the method we use, from the quick DevTools check to a small page-side hook that records request body sizes, plus the case where an automated network log reported 0 bytes for a request that carried the whole file . Disclosure: I build…
To determine if a web tool uploads your file, follow these steps:
1. Use a test file: Create a blank image or short text file that cannot be compressed. For example, a 400x300 random-noise PNG with about 360 KB size. This ensures the request carrying the file is at least as large as the file itself.
2. Quick check using DevTools:
- Open DevTools (F12) and go to the Network tab.
- Preserve the log so the list remains while you interact with the page.
- Filter the filter box to show only GET requests (POST, PUT, etc.).
- Perform the actions on the page as a normal user would (convert, upload, download).
- Click each remaining request and check the Payload tab for (binary) or a form field, and the Content-Length request header.
- Note the request size, which should be about the same as the file size (a little more for form boundaries and headers).
Things to watch out for:
- The Size column shows the response, not what was sent.
- Some sites send the file immediately upon selection, while others only when you press Convert.
- Check both moments.
- Some sites send a resized copy or thumbnail.
- Look at POST bodies smaller than the file size as well.
Offline check:
- Load the page and set the Network throttling dropdown to Offline.
- If the conversion still works, the network was not required for the upload.
- If it fails, the upload likely required network communication.
3. Addressing network logs:
- Automated network logs can sometimes miss uploads. For example, a POST with a 1,243,445-byte photo was logged with a request body size of 0.
- To account for this, use a page-side hook that logs the size of the request body for fetch(), XHR, and sendBeacon functions.
- Wrap the functions the page uses to send data, before the page uses them, and log the size of each body.
- Compare the network log size with the page-side hook size. Use the larger value to determine if an upload occurred.
By following these steps, you can verify whether a web tool uploads your file or not without relying solely on the tool's claims.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to