Cloudinary in an AI-built app: the API secret and the open upload preset
Profile photos, product images and file attachments are easy to add to an AI-built app. Cloudinary is a common pick, and the code the AI writes often mixes two very different kinds of credential. Mixing them up is how a stranger ends up with write access to your media library.
Two things Cloudinary gives you
- Cloud name and unsigned upload preset. These are meant for the browser. A preset is a saved set of rules for uploads: folder, allowed formats, size limits.
- API key and API secret. The secret signs requests. It can upload, overwrite and delete anything in the account. It belongs on a server only.
The usual slip: the AI wants uploads to "just work", so it puts the API secret in a front-end file or in a variable that the build tool exposes to the browser. Anyone who opens the site can read it.
A second, quieter problem is an unsigned preset with no limits. If the preset allows any file type, any size and any folder, a visitor can use your account as free storage, or overwrite assets with the same name.
What to check
- Search your built JavaScript for the API secret. Open the live site, look through the bundle files, and search for the cloud name. See what sits next to it. Anything that looks like a secret should not be there.
- Check your env variable names. Variables with a public prefix in your framework are shipped to the browser. The secret must not use one.
- Tighten the upload preset. Set allowed formats, a maximum file size and a fixed folder. Turn off overwriting.
- Sign uploads on the server where you can. The browser asks your backend for a signature, then uploads. The secret never leaves the server.
- Rotate after a leak. Deleting the key from the code does not help once it was served. Regenerate the secret in the dashboard and update the server.
- Review what is public. Uploaded images are served from public URLs by default. If a file is private, use an authenticated or private delivery type.
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 how your Cloudinary preset is configured, so that check is yours to do in the dashboard. A clean result means nothing was found in the public assets checked, not that the app is secure.