Skip to content

Security: GDKsoftware/WebSocket4D

SECURITY.md

Security policy

This page explains how to report a vulnerability in WebSocket4D, which versions receive fixes, what the library protects against, and what your application has to take care of.

Reporting a vulnerability

Report security issues privately, not in a public issue or pull request. Use GitHub's private vulnerability reporting: Security → Report a vulnerability on this repository.

Include what you can of:

  • what an attacker controls (the server, the network path, the URL, a callback) and what they can make the client do;
  • the smallest input that shows it, for example the frames or the handshake response as bytes;
  • the WebSocket4D commit or release, the Delphi version, Win32 or Win64, and the TLS backend and OpenSSL version if TLS is involved.

We will acknowledge the report, keep you informed while we work on a fix, and credit you in the release notes if you want. Give us reasonable time to release a fix before you publish details.

Supported versions

Fixes go into main and ship in the next release. Only the latest release receives security fixes.

What the library protects against

WebSocket4D treats everything it receives from the server as untrusted:

  • Frames are parsed incrementally and checked against RFC 6455: masked server frames, reserved bits and opcodes, invalid lengths, oversized or fragmented control frames and invalid close codes fail the connection.
  • Messages larger than MaxMessageSize close the connection with 1009. Decompressed output (permessage-deflate, zlib-stream, zstd-stream) counts against the same limit while it is being produced, so a small compressed message cannot expand without bound.
  • A zstd-stream frame may declare a window of at most 2^MaxZstdWindowLog bytes (8 MB by default); a larger one closes the connection with 1009 before libzstd allocates it.
  • The opening handshake (TCP connect, TLS handshake and upgrade response) must finish within HandshakeTimeout, so a server that answers byte by byte cannot hold Connect open. The host name lookup is the exception: it is bounded only by the operating system's resolver timeout.
  • Text messages are validated as UTF-8 when ValidateUtf8 is on (the default); close reasons are always validated.
  • Mask keys come from the operating system's random source.
  • For wss://, TlsOptions.VerifyPeer is on by default on both TLS backends: the certificate chain is checked against the Windows root store, and the certificate must match the host name. The Indy backend also verifies a certificate issued for an IP address when the URL uses one.

What depends on your application

  • DLLs. TLS uses OpenSSL and zstd-stream uses libzstd.dll; both are loaded at runtime and are not part of this repository. Ship builds from a source you trust, verify them against a published checksum where one exists, and update them when their projects publish security fixes. The Indy backend requires OpenSSL 1.0.2, which no longer receives public security fixes; the TaurusTLS backend works with OpenSSL 3. Neither backend is safe by itself if the OpenSSL build it loads is outdated.
  • Where DLLs are loaded from. Put the DLLs next to your executable, or set the backend's library folder (IdOpenSSLSetLibPath, GetOpenSSLLoader.OpenSSLPath, TWsZstdLoader.LibraryFolder) to an absolute path you control. Do not point it at a folder that other users can write to.
  • VerifyPeer := False turns off the certificate and host name checks. Use it only for local testing.
  • Limits. Choose MaxMessageSize and QueueCapacity for the messages you expect; the defaults (64 MB, 4096 slots) favour throughput over memory.
  • Callbacks. OnReaderMessage, OnPong and, in poll mode, OnClose run on the reader thread. Message payloads point into a queue slot and are valid only until Release or until the handler returns.

There aren't any published security advisories