Cloudflare R2 is a cheap place to keep uploads, and AI-built apps pick it a lot. The setup has a few moving parts, and a wrong choice can leave a bucket readable by anyone or give the browser far more power than it needs.
Where it goes wrong
- Public bucket by accident. R2 buckets can be exposed through a public domain or the r2.dev address. If you turned that on to see an image, every object in the bucket may now be listable by guessing names, and private files sit next to public ones.
- API token in the browser. R2 uses an access key id and a secret, the same shape as S3. If the secret reaches front-end code, anyone can read, write or delete objects, depending on the token's permissions.
- Token scope too wide. A token that covers all buckets with edit rights is a big prize. One bucket and the lowest needed permission is enough for most apps.
- Open CORS rules. A rule that allows every origin and every method lets any site make requests against your bucket from a visitor's browser.
What to check
- Search your built JavaScript. Open the live site, find the bundle files, and search for the R2 account id or an endpoint ending in r2.cloudflarestorage.com. Look at what sits next to it.
- Keep the secret on the server. The browser asks your backend for a short-lived signed upload or download link. The backend holds the access key.
- Use presigned links with a short expiry and a fixed object key and size limit.
- Review public access. In the dashboard, check whether the public domain or r2.dev address is on. Put public files in one bucket and private files in another.
- Narrow the token and the CORS rules. One bucket, the least permission, and only your own origins and methods.
- Rotate after a leak. Deleting the key from the code does not help once it was served. Create a new token and revoke the old one.
What an outside scan can tell you
I work on ProofForge. The free scan checks the public side of a URL you own or have permission to test: browser bundle, public files, headers and supported backend signals. It never signs in. It looks for private keys and tokens sitting in your JavaScript. It cannot see your bucket settings or token permissions, so that review is yours in the Cloudflare dashboard. A clean result means nothing was found in the public assets checked, not that the app is secure.

