URLs are not a place for secrets
There's a category of security issue that never feels like an incident because nothing dramatic happens. A token gets passed as a query parameter, everything works, everyone moves on. The problem only becomes visible when you list all the places a URL gets recorded.
Server access logs write the full request path by default, so every web server and application log line now contains the token. Browser history keeps it on every machine the user touched, including shared ones. The Referer header ships your full URL to any third-party domain the page loads a script or image from, which for an average page is a lot of domains. Proxies and corporate gateways log URLs. Monitoring and error-tracking tools capture them in breadcrumbs. And users copy-paste URLs into chats and bug reports without reading them, because why would they.
None of these systems is doing anything wrong. Logging URLs is normal, that's the point: a URL is treated as an address, not a secret, by every layer of the stack. Put a credential in one and you've distributed it to every layer that touches addresses.
I got sensitive to this while reading about how redirect-based auth flows are designed. The tidy-looking version puts the token in the query string. It works, the flow is short, and the token is doing nothing but travelling from one page to the next. It also means that token is now written into the access log of every hop that handled the request. "This is safe because nobody reads the logs" is a strange sentence to defend in a review, and it's the sentence that design quietly relies on.
The fixes are unglamorous. Tokens that authenticate requests belong in headers (Authorization: Bearer ...) or in httpOnly cookies, both of which stay out of URLs, history, and Referer. Data that changes state belongs in a request body over POST. And when a flow genuinely requires a token in a URL, which magic login links do, the mitigations are lifetime and disposability: make it single-use, expire it in minutes, and consume it immediately on arrival, exchanging it server-side for a session that lives in a cookie. Then the logged URL contains only a corpse.
One more that's easy to miss: strip the parameter after use. If your frontend lands on a URL with a token in it, replace the browser state (history.replaceState) once you've consumed it, so it doesn't linger in history and can't be re-triggered by a refresh.
The test I apply in reviews now is one question: if this exact URL appeared in a log file readable by the whole engineering team, would anything be compromised? If yes, the URL is carrying something it shouldn't.