Third-party requests
A page served from example.com can name files that live on other hosts: a web font, a stylesheet, a script, an image, a video player in a frame. The server of example.com sends only the HTML. Each named file is then fetched by the visitor's browser, which opens its own connection to the other host. These are third-party requests. The company that runs each host receives them straight from the visitor's browser, and a script fetched this way runs with the same rights as the page's own code.
What one request reveals
A connection cannot be made without the visitor's IP address, so the other host always learns it. European data protection law names IP addresses among the online identifiers that devices and protocols hand out, and notes that such traces, joined with other data a server receives, can be used to build profiles of people.1
The request headers add more. User-Agent names the browser, the operating system and their versions.2 Referer carries the address of the page that asked for the file, which tells the other host on which site, and possibly on which page, its file was used.3 Since a change to the specification in November 2020, browsers that receive no policy use strict-origin-when-cross-origin: a request to another site over HTTPS carries only the origin, such as https://example.com, without the path or query string.4 A site that sets unsafe-url sends the origin, path and query string with every request, so tokens and email addresses placed in page addresses reach every host the page loads files from. Fonts and images that an external stylesheet loads use the default policy, not the page's, unless the stylesheet's own response carries a Referrer-Policy header.4
The Munich font ruling
On 20 January 2022 the Regional Court of Munich I ruled on a website that loaded its fonts from Google's font service. Each visit sent the visitor's IP address to Google.5 The court held that this address is personal data for the site's operator, because the operator has, in the abstract, legal means to have the person identified through the authorities and the internet provider; whether the operator or Google could link the address to the claimant in practice did not matter. The claimant had not consented. The court rejected a legitimate interest because the same fonts can be used without the browser connecting to a Google server, and it held that a visitor has no duty to hide their IP address first.5
The operator was ordered to stop, under a fine of up to 250,000 euros for each breach, and to pay the claimant 100 euros. Moving the fonts onto its own server after the visits did not end the case, since past breaches were taken to show a risk of repetition.5
A wave of warning letters to site owners followed. In December 2022 Berlin prosecutors searched the office of a lawyer under investigation in 2,418 cases of commercial fraud and extortion. Software written for the purpose had found sites that embedded the fonts, and the letters offered to settle for 170 euros each. The case against him was that no person had visited the sites, only the software. The 346,000 euros the letters brought in were frozen by attachment orders.6
Scripts from another host
A script tag that points at another host hands that host the page: whoever controls the host decides, request by request, what code each visitor receives. The Polyfill.io script, meant to patch older browsers, was embedded through cdn.polyfill.io on more than 100,000 sites. In February 2024 a company bought the domain and the project's GitHub account, and the domain was later caught injecting malware into those sites for visitors on mobile devices.7 The code was built per request from the HTTP headers; one sample sent mobile users to a betting site through a lookalike analytics domain, ran only on chosen devices at chosen hours, and stayed quiet when it saw an administrator.7 On 27 June 2024 Cloudflare began rewriting the address to its own copy, and the registrar then put the domain on hold.7
Subresource Integrity pins a third-party script to a known hash, and Software supply chain compromise covers the wider pattern. Analytics and advertising tags are a separate case with consent rules of their own: see Trackers before consent and GDPR for application builders.
Serving files from the site itself
The direct fix is to copy fonts, scripts and images into the site and serve them from its own domain. Shared hosts were once said to be faster, because a popular file might already sit in the browser's cache from another site. Chrome 86 ended that by keying its HTTP cache on the top-level site as well as the file's address. A font cached on one site is downloaded again on the next, and Chrome expected hosts of widely shared fonts and scripts to see more traffic.8
Next.js does this for fonts with next/font. For Google Fonts it downloads the CSS and font files at build time and serves them with the site's other static files, so the browser sends no request to Google.9
// app/layout.tsx
import { Inter } from 'next/font/google'
const inter = Inter({
subsets: ['latin'],
display: 'swap',
})A Content Security Policy turns the choice into a rule the browser enforces. With default-src 'self', the browser loads resources only from the page's own origin unless a more specific directive, such as img-src, lists another host. Sent as Content-Security-Policy-Report-Only, the same policy blocks nothing and reports each violation, which gives a list of the hosts a page still calls.10 A Referrer-Policy header, or a meta element named referrer, limits what the remaining requests carry.4
In SecFlash
SecFlash reports a page that makes visitors' browsers send their IP address to a host outside the EU as SF-SEC-504, a script from another company that was not there before as SF-SEC-401, and one loaded on a login or payment page as SF-SEC-402, all on the Security page. A missing Referrer-Policy is SF-SEC-107. Third-party code that holds up loading is SF-SPD-129 on the Speed page.
See also
- Content Security Policy
- Subresource Integrity
- Trackers before consent
- GDPR for application builders
- Personal data in URLs
- Software supply chain compromise
- Category: Data exposure
References
- back European Union (2016). "Recital 30: Online identifiers for profiling and identification". General Data Protection Regulation, gdpr-info.eu.
- back MDN contributors. "User-Agent header". MDN Web Docs.
- back MDN contributors. "Referer header". MDN Web Docs.
- a b c MDN contributors. "Referrer-Policy header". MDN Web Docs.
- a b c Landgericht München I (20 January 2022). "Urteil 3 O 17493/20" (GRUR-RS 2022, 612). gesetze-bayern.de.
- back Redaktion beck-aktuell (22 December 2022). "Google Fonts: Razzia bei Berliner Abmahnanwalt". beck-aktuell.
- a b c Sansec Forensics Team (25 June 2024, updated to 28 June). "Polyfill supply chain attack hits 100K+ sites". Sansec.
- back Chrome for Developers (6 October 2020). "Gaining security and privacy by partitioning the cache". developer.chrome.com.
- back Vercel. "Font Module". Next.js documentation.
- back MDN contributors. "Content Security Policy (CSP)". MDN Web Docs.