Site AI AuditInternet Solutions ürünü

Sensitive Data in URLs: Tokens, Emails and Referrer Leaks

5 Kasım 20268 dk okumaGüvenlik ve SSL
Sensitive Data in URLs: Tokens, Emails and Referrer Leaks

Short answer: Web addresses are not private. They are saved in browser history, written to server logs, passed to other websites in the Referer header, picked up by analytics tools and copied into emails and chats. If a URL contains a password reset token, a session ID, an API key or personal details, all of those places become a possible leak. Put sensitive data in the body of a request, in a header or in a cookie, and make any token short-lived and single-use.

Where a URL ends up

When a visitor opens a page, the address travels further than most people realise. A single link can be stored in all of the following places, usually without anyone deciding it should be.

What should never be in a URL

  1. Passwords and secret keys. No form should place a password in an address, ever.
  2. Session identifiers. A session ID in a URL can be stolen by anyone who sees the address, as explained in the article on session hijacking and fixation.
  3. API keys. Keys passed as query parameters end up in logs. See the guide to exposed API keys.
  4. Long-lived access tokens. A token that opens an account for days or weeks is a key in a public place.
  5. Personal data. Email addresses, phone numbers, names and national identification numbers should not be in the path or the query string, because they spread to logs and analytics and create privacy duties.
  6. Details of private records. Order contents, medical information or financial amounts.

Here is a typical story. A small shop sends order status links of the form “view order, followed by the customer’s email address and order number”. A customer forwards the link to a friend to ask about a gift. The friend opens it, sees the full order and the address, and clicks on the shop’s link to a delivery partner, which then receives the address in the Referer header. Nobody did anything wrong on purpose, yet the personal data of one customer is now in four places. A secret token that can be used once, with a short life, would have prevented most of this.

Some links must carry a token

There are good reasons for secret links: password resets, email confirmation, invitations and one-time download links. In these cases, the URL has to contain something that proves the visitor owns the message. The answer is not to avoid tokens, but to make them safe to leak:

The Referer header problem

When a visitor lands on a page that has a token in its address and then clicks a link to another site, the browser may send the full address to that site in the Referer header. The same thing can happen when the page loads a third-party script, image or font. The owner of that other site can then see the token in their logs.

Modern browsers limit this by default, but the behaviour differs across browsers and versions, and some settings send more than you expect. Control it yourself with the Referrer-Policy header, described in the article on the Referrer-Policy header. A value such as strict-origin-when-cross-origin or no-referrer on sensitive pages stops the full address from being shared. Also avoid placing third-party scripts and trackers on pages that carry tokens in the address.

Better places for sensitive data

Limiting the damage of links that must carry data

  1. Redirect after the visit. When a visitor opens a confirmation or reset link, validate the token and then redirect to a clean address, so that the token does not stay in the address bar or in later referrers.
  2. Remove it on the page. A small script can replace the address with a clean one after the page loads, using the browser’s history interface.
  3. Add noindex and no-store. Tell search engines not to index token pages and tell caches not to store them. The article on Cache-Control for sensitive pages explains the headers.
  4. Reduce what logs keep. Configure your server to drop or mask query strings for sensitive paths, or remove tokens from logs after a short period.
  5. Strip parameters in analytics. Exclude known sensitive parameters from analytics reports and from tag-manager variables.

How to find problems on your site

Developers should also watch for debug and error pages. A page that prints the full request address when something fails will copy the token into screenshots, support tickets and error tracking tools. Check what your error tracker records, and configure it to filter out sensitive parameters before it sends reports. The same applies to browser extensions and session recording tools, which can capture whole pages and addresses unless you exclude the sensitive ones.

A note on marketing parameters

Tracking parameters such as campaign names are different from secrets, and they are generally harmless. Still, avoid putting email addresses into newsletter links, even for convenience. A link that includes the subscriber’s address spreads that address into every log and analytics tool the visitor passes through. Use an opaque identifier instead, and map it to the person on your own side. The article on URL parameters and SEO covers how parameters affect crawling.

How Site AI Audit helps

Site AI Audit does not inspect the flows behind your login or read your server logs, so it cannot find tokens in URLs. It checks the public side: your SSL certificate, the redirect from HTTP to HTTPS, security headers and exposed software versions, together with SEO, speed and email authentication. The free check covers up to 50 pages and needs no sign-up. You can run a free check of your website or see the plans for weekly monitoring and alerts.

Related reading

The bottom line

Treat every URL as public. Keep secrets, personal data and long-lived credentials out of addresses, send them in request bodies, headers and cookies instead, and make any unavoidable token short-lived and single-use. Add a strict referrer policy and clean up the address after the visit, and a leaked link will cause far less harm.

SSS

Is HTTPS enough to protect data in a URL?

No. HTTPS hides the path and query string from people on the network, but the address still lands in browser history, server logs, analytics and referrers.

Are password reset links unsafe?

They are acceptable if the token is random, short-lived and single-use, and if the page strips it afterwards and sets a strict referrer policy.

Should forms use POST instead of GET?

Use POST for anything that changes data or contains sensitive values. GET is fine for searches and filters that are safe to bookmark and share.

Can search engines index URLs with tokens?

Yes, if the address is linked somewhere crawlable. Use noindex and keep token pages out of public links and sitemaps.

How do I remove tokens from old logs?

Rotate and compress logs on a schedule, delete those you no longer need, and mask sensitive query strings in the log format going forward.

#Security headers#Web vulnerabilities#Website security
Kendi web sitenizi kontrol edin — ücretsiz.Web sitenizde neyi düzeltmeli — ve nereden başlamalısınız?
Ücretsiz başla

Blogdan daha fazlası

Tüm makaleler →
Internet Solutions

Ekibimizden diğer ürünler

Internet Solutions tarafından geliştirildi. Diğer ürünlerimizi de deneyin — her biri size farklı bir şekilde zaman kazandırır.

internet-solutions.net ↗