Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

Are you putting secrets in your URLs? A 5-minute check for AI-built apps

A magic sign-in link. A share link with a token in it. A download link with ?key= at the end. These are handy, and AI tools write them often. But anything you put in a URL gets copied into places you do not control: brow

A magic sign-in link. A share link with a token in it. A download link with ?key= at the end. These are handy, and AI tools write them often. But anything you put in a URL gets copied into places you do not control: browser history, server logs, analytics tools, and the Referer header sent to every other site the page loads something from.

If that value is a password, an API key, a session token or a long-lived access token, you have just handed it to all of them.

Who is at risk

Any app that passes secrets in the address: ?token=, ?api_key=, ?password=, ?access_token=, or an auth code that stays valid for days. Share links, email links, webhook URLs and embedded widgets are the usual places.

Where a URL secret ends up

  • Browser history and bookmarks, including on shared computers.
  • Server and CDN logs, which many people and tools can read.
  • Analytics and error tools, which often record the full page address.
  • The Referer header, sent to third-party scripts, images and links on the page, unless you set a referrer policy.
  • Screenshots, screen shares and pasted links in chat.

The 5-minute check (your own app only)

  1. Use your app with a test account and watch the address bar. Note any token, key, secret, auth or code parameter.
  2. Open dev tools, Network tab, and filter requests for the same words in the URL. Check API calls too, not only pages.
  3. On a page that has a token in its address, look at the third-party requests it makes. Click one and check the Referer header. If the full address is in it, the token is leaking.
  4. Check how long the token lives. Open the same link a day later, and after using it once. A sign-in link should be single use and short lived.
  5. Search your code for searchParams.get, req.query and ?token= to see where secrets are read from the URL.

Pass: no long-lived secret appears in any address, one-time links expire fast and stop working after one use, and your pages send a strict referrer policy.

What to fix

  • Send secrets in a header or a request body, not the URL.
  • Make one-time links single use and short lived (minutes, not days), and invalidate them once used.
  • Set Referrer-Policy: strict-origin-when-cross-origin or stricter on all pages.
  • Remove the token from the address after the page reads it, using history.replaceState.
  • Keep secrets out of logs and analytics by filtering query parameters.

A prompt you can paste into your AI builder

"Review every place a token, API key or password is passed in a URL query string. Move secrets to headers or request bodies. Make one-time links single use and expire in 15 minutes. Add a Referrer-Policy header of strict-origin-when-cross-origin, and strip token parameters from the address bar after reading them."

What a scanner can and cannot tell you

An outside scan of your public pages can see what a stranger sees, including the response headers on those pages. It does not sign in, so it cannot see the links your app creates for signed-in users. Check those yourself, as above.

I work on ProofForge. The free scan covers what a visitor can see and says plainly what it could not check.

Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.