← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · ✎ updated 7d
← Back to glossary

Encryption in Transit

Cryptography Intermediate
debt(d7/e5/b5/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). Tools listed — semgrep, ssllabs, owasp-zap — are specialist scanners that can catch some cases (e.g. CURLOPT_SSL_VERIFYPEER false, HTTP URLs in code), but internal service calls to MySQL, Redis, or message queues without TLS are often invisible without network-level inspection or careful code review. The gap between the external HTTPS surface and internal unencrypted connections is not caught by default linters, pushing this to d7.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix says to enforce HTTPS for all traffic AND between all internal services, verify CURLOPT_SSL_VERIFYPEER, and add mTLS for service-to-service communication. Common mistakes span MySQL connections, cURL calls, internal microservice HTTP, and HSTS headers — these touch multiple configuration files, connection setup code, infrastructure config, and deployment settings. Not a single-line patch, but not a full architectural rewrite either.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Encryption in transit applies to web, API, and CLI contexts. Every new service connection, DB connection, queue consumer, and cURL call must be reviewed for TLS compliance. It doesn't rewrite-or-live-with-it, but it is a persistent cross-cutting concern that slows down every new integration point and requires ongoing vigilance across the codebase and infrastructure.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap — contradicts how a similar concept works elsewhere' (t7). The misconception is canonically stated: developers assume HTTPS means all traffic is encrypted, but it only covers the browser-to-server leg. Database connections, internal service calls, and message queue connections are frequently unencrypted despite HTTPS being present. This directly contradicts the reasonable mental model that 'my app is secure because it uses HTTPS,' making it a serious, well-documented trap.

About DEBT scoring →

Also Known As

TLS Encryption Data in Transit Encryption Transport Layer Encryption

TL;DR

Encrypting data moving between systems using TLS — protecting against interception, tampering, and man-in-the-middle attacks on all network communication.

Explanation

Encryption in transit uses TLS (Transport Layer Security) to protect data between: browsers and web servers (HTTPS), services communicating internally (mTLS), application servers and databases, and message queues. HTTPS alone is insufficient if internal traffic is unencrypted — an attacker who compromises an internal network segment can intercept database credentials. Mutual TLS (mTLS) requires both parties to present certificates, eliminating the need for credentials in service-to-service communication.

Common Misconception

✗ HTTPS means all traffic is encrypted — HTTPS encrypts the browser-to-server leg; database connections, internal service calls, and message queue connections are often unencrypted unless explicitly configured.

Why It Matters

A PHP application using HTTPS but connecting to MySQL over an unencrypted connection leaks database credentials and query results to anyone on the same network segment.

Common Mistakes

  • MySQL connection without SSL — credentials and all data in plaintext on the network.
  • CURLOPT_SSL_VERIFYPEER = false — disables certificate verification, enabling MITM.
  • Internal microservice communication over plain HTTP — encrypted external, unencrypted internal.
  • Not using HSTS — allows the first request to be downgraded from HTTPS to HTTP.

Avoid When

  • Local inter-process communication on the same machine where network eavesdropping is not a threat — overhead exceeds risk.
  • Encrypting data already encrypted at the application layer (e.g., encrypted database fields sent over TLS) — redundant and complicates key management.
  • Short-lived, non-sensitive metadata or heartbeat messages on fully isolated networks where network access is physically restricted and authenticated.
  • Real-time telemetry or log streams where encryption latency degrades monitoring effectiveness and data sensitivity is low.

When To Use

  • Any data crossing a network boundary—between client and server, service and service, or application and database—must use TLS to prevent credential theft and data leakage on untrusted or shared networks.
  • Internal service-to-service communication in microservices architectures should use mTLS to eliminate the need for shared secrets and enforce cryptographic identity verification without relying on network segmentation alone.
  • APIs handling sensitive data (PII, tokens, payment info) must enforce HTTPS with valid certificates; accepting unencrypted HTTP endpoints creates trivial interception paths for attackers on the same network.
  • Message brokers and queue systems transmitting authentication tokens or business-critical data require TLS to prevent replay attacks and credential compromise during transit between producers and consumers.

Code Examples

✗ Vulnerable
// Unverified TLS — MITM possible:
$ch = curl_init('https://payment-api.internal');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Never!

// MySQL without SSL:
$pdo = new PDO('mysql:host=db.internal', 'user', 'pass');
// Credentials and queries in plaintext
✓ Fixed
// Verified TLS:
$ch = curl_init('https://payment-api.internal');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);    // Default — keep it
curl_setopt($ch, CURLOPT_CAINFO, '/etc/ssl/certs/ca-certificates.crt');

// MySQL with TLS:
$pdo = new PDO(
    'mysql:host=db.internal;ssl_ca=/etc/ssl/mysql-ca.pem',
    'user', 'pass',
    [PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true]
);

// mTLS with client certificate:
curl_setopt($ch, CURLOPT_SSLCERT, '/certs/client.crt');
curl_setopt($ch, CURLOPT_SSLKEY,  '/certs/client.key');

Added 16 Mar 2026
Edited 20 Sep 2026
Views 207
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings F 1 ping S 1 ping S 0 pings M 0 pings T 1 ping W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 2 pings T 0 pings W 0 pings T 1 ping F 0 pings S 1 ping S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 2 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S
No pings yet today
No pings yesterday
PetalBot 22 Amazonbot 18 Perplexity 17 SEMrush 14 Ahrefs 11 ChatGPT 7 Google 7 Scrapy 6 Claude 4 Bing 4 Majestic 3 Brave Search 3 Baidu 3 Unknown AI 2 Twitter/X 2 Applebot 2 Meta AI 1
crawler 122 crawler_json 4
🧱 FUNDAMENTALS — new to this? Start with the ground floor.
Encryption general Encryption is the process of converting readable data into scrambled, unreadable text that can only be decoded with the correct key.

Encryption is the foundation of online security—it protects passwords, payment info, and private messages from being stolen or read by attackers, no matter your skill level.

💡 Always use established encryption functions (like openssl_encrypt) with strong algorithms—never try to invent your own encryption method.

Ask Codex about Encryption →
⚡ DEV INTEL Tools & Severity
🔴 Critical ⚙ Fix effort: Medium
⚡ Quick Fix
Enforce HTTPS for all traffic and between all internal services — use mTLS for service-to-service communication and verify CURLOPT_SSL_VERIFYPEER is never disabled in PHP
📦 Applies To
any web api cli
🔗 Prerequisites
🔍 Detection Hints
HTTP instead of HTTPS internal service calls; CURLOPT_SSL_VERIFYPEER false; PHP talking to Redis without TLS in production
Auto-detectable: ✓ Yes semgrep ssllabs owasp-zap
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Low ✓ Auto-fixable Fix: Low Context: File
CWE-319 CWE-311


✓ schema.org compliant