Encryption in transit
Encryption in transit protects data on its way across a network: from a browser to a web server, or from an application server to its database or another API. On the web the protection comes from Transport Layer Security (TLS), and HTTP carried over TLS is HTTPS.1 Others on the path cannot read a TLS connection (confidentiality) or change it without detection (integrity), and the client can confirm which server it reached (authentication).2
Why traffic needs it
Packets pass through many machines between sender and receiver. Whoever controls one of them, a router for example, can capture traffic meant for someone else and read the recording long after the transfer.3 An attacker in this position is a manipulator in the middle (MITM), and can both read and alter what passes.1 Over plain HTTP this exposes session cookies and lets the attacker insert JavaScript into the page.2
How TLS works
A TLS connection begins with a handshake. The client and server agree on a TLS version and a cipher suite, which names the algorithms for key agreement, authentication, encryption and message authentication. The server proves its identity, and both sides derive a shared secret key. Every later message, headers and body alike, is encrypted with that key.1
The server proves its identity with a certificate. The certificate holds the server's public key and the domain name, signed by a certificate authority (CA) that the browser trusts, which ties the key to the name.1 Let's Encrypt, a non-profit CA, issues certificates at no cost, and hosting services usually manage them for their customers.1
Versions and cipher suites
SSL 2 and SSL 3, the predecessors of TLS, have serious cryptographic weaknesses. RFC 8996 deprecated TLS 1.0 and 1.1 in March 2021, and mainstream browsers have dropped them. A sound server offers TLS 1.3 first, keeps TLS 1.2 for older clients, uses authenticated encryption suites (AES-GCM or ChaCha20-Poly1305) and drops any suite without forward secrecy.2 Vercel accepts only TLS 1.2 and 1.3 and only ciphers with forward secrecy.4 The libraries that implement TLS have their own bugs, Heartbleed the best known among them, and need security updates like any other dependency.2
Plain HTTP, redirects and HSTS
A public site may listen on plain HTTP and answer with a permanent redirect (301) to the HTTPS address, for visitors who type the domain by hand.2 Vercel's network sends a 308 redirect for every HTTP request and does not allow it to be turned off.4 The first request still travels unencrypted, and an attacker who intercepts it can keep the visitor on HTTP, which is called SSL stripping.1
The Strict-Transport-Security response header closes the gap for later visits. When a browser receives it over HTTPS, it stores the domain and, until max-age seconds have passed, rewrites every http:// address for it to https:// before sending anything. includeSubDomains extends the rule to subdomains. A first visit before the header was seen remains exposed, except for domains on the HSTS preload list that Chrome ships and Safari and Firefox derive their lists from. Preloading requires a max-age of at least 31536000 (one year) and includeSubDomains.51
Strict-Transport-Security: max-age=31536000; includeSubDomainsWith HSTS in force, the browser no longer lets users click past a certificate warning.2 The header's other details are in HTTP security headers.
An HTTPS page that loads a script, image or font over HTTP has mixed content; browsers upgrade such requests to HTTPS or block them.1 An active attacker can also lead the visitor to a fake HTTP page and collect cookies there, which is why every cookie needs the Secure attribute: the browser then never sends it over HTTP.2 A stolen session cookie leads to Session hijacking. An API has no visitors typing its address, so it can refuse plain HTTP outright and skip the redirect.2
Connections from the server
On connections from an application server to its database or to other APIs, the server is the client that must check the certificate. Postgres clients choose a behaviour with sslmode. The default, prefer, falls back to an unencrypted connection when the server does not offer TLS. require encrypts but accepts any certificate, so a MITM can present its own. verify-full checks both the CA and the host name.6
Supabase accepts unencrypted Postgres connections by default for compatibility, while its HTTP APIs always require TLS. The switch is Database Settings, SSL Configuration, Enforce SSL on incoming connections. For verify-full, the project's CA certificate is downloaded from the same section and the connection string ends in ?sslmode=verify-full.6
In Node.js, a TLS client verifies the server certificate unless the option rejectUnauthorized is set to false.7 Setting the environment variable NODE_TLS_REJECT_UNAUTHORIZED=0 turns verification off for the whole process, which the Node.js documentation says makes HTTPS insecure.8
Notable incidents
In 2011 attackers broke into the certificate authority DigiNotar and issued 531 fraudulent certificates. One, for *.google.com, was presented to internet users in Iran and became public on 29 August 2011. Checks of that certificate came from around 300,000 IP addresses, over 99% of them in Iran, which the investigators read as an attempt to intercept private communications there.9 Mozilla warned that users on a compromised network could be sent to the fake site and give away usernames and passwords, and shipped Firefox updates that removed trust in the DigiNotar root.10
Checking a site
The SSL Labs Server Test and Mozilla Observatory test a public site from a web page; testssl.sh and SSLyze run the same kind of test from the command line.2
Prompt for a coding agent
Check how this project uses encryption in transit. Find every http:// address in code and config that should be https://. Find any code or environment setting that turns off certificate checks, such as rejectUnauthorized: false, NODE_TLS_REJECT_UNAUTHORIZED=0 or sslmode=require, and change it to verify the certificate (for Postgres, sslmode=verify-full). Make sure every cookie the app sets has the Secure attribute and that responses send Strict-Transport-Security: max-age=31536000; includeSubDomains. List each file and line you changed.
In SecFlash
On the Security page, SecFlash reports a page not served over HTTPS as SF-SEC-201, a missing redirect from HTTP as SF-SEC-202, old protocols or weak ciphers as SF-SEC-203, an invalid or soon-expiring certificate as SF-SEC-204 and SF-SEC-205, mixed content as SF-SEC-206, and a missing or short HSTS header as SF-SEC-101 and SF-SEC-102. Code that switches off certificate checks is SF-SEC-708 or SF-SEC-786. On the Cloud page, SF-CLD-301, SF-CLD-302, SF-CLD-303 and SF-CLD-311 cover Cloudflare's SSL mode, HTTPS redirect, minimum TLS version and HSTS, and SF-CLD-528 a Supabase database that accepts connections without SSL. The Speed page reports requests made over plain HTTP as SF-SPD-301.
See also
- HTTP security headers
- Session hijacking
- Encryption at rest
- Session management
- Category: Security concepts
References
- a b c d e f g h MDN contributors (28 February 2026). "Transport Layer Security (TLS)". MDN Web Docs.
- a b c d e f g h i OWASP Foundation. "Transport Layer Security Cheat Sheet". OWASP Cheat Sheet Series.
- back "CWE-319: Cleartext Transmission of Sensitive Information". MITRE. Common Weakness Enumeration, version 5.0.
- a b Vercel. "Encryption". Vercel Docs.
- back "Strict-Transport-Security header". MDN Web Docs. Mozilla.
- a b Supabase (16 November 2026). "Postgres SSL Enforcement". Supabase Docs.
- back Node.js. "TLS (SSL)". Node.js documentation.
- back Node.js. "Command-line API". Node.js documentation.
- back Fox-IT (5 September 2011). "DigiNotar Certificate Authority breach: Operation Black Tulip" (interim report, filed with the SEC by VASCO Data Security). sec.gov.
- back Nightingale, Johnathan (29 August 2011). "Fraudulent *.google.com Certificate". Mozilla Security Blog.
External links
- SSL Server Test, Qualys SSL Labs
- HSTS Preload List Submission, hstspreload.org