DropLink operates in zero-trust local network environments, including:
- Public Wi-Fi hotspots (coffee shops, airports, hotel networks)
- Multi-tenant office Wi-Fi
- Direct ad-hoc Wi-Fi hotspots between mobile devices and laptops
Core Protections:
- Never send files in plaintext.
- Never trust remote metadata (always sanitize paths, filenames, and lengths).
- Never allow path traversal or filesystem escapes.
- Prevent Man-in-the-Middle (MITM) attacks without central Certificate Authorities.
- Guarantee file integrity via end-to-end cryptographic hashing (SHA-256).
- DropLink generates an ephemeral ECDSA P-256 self-signed certificate upon application launch.
- Keys are held in memory only and never stored in plain files.
- Forward secrecy is guaranteed: sessions cannot be retroactively decrypted even if an endpoint is compromised later.
Because local networks lack public CA certificates, DropLink uses Short Authentication Strings (SAS) derived via HKDF-SHA256:
- When two devices connect, they exchange their TLS certificate fingerprints.
- The fingerprints are sorted lexicographically:
$$\text{IKM} = \min(\text{FP}_A, \text{FP}_B) \parallel \text{":"} \parallel \max(\text{FP}_A, \text{FP}_B)$$ - HKDF-Extract and HKDF-Expand compute a 32-bit integer formatted into two 3-digit groups:
"482 917". - The user verifies this PIN matches on both devices before accepting the first transfer.
- An active MITM attacker altering either key will result in mismatched PINs, immediately alerting the user!
- When physical proximity allows, one device displays a QR code containing its connection string:
droplink://192.168.1.10:52520?name=MyPhone&fp=4F46E563... - The scanning peer compares the actual TLS certificate fingerprint during the handshake against the scanned fingerprint. Any mismatch terminates the connection immediately.
Untrusted filenames from peers undergo strict sanitization in droplink-core::security::sanitize_filename:
- Path separators (
/,\), null bytes (\0), and illegal characters (:,*,?,",<,>,|) are replaced with_. - Control characters (
0x00-0x1F,0x7F) are removed. - Consecutive dot sequences (
..,...,....) are collapsed and trimmed. - Leading and trailing dots or whitespace (which Windows filesystems reject) are stripped.
- Empty filenames default to
unnamed_file.
Windows kernels reserve specific legacy DOS device names that crash or freeze naive file writers if written to disk (e.g. CON, PRN, AUX, NUL, COM1-COM9, LPT1-LPT9).
DropLink detects these names (case-insensitive base stem) and automatically prefixes them with an underscore (e.g. CON.txt -> _CON.txt).
The destination path is resolved via resolve_safe_path:
- Any path component resolving to
Component::ParentDir(..) triggers an immediate bail error. - The resolved path is verified to strictly begin with the authorized download directory.
- Partial File Isolation: While data is being received, chunks are written to
{filename}.droplink_part. Other applications cannot mistake an in-progress transfer for a completed file. - Atomic Commit: Only after the full file is received and verified against its manifest SHA-256 hash is the file renamed to its final name.
- Sequential Auto-Rename: If
photo.jpgalready exists, DropLink inspectsphoto (1).jpg,photo (2).jpg, etc., avoiding silent overwrites while ensuring deterministic delivery.