Repository navigation
MockServer 9.3.0
·
78 commits
to master
since this release
[9.3.0] - 2026-11-15
Security
- Release image and Helm chart signing can no longer be skipped. A release used to publish Docker images and the Helm chart unsigned, without failing, when it could not find the cosign signing key (this is how the 8.0.0 images and chart shipped unsigned). The release now checks the key before it publishes anything and stops if the key is missing or unusable. The
mockserver/mockserver-webhookimage on ECR Public is now signed too - (Release) Every toolchain image the release runs in is now pinned by digest, not only by tag, so re-pushing a tag cannot change what a release runs. This includes the community
alpine/helmandmaniator/ghimages, which receive the signing key and the GitHub token. The pins live inscripts/release/images/Dockerfile, which Dependabot keeps current in one PR that is never merged automatically and only refreshes digests or moves to a patch release on the same line. The VS Code extension is now packaged and published with the@vscode/vsceandovsxversions locked in itspackage-lock.json, instead of the latest versions installed globally in the container that holds the marketplace tokens, and the PyPI packages are built and uploaded withbuild,twineandsetuptoolsinstalled from a hash-pinned requirements file (scripts/release/requirements-publish.txt) rather than the latest versions. The npm release ofmockserver-nodeandmockserver-client-nodenow installs from their committed lockfiles (npm ci), updating only the entries the release itself changes, instead of deleting the lockfile, resolving every dependency afresh and runningnpm audit fixbefore publishing. The .NET client and Testcontainers packages are now restored in locked mode from committed NuGet lock files (packages.lock.json) - With
proxyAuthenticationUsernameandproxyAuthenticationPasswordset, a client could use MockServer as a proxy without credentials by opening its connection the way MockServer's ownCONNECTand SOCKS tunnels open theirs internally. MockServer now accepts that opening only on its own internal tunnel connections. The forward allow, deny and private-network rules were not affected, andCONNECT, SOCKS and plain proxy requests sent with credentials work as before. Present since 5.11.0 (fixes GHSA-36c2-h3v8-7w6w) - With
proxyAuthenticationUsernameandproxyAuthenticationPasswordset, SOCKS5 clients could proxy without credentials by offering "no authentication", SOCKS4 clients were never asked for credentials, and HTTP/3 CONNECT-UDP tunnels were opened without checking theProxy-Authorizationheader. SOCKS5 now selects username/password authentication whenever the client offers it and refuses a client that does not (replying0xFFand closing the connection), SOCKS4 is refused (it cannot carry a password) with a warning in the log, and HTTP/3 CONNECT-UDP now requires the proxy credentials, answering407without them. Without proxy credentials configured, SOCKS4, SOCKS5 and CONNECT-UDP behave as before, except that a SOCKS50xFFrefusal now also closes the connection. WithtransparentProxyEnabledalso set, MockServer now logs a warning at startup that connections handled as transparent proxying, including those whose destination comes from theHostheader or a PROXY protocol header, are not asked for proxy credentials (fixes GHSA-36c2-h3v8-7w6w) - With
proxyAuthenticationUsernameandproxyAuthenticationPasswordset, a plain HTTP proxy request for another host (a request line holding a full URL, such asGET http://example.com/path) without the credentials was still answered by a matching expectation, and was asked for them only when nothing matched; a WebSocket upgrade for another host was relayed to it without them; and the proxy WAR (mockserver-proxy-war) never asked for them. Such a request to the standalone server now gets407before it is matched against any expectation, a WebSocket upgrade for another host is relayed only with the credentials, and the proxy WAR asks for them before matching a request whoseHostnames another host. A request sent to MockServer directly (a request line holding only a path, as every HTTP/2 and HTTP/3 request is) is still matched without proxy credentials whatever itsHostheader says, and needs them only when MockServer would forward it; requests for MockServer's own address never need them. A request refused this way is logged as a failed proxy authentication, as a refusedCONNECTis, not as a received request, so it does not count inverifyorretrieveRecordedRequests. The WAR (mockserver-war) cannot see whether a request line held a full URL, so there every request is handled like one sent to MockServer directly. Without proxy credentials configured nothing changes - Build-time dependency fixes, none shipped in a published package: the Maven plugin's integration-test projects now pin Guava 33.8.0-jre, the version the main build uses (GHSA-xxph-c9ww-hj94 was fixed in 33.7.2), the VS Code extension's development lockfile resolves
qs6.16.1 (GHSA-6pq8-jhm2-2vcw; it reaches the build only through@vscode/vsce→typed-rest-client), and the Rust client's lockfile resolvesrustls0.23.46 (GHSA-vp88-798v-h67f, GHSA-w44r-93j7-qv28, GHSA-c8m5-c952-6cm4, GHSA-h2v8-394m-p7vv; the client uses native TLS, sorustlsis listed in its lockfile but not compiled into it). The development lockfiles of the Node client,mockserver-node, the dashboard UI and the VS Code extension now resolveminimatch11.0.3 (GHSA-g3hv-75wg-m249) for every copy that contains the affected code: underc8→test-excludein the Node client, throughmockserver-node'sglobdevelopment dependency (now 14.0.3), foreslintand its plugins in the dashboard UI and under@vscode/vscein the VS Code extension. All butmockserver-nodeuse npmoverrides, because no release of those tools acceptsminimatch11 yet. Theminimatch3.x copies thatgruntandjshintstill pull in do not contain the affected code. The development lockfiles of the Node client andmockserver-nodenow also resolvelodash4.18.1 for the copy underjshint(GHSA-f23m-r3pf-42rh), through an npmoverridesentry becausejshintaccepts onlylodash4.17.x;jshintdoes not call the affected_.unset,_.omitor_.pullAt - The standard image (
mockserver/mockserver, built fromdocker/local), the-aotimage and the referencedocker/Dockerfileimage now run ongcr.io/distroless/java-base-debian13:nonrootinstead ofjava-base-debian12. Distroless stopped buildingjava-base-debian12in February 2026 (GoogleContainerTools/distroless#2023), so its pinned digest could no longer pick up Debian security fixes; the new base shipslibbrotli11.1.0-2+deb13u1, fixing CVE-2026-111497 (DSA-6582-1), and is the same Debian release as the other image variants (#2927) - The Node Testcontainers module's lockfile now resolves
glob14.0.3 andminimatch11.0.3 underarchiver, a runtime dependency of the published@mockserver/testcontainerspackage (GHSA-3g3m-2fjr-6pw4, GHSA-g3hv-75wg-m249). The fix uses npmoverrides, which npm does not apply when another project installs the package, so a project that depends on@mockserver/testcontainersresolves these from its own lockfile untilarchivermoves to the patched releases; it can add the sameoverridesitself. The module does not reach the affected code:archivercopies a directory without a glob pattern, and the affectedglobcopy is used only by anarchiver-utilshelper thatarchiverdoes not call - The forward-target checks (
forwardProxyBlockPrivateNetworks,forwardProxyAllowedHosts,forwardProxyDeniedHosts) could be sidestepped by a destination an upstream proxy reads differently from MockServer. ThroughforwardHttpProxythe proxy's request line was built from the rawHostheader and path, so aHostsuch as8.8.8.8:80@169.254.169.254orallowed?.example.com, a secondHostheader, or a path not starting with/could send the proxy to a host that was never checked. A plain HTTP request sent throughforwardHttpProxynow needs exactly oneHostheader (without one, the client address is used) that is a host name, IPv4 address or bracketed IPv6 address with an optional port, and is otherwise refused with502 Bad Gatewayeven when no check is set; its path always starts with/, spaces and control characters in it, Unicode ones included, are percent-encoded except CR and LF, which are still refused, andOPTIONS *is sent asOPTIONS http://<host>/rather than with*appended to the host. ThroughforwardHttpsProxyorforwardSocksProxy, a request whose tunnel destination is not a host of that form is refused before connecting, and so is a binary (non-HTTP) connection tunnelled through any of the three upstream proxies, whose destination previously reached the proxy as given (aforwardProxyAllowedHostsentry*.allowed.comletsecret.internal.example/.allowed.comthrough). A PROXY protocol v1 header whose destination is not an IP address of the family it declares (TCP4orTCP6), such as a host name, is now ignored as malformed, as the PROXY protocol requires. Where a check is set, a numeric IPv4 host that is not four decimal octets without leading zeros (0177.0.0.1,0x7f.1,2130706433), which resolvers may read as another address, is refused, as is a forwarded request whose destination host or port cannot be read, and an IPv6 address whose dotted IPv4 part has a leading zero ([::ffff:017.0.0.1]) is refused too.forwardProxyBlockPrivateNetworksand address entries inforwardProxyAllowedHosts/forwardProxyDeniedHostsnow check the IPv4 address inside an IPv4-compatible (::127.0.0.1), IPv4-translated (::ffff:0:a9fe:a9fe) or NAT64 (64:ff9b::a9fe:a9fe) IPv6 address. Within the local-use NAT64 prefix64:ff9b:1::/48, which an operator may divide into longer prefixes, and for a 6to4 address (2002::/16), an address is refused if any IPv4 address it may carry is blocked or denied, but never matches an allow-list entry through one; other operator-specific NAT64 prefixes and Teredo (2001::/32) addresses are not unwrapped, so egress control on the NAT64 gateway or proxy remains the real protection.forwardProxyBlockPrivateNetworksalso now blocks the "this network" range0.0.0.0/8(0.1.2.3,::0.0.0.2), not only0.0.0.0. A well-formedHostand path are sent as before. The checks use MockServer's own lookup of a name, which an upstream proxy resolves again, so restrict egress on the proxy too - The Kafka SSL keystore and truststore can only be set at startup (BREAKING for anyone who sends
kafkaSecurity.sslTruststoreLocation,sslTruststorePassword,sslKeystoreLocation,sslKeystorePasswordorsslKeyPasswordtoPUT /mockserver/asyncapi; see upgrading to 9). A request could name any file as the Kafka keystore or truststore, so anyone who could reach MockServer's API could make the Kafka client read any keystore-format file the MockServer process can read. Those fields are now rejected with a400that names the startup property to use instead:asyncKafkaSslTruststoreLocation,asyncKafkaSslTruststorePassword,asyncKafkaSslKeystoreLocation,asyncKafkaSslKeystorePasswordandasyncKafkaSslKeyPassword(system property, environment variable such asMOCKSERVER_ASYNC_KAFKA_SSL_TRUSTSTORE_LOCATION, properties file orConfiguration). MockServer gives them to the Kafka client when a request'ssecurityProtocolisSSLorSASL_SSL. While any of them is set, anSSLrequest must leave outkafkaBootstrapServersor name the startupasyncKafkaBootstrapServers, as aSASL_*request must, so MockServer's client certificate is only presented to brokers chosen at startup.PUT /mockserver/configurationignores them with a warning, andGET /mockserver/configurationreturns the two locations but never the passwords. The samebrokerConfigkeys outsidekafkaSecurity, or spelt with dots or another case, are rejected too. APUT /mockserver/configurationthat supplies any startup-only secret (these passwords,asyncKafkaSaslJaasConfig,clusterFanInPeerAuthToken,forwardCredentialHeadersByHostorcontrolPlaneBasicAuthenticationCredentials) now always logs the warning, even when the value matches the one in force, so the warning can no longer be used to confirm a guessed secret - The MQTT SSL keystore and truststore can only be set at startup (BREAKING for anyone who sends
mqttSecurity.sslPropertiestoPUT /mockserver/asyncapi, or, once anasyncMqttSsl*property or the JVM'sjavax.net.ssl.keyStoreis set, sends anssl:///wss://broker URL other thanasyncMqttBrokerUrlor changesasyncMqttBrokerUrlwithPUT /mockserver/configuration; see upgrading to 9). The request'ssslPropertieswent to the MQTT client unchanged, so anyone who could reach MockServer's API could name any file as the MQTT keystore or truststore, making the MQTT client read any keystore-format file the MockServer process can read, and could choose its TLS protocol, cipher suites, security provider and key and trust manager. EverysslPropertiesentry is now rejected with a400that never echoes the value. Forcom.ibm.ssl.keyStore,keyStorePassword,keyStoreType,trustStore,trustStorePasswordandtrustStoreTypeit names the startup property to use instead:asyncMqttSslKeystoreLocation,asyncMqttSslKeystorePassword,asyncMqttSslKeystoreType,asyncMqttSslTruststoreLocation,asyncMqttSslTruststorePasswordandasyncMqttSslTruststoreType(system property, environment variable such asMOCKSERVER_ASYNC_MQTT_SSL_TRUSTSTORE_LOCATION, properties file orConfiguration), which MockServer gives to the MQTT 3 and MQTT 5 clients when the broker URL uses any scheme other thantcp://orws://(such asssl://orwss://). The protocol, cipher suites, providers and key and trust manager now come from the JVM's own TLS settings (such asjdk.tls.client.protocols), andcom.ibm.ssl.clientAuthentication, which Paho reads only for a TLS server and so never affected the client, is rejected too. The same keys spelt in another case or with dots or underscores, placed directly inmqttSecurity, or placed at the top level ofbrokerConfig, are rejected the same way. While anyasyncMqttSsl*property, or the JVM'sjavax.net.ssl.keyStore(which Paho falls back to), is set, a request using any scheme other thantcp://orws://must leave outmqttBrokerUrlor name the startupasyncMqttBrokerUrl, so MockServer's client certificate is only presented to the broker chosen at startup, andPUT /mockserver/configurationthen ignores a newasyncMqttBrokerUrlwith a warning; with none of them set,asyncMqttBrokerUrlcan still be changed at runtime as before.PUT /mockserver/configurationalways ignores the sixasyncMqttSsl*properties with a warning, andGET /mockserver/configurationreturns the locations, types and broker URL but never the passwords - The template Java class settings can only be set at startup (BREAKING for anyone who changes
velocityDisallowClassLoading,javascriptAllowedClassesorjavascriptDisallowedClasseswithPUT /mockserver/configurationor a client'supdateConfiguration; see upgrading to 9). These settings decide whether response and forward templates can load Java classes, but aPUT /mockserver/configurationcould change them on a running server, so anyone who could reach the control plane could let templates use any Java class. Before, they were fixed at startup only whileforwardCredentialHeadersByHostwas set. APUTthat sets a different value is now still answered, but the value is ignored, a warning is logged andGET /mockserver/configurationreports the value in force; aPUTthat sends the value already in force logs nothing. Set them before the server starts with a system property, environment variable,mockserver.propertiesorConfiguration.javascriptDisallowedText,velocityDisallowedTextandmustacheDisallowedTextcan still be changed at runtime (fixes GHSA-5xh7-f7gh-prcf) - Upgraded Netty from 4.2.19.Final to 4.2.20.Final (bundled dependency; netty-tcnative moves to 2.0.85.Final with it). It fixes GHSA-6xv6-9mgg-mfvc, where a client could get past TLS client-certificate (mTLS) authentication by resuming a TLS session, three out-of-bounds reads in
netty-buffer(GHSA-m77g-r4c7-3w77, GHSA-rx4g-qxm6-238r, GHSA-qhw9-p586-v948), control characters not neutralised in the HTTP/1.1 codec (GHSA-42mp-m8rq-6rgj) and several HTTP/2, HTTP/3 and QUIC issues. Two visible changes: withtlsMutualAuthenticationRequired, a client whose certificate MockServer does not trust is now refused with abad_certificateTLS alert instead ofinternal_errorwhen MockServer uses OpenSSL (the default when its native library loads); and Netty now decrypts TLS into buffers of at most 16 KiB, too small for a 16 KiB HTTP/2 DATA frame and its header, so MockServer's HTTP/2 server now joins the two pieces of such a frame into a buffer of their own size instead of one twice as large. An HTTP/2 upload over TLS sent in 16 KiB frames therefore holds about 1.0 to 1.3 times its size in memory while it arrives when the client sends each frame in TLS records of its own, and 1.3 to 1.7 times when frames share records (about 1.1 to 1.7 times before, for 1 and 4 MiB uploads); cleartext HTTP/2 uploads in 16 KiB frames hold slightly less too. Also upgraded jsoup to 1.24.1, Guava to 33.8.0-jre and Error Prone annotations to 2.52.0, and, in the optional blob-store modules, the AWS SDK to 2.57.8, Google Cloud Storage to 2.76.0 and Azure Storage Blob to 12.37.1 - When MockServer (the JAR, Docker image or Helm chart) is a forward proxy, a request a client sends through it to another host is now matched against expectations and, if none matches, forwarded, even when its path looks like one of MockServer's own API routes, such as
PUT http://upstream/mockserver/clearor aPUT /clearinside aCONNECTor SOCKS tunnel to another host (this changes behaviour for anyone who sends MockServer API calls through MockServer's own proxy to an address it cannot recognise as its own, as described below, or relies on a MockServer reached as another MockServer'sproxyRemoteHostanswering API or liveness calls the front MockServer does not serve itself). MockServer used to answer such a request itself, so a proxied request could clear, reconfigure or stop the proxy instead of reaching its destination. Requests addressed to MockServer itself are served as before: sent directly, whatever the host name, or sent through its own proxy to a port it listens on (including ports added with/bind), tolocalhostor another loopback address at any port (whichkubectl port-forwardorssh -Lmay relay to MockServer), or by host name to one of its ports. No MockServer of this version or later serves an API call that a MockServer forwarded as a proxy (it answers404, MCP and WebSocket upgrades included), so a client that can only use the proxy cannot reach the API of a MockServer of this version or later with the forwarding MockServer's client certificate (upgrade every MockServer that trusts the proxy's certificate authority before relying on this). So an API call sent through the proxy to an address of MockServer's it cannot recognise as its own, such as a Kubernetes Service port or a Docker host or ClusterIP address, or to another MockServer, now gets404: send such calls to MockServer directly. Such a call carriesx-forwarded-by: MockServer_proxiedto its destination, and recorded expectations (and recordings promoted to mocks) no longer keep anx-forwarded-byheader, so they match a client calling MockServer directly. The proxy WAR does not classify proxied requests. Contributed by Matthew Hall (@megahall) in #2955 - With
proxyAuthenticationUsernameandproxyAuthenticationPasswordset, the client'sProxy-Authorizationheader, which holds the proxy password, was kept on the request after MockServer checked it: it was shown in the dashboard, returned byretrievefor requests and logs, written to recordings and recordings saved to disk, could be matched by expectations, and was relayed to the upstream server in a proxied WebSocket handshake. MockServer now removes the header once it has checked it, whether the credential was right or wrong, so it is never recorded, matched or forwarded; the log entries for a refusedCONNECTand for a request refused by data-plane authentication (dataPlaneAuthenticationRequired) or for lacking TLS (tlsMutualAuthenticationRequired) no longer hold it either. Without proxy credentials configured,Proxy-Authorizationis recorded and matched as before, but, as for every other forwarded request, it is no longer relayed in a proxied WebSocket handshake, and neither isProxy-Connection. Contributed by Matthew Hall (@megahall) in #2954 and #2955 - The Go Testcontainers module (
mockserver-testcontainers/go) now requiresgolang.org/x/cryptov0.59.0 andgithub.com/klauspost/compressv1.20.3 or later, so projects using it no longer resolve versions with known advisories (GO-2026-6303, GO-2026-6354, GO-2026-6355, GO-2026-5932, GO-2026-6865). Because thatx/cryptorelease needs Go 1.26, the module now requires Go 1.26 or later - The .NET Testcontainers module (
MockServer.Testcontainers) now requires Testcontainers 4.16.0 or later, which depends on SSH.NET 2026.0.0, so projects using it no longer resolve an SSH.NET version with known advisories (GHSA-mggc-4xg6-vcxf, GHSA-q939-rpr3-3284). It still accepts anyMockServerClientfrom 7.1.0 - The proxy WAR (
mockserver-proxy-war) forwarded a request that matched no expectation and whoseHostheader was the WAR's own address (localhost,127.0.0.1or the server's IP address, followed by its port, except on port 80, and on port 443 over HTTPS, where it is written without a port) back to that address, without asking for proxy credentials even whenproxyAuthenticationUsernameandproxyAuthenticationPasswordwere set. So a client that could reach the WAR could fetch any other application on the same servlet container, such as its management pages, as a request from the container itself. Such a request, and one with noHostheader, is now a request to MockServer itself, as on the JAR, Docker image and Helm chart: it is matched against expectations without credentials and, when nothing matches, answered404; it is never forwarded to the container, and an extension request filter or response transformer is told it was not a proxy request. WithproxyRemoteHostandproxyRemotePortset, an unmatched one is forwarded there, and needs the proxy credentials when they are configured; one whose path matches aproxyPassMappingsentry still goes to that entry's target. Requests whoseHostnames another host are proxied as before - Build and test tooling hardening, none shipped in a published package: the API-collection CI gate installs PyYAML from a hash-pinned requirements file, the container-test Dockerfiles are digest-pinned (the curl test client moves from Ubuntu 20.04, now out of standard support, to 24.04), the local dashboard launch scripts install with
npm ci, the JetBrains plugin's Gradle wrapper pins its distribution checksum, and a new GitHub Actions workflow checks the committedgradle-wrapper.jarfiles against Gradle's published checksums
Added
- A new startup property,
proxyProtocolTrustedSources(-Dmockserver.proxyProtocolTrustedSourcesorMOCKSERVER_PROXY_PROTOCOL_TRUSTED_SOURCES), lists the IP addresses and CIDR blocks (IPv4 or IPv6) a PROXY protocol v1 or v2 header is accepted from whentransparentProxyEnabledis on, normally the load balancer that adds it. A PROXY header names where a connection is forwarded and which client address is recorded for it, so until now any client that could reach a transparent-proxy port could choose both; with the property set, a connection from any other address that starts with a PROXY header is closed with a warning, as HAProxy does with a header from a source it does not trust, while connections without a header are unaffected. Empty (the default) keeps today's behaviour. An entry that is not a single IP address or CIDR block (a host name, a block with bits set after its prefix, a block covering every address or every IPv4 address, a zone ID, an IPv4 part with a leading zero, an IPv4 address written as::a.b.c.d) stops the server starting, each entry being checked on its own, the entries in force are logged at startup, the refusal warning is given at most once a minute, andPUT /mockserver/configurationcannot change it. The startup warning given when transparent proxying and proxy credentials are both set now says whether it is set - Release Docker images (
mockserver/mockserverand its-graaljs,-clustered,-aotand-http3tags, andmockserver/mockserver-webhook) now carry an SPDX software bill of materials (SBOM) and SLSA build provenance as image attestations, readable withdocker buildx imagetools inspect <image> --format '{{ json .SBOM }}'(or.Provenance); they are covered by the image's cosign signature - Every Maven artifact released to Maven Central now has a CycloneDX software bill of materials next to it (
<artifactId>-<version>-cyclonedx.json), signed like the jar - Dashboard: a workspace tab you are not looking at, on a different server from the workspace you are in, now shows how many items (requests, responses or stream frames) are paused at a breakpoint on its server; click the count to open that workspace's Breakpoints view before the breakpoint timeout continues them
- A new opt-in property,
recordTruncatedStreamTiming(-Dmockserver.recordTruncatedStreamTimingorMOCKSERVER_RECORD_TRUNCATED_STREAM_TIMING), keeps the chunk timing of a streamed forwarded response that is recorded as truncated: one the upstream closes or resets without ending it, that times out (streamIdleTimeoutSeconds), whose upstream fails, or that passesmaxStreamingCaptureBytes. Such a recording lost itsx-mockserver-chunk-delays-ms, so it could only be replayed as one static response. With the property on it keeps the timing of the chunks captured before the cut and stays markedx-mockserver-stream-truncated: true; nothing is timed after the cut. A fixture made from a truncatedtext/event-streamrecording with that timing (for example by therecord_llm_fixturesMCP tool) now replays the events captured before the cut with their delays, leaves out an event cut off part way, and carries anx-mockserver-fixture-warningheader; the replay then ends the stream normally rather than reproducing how it broke. Other content types keep the static fallback (#2929) - A new opt-in property,
recordOpenStreamsOnStop(-Dmockserver.recordOpenStreamsOnStoporMOCKSERVER_RECORD_OPEN_STREAMS_ON_STOP), records a streamed forwarded response that is still open when MockServer stops, such as a Server-Sent Events push stream the backend never ends. Such a stream was recorded only when it ended, so a stop (PUT /mockserver/stop, orSIGINT/SIGTERMto the command line) lost it: it was missing from the recorded expectations and frompersistedRecordedExpectationsPath. With the property on, the stop first ends each open recorded stream (the client gets the normal end of the stream), records it as complete with itsx-mockserver-chunk-delays-ms, marks itx-mockserver-stream-closed-by-mockserver-stop: true, and waits forpersistedRecordedExpectationsPathto be written; when the property is set at startup the command line also stops MockServer this way onSIGINT/SIGTERM(see the clean-stop entry under Changed for how long to letdocker stopwait). Nothing changes with the property off (#2945) - A new startup property,
forwardCredentialHeadersByHost(-Dmockserver.forwardCredentialHeadersByHostorMOCKSERVER_FORWARD_CREDENTIAL_HEADERS_BY_HOST), adds credential headers to requests MockServer forwards or proxies to a named upstream host, each valued from an environment variable read once at startup, for exampleglobal.example.com=Authorization:GLOBAL_CLUSTER_TOKEN. The value is added only to the copy of the request written to the upstream, so it never appears in expectations, the log, recordings, exports or the dashboard, even withredactSecretsInLogoff. Headers are sent only over TLS unless an entry is writtenhttp://host:port, and HTTPS entries needforwardProxyTLSX509CertificatesTrustManagerTypeset toJVMorCUSTOMandforwardProxyTLSHostnameVerificationEnabledset totrue; otherwise they are ignored with a warning. A TLS connection that carries a credential is always a new one, never pooled, and trusts only the JVM's root CAs or theCUSTOMfile as they were at startup, never MockServer's own CA or a certificate it signed, even when the JVM trust store or theCUSTOMfile holds them, and never uses TLS 1.0 or 1.1. A header is added only when the connection target and the request's singleHostheader name exactly the configured host and port, the path starts with/, and the method is notTRACEorCONNECT. The property can only be set at startup. Requests are no larger when the property is not set. The configuration properties page explains what it does not protect against (#2930) - A new opt-in property,
recordClientClosedStreamsComplete(-Dmockserver.recordClientClosedStreamsCompleteorMOCKSERVER_RECORD_CLIENT_CLOSED_STREAMS_COMPLETE), keeps the chunk timing when the client closes a streamed forwarded response part-way through. Since 9.0.0 MockServer then closes the upstream, and a chunked stream was recorded as incomplete (x-mockserver-stream-truncated) with nox-mockserver-chunk-delays-ms. With the property on, such a recording ends complete, keeps its chunk delays and is markedx-mockserver-stream-closed-by-client: true. A stream that the upstream ends or breaks, and one MockServer closes itself (a response write stall, an error or chaos action, an HTTP/2 or HTTP/3 connection error, a QUIC transport or TLS error, or a server stop), is recorded as before. ThemaxStreamingCaptureByteslimit still applies - An SSE event can now carry a
comment(SseEvent.withComment(...)in Java,commentin JSON and in the Node, Python, Ruby, Go, .NET, Rust and PHP clients, and a Comment field for each event in the dashboard's expectation composer, whose generated code includes it). It is sent before the event's other fields as:followed by each line of the comment exactly as written (keep-aliveis sent as:keep-alive,keep-aliveas: keep-alive), so an event with only a comment sends a heartbeat and a blank line, which clients ignore. A line break in a comment cannot start a new field or event. WithtemplateTypeset the comment is rendered likedata, and for NDJSON, JSON array and AWS event-stream LLM responses a comment-only event sends nothing but still waits its delay. Events without a comment are sent exactly as before (#2946) - The
record_llm_fixturesMCP tool takeskeepSseComments(defaultfalse). With it set, the comment lines of a recorded SSE stream, such as:heartbeat, are kept: each comment-only chunk becomes an event with only acomment, replayed exactly as recorded (the text after the colon, leading space included) with its recorded delay (#2946) - A recorded streamed response now carries
x-mockserver-first-chunk-delay-ms, the time from the start of the forward to the first chunk, measured on the same clock asx-mockserver-response-time-ms.x-mockserver-chunk-delays-msis unchanged and its first value is still 0. Fixtures made byrecord_llm_fixturesnow replay the first event after that wait, so a backend that waited before its first event is no longer replayed as answering at once. The header is kept out of fixtures like the other recording headers (#2947) - An SSE response can now wait before it ends:
closeDelayonhttpSseResponse(HttpSseResponse.withCloseDelay(...)in Java, and in the Node, Python, Ruby, Go, .NET, Rust and PHP clients and the dashboard's generated code) is how long the stream stays open after its last event, andkeepStreamOpen: truekeeps it open until the client leaves or MockServer stops. Before, a stream always ended right after its last event, so SSE clients reconnected at once. Fixtures made byrecord_llm_fixturesfrom a stream the backend ended now get acloseDelay, the recorded total time less the time the events replay over, so the replay ends when the recording did; a truncated stream, or one the client or MockServer's stop (recordOpenStreamsOnStop) closed, gets none.record_llm_fixturesalso no longer drops an SSE response'sdelayandprimarywhen it redacts a fixture. Responses without either field behave as before (#2947)
Changed
- The Rust client (
mockserver-clientcrate) now needs Rust 1.88 or newer (it declared 1.75), and CI now builds, tests and lints it on exactly Rust 1.88 as well as on the latest stable (BREAKING for Rust client users on an older compiler). It now uses reqwest 0.13, tungstenite 0.30, sha2 0.11 and base64 0.23, and still connects with the platform's native TLS over HTTP/1.1 as before.PausedStreamFrame::body_bytes()now returns the client's ownmockserver_client::Result<Vec<u8>>: a body that is not valid Base64 is the newError::Decodevariant, with the decoder's error as itssource(), instead of abase64::DecodeError, so later base64 upgrades no longer change the client's API (BREAKING for code that namesbase64::DecodeErrorfrombody_bytes()).Error::Transportstill holds areqwest::Error, now from reqwest 0.13 (BREAKING for code that converts its own reqwest 0.12 errors intomockserver_client::Erroror passes the inner error to reqwest 0.12 APIs). The Testcontainers module (testcontainers-mockservercrate) now declares Rust 1.88 too, because it uses the newestmockserver-client - The command line and the Docker image now stop cleanly on
SIGINT/SIGTERM(Ctrl+C,docker stop, a Kubernetes pod shutdown) wheneverpersistExpectations,persistRecordedExpectations,persistRecordedRequestsToDiskorrecordOpenStreamsOnStopis set at startup, the same wayPUT /mockserver/stopdoes, so its files are written before the process exits. Before, the process exited at once and could lose the last recorded requests still buffered forpersistedRecordedRequestsPathand the last write ofpersistedRecordedExpectationsPath. A clean stop waits up tostopDrainMillis(15 seconds by default) for requests still in progress before it writes the files, anddocker stopkills a container after 10 seconds, so give it longer (docker stop -t 30,docker run --stop-timeout 30, Composestop_grace_period: 30s; the Helm chart already allows 45 seconds) or lowerstopDrainMillis. With none of these properties set, nothing changes - A CONNECT or SOCKS tunnel through MockServer now carries any TCP protocol, not only HTTP and TLS, to its destination (SOCKS4 only when proxy credentials are not configured, since it is refused otherwise). Where clients you do not trust can reach MockServer, limit where binary connections may go with
forwardProxyBlockPrivateNetworks,forwardProxyAllowedHostsandforwardProxyDeniedHosts, which apply to every binary connection. Proxy authentication (proxyAuthenticationUsernameandproxyAuthenticationPassword) is asked for before a CONNECT or SOCKS tunnel opens, but not on a transparent-proxy or port-forwarded connection, anddataPlaneAuthenticationRequireddoes not apply to binary connections. A binary connection's messages, including credentials a protocol sends in the clear (a RedisAUTH, a PostgreSQL password), are kept in the event log, so protect the control plane where MockServer proxies real credentials - .NET client (
MockServerClientNuGet package): thenetstandard2.0build, used by .NET Framework and by .NET versions before .NET 8, now depends onSystem.Text.Json10.0.14 andMicrosoft.Bcl.AsyncInterfaces10.0.14, up from 8.0.6 and 8.0.0, because .NET 8 support ended on 2026-11-10. A project that pins either package, or a packageSystem.Text.Json10 depends on such asSystem.Text.Encodings.Web, below the new version must raise its pin, or restore fails with NU1605 (package downgrade). On .NET 6 or 7,System.Text.Jsonnow also prints a build warning that the target framework is unsupported. Thenet8.0build, used by .NET 8 and later, has no package dependencies and is unchanged, and the target frameworks (netstandard2.0,net8.0) are unchanged - The nightly client conformance sweep (CI) no longer re-runs the seven client pipelines when
masterhas not moved since the last passed sweep - Snapshot builds are now published once a night (02:00 UTC) from
masterinstead of after every commit: themockserver/mockserver:snapshotimage and its variant tags on Docker Hub and ECR Public, the SNAPSHOT jars in the Sonatype snapshot repository, and the snapshot binary bundles the client launchers download. A snapshot can be up to a day behindmaster - Dashboard: a link that names a server with
?host=,?port=,?secure=or?basePath=now opens on that server even when the workspace you had open has its own server. The link opens in a workspace that follows it (an existing one without its own server, or a new one), and your workspace keeps its server, view and searches, one tab away. Before, the stored server won and the link was ignored
Removed
- The
http1PipeliningInOrderproperty (-Dmockserver.http1PipeliningInOrder,MOCKSERVER_HTTP1_PIPELINING_IN_ORDER), the temporary switch added in 9.2.0 to turn off in-order answering of pipelined HTTP/1.1 requests. MockServer now always answers requests pipelined on one connection in the order they were sent. A configuration that still sets it is not an error: the property is ignored, the startup warning anddiagnose_configreport it as removed, andPUT /mockserver/configurationignores the field. The perf pipeline's on / off A/B for it (about 5 minutes of eachperf-run) is removed with it, and that step's timeout goes back from 90 to 80 minutes
Fixed
- A streamed forwarded response still in a
Content-EncodingMockServer does not decode (such as a custom coding) was recorded as text, which corrupted its bytes, so replaying the recording sent the client different bytes than the upstream had. It is now recorded as its bytes, and an SSE fixture made from it replays those bytes unchanged instead of trying to read events from them - An SSE recording whose lines end with a lone carriage return (
\r), which the SSE specification allows, was turned into a fixture as one garbled event. Lines may now end with CRLF, LF or CR, and a CRLF is still one line end - The trailers that end a streamed forwarded response (an HTTP/1.1 chunked trailer section, such as a checksum) were dropped: the client never received them and the recording did not hold them. They are now relayed to the client and recorded as the response's trailers
- An SSE fixture made from a recorded stream replayed events at the wrong times when the backend's chunks did not hold one event each: events the backend sent together were spread out over the delays of later chunks, and an event that arrived in pieces was replayed before its last piece arrived. A recording now also carries the bytes each chunk held (
x-mockserver-chunk-sizes-bytes, a log-only header like the other recording headers), and each event replays when the chunk that completed it arrived. Recordings made with earlier versions replay as before - A forwarded or recorded
text/event-streamorapplication/x-ndjsonresponse that named nocharsetwas read as ISO-8859-1, so non-ASCII text in it (accented letters, emoji, CJK) was garbled in the event log, the dashboard and the recorded expectation, and an SSE fixture made from the recording (such as byrecord_llm_fixtures) replayed it garbled. Both types are always UTF-8, so MockServer now reads and writes them as UTF-8 when no charset is given. A mockedtext/event-streamresponse with a static body is now also sent as UTF-8, rather than as ISO-8859-1 (with?for any character outside it) - A recorded gRPC call made by a client that sets a deadline did not match the same call when replayed: the recorded expectation required the call's
grpc-timeoutheader, which is the time left before the deadline and so differs on every call, and the replayed call was answeredUNIMPLEMENTED(or proxied again). Recorded expectations no longer includegrpc-timeoutorgrpc-previous-rpc-attempts(the retry count). Recordings made with earlier versions hold the header: re-record them, or remove it from their request - When MockServer proxied or forwarded a gRPC call, the upstream's trailing metadata (trailers such as
x-costor a-binkey sent withgrpc-status) reached the client as response headers, so a client reading it from the trailers did not find it, and the same happened when the recording was replayed. Trailing metadata is now relayed, recorded and replayed as trailers, andredactSecretsInLogandredactSecretsInRecordedExpectationsmask a sensitive trailer (such asx-api-key) as they mask that header - A gRPC call forwarded by a
FORWARDexpectation while no gRPC descriptors were loaded was sent to an HTTPS upstream over HTTP/1.1, which a gRPC server refuses, so the client gotUNAVAILABLE. It is now sent over HTTP/2 withte: trailers, as with descriptors loaded, and itsgrpc-statusreaches the client in the trailers. A plaintext upstream is still called over HTTP/1.1 - A
grpcStreamResponsesent to a gRPC-Web client (application/grpc-weborapplication/grpc-web-text) was written as plain gRPC, with theapplication/grpccontent type, unencoded for-text, and its status in HTTP trailers, which a browser cannot read. It is now sent as gRPC-Web: each message in a frame, base64-encoded for-text, followed by the gRPC-Web trailer frame carryinggrpc-statusandgrpc-message - A WebSocket reached through MockServer as an HTTP
CONNECTor SOCKS proxy, which is how browsers and most HTTP clients sendws://andwss://through a proxy, failed at its first message: after the101 Switching Protocolsthe tunnel went on reading the WebSocket frames as HTTP, so the connection ended or the client was sent an HTTP error. This broke mocked (httpWebSocketResponse) and proxied WebSockets alike. After a101the tunnel now carries the connection's bytes unchanged in both directions - A proxied WebSocket handshake no longer forwards hop-by-hop request headers to the upstream:
Keep-Alive,TE,Trailer,Transfer-Encodingand any header the request'sConnectionheader names. They describe the client's connection to MockServer, not MockServer's to the upstream - A proxied WebSocket whose upstream selected none of the subprotocols the client offered (
Sec-WebSocket-Protocol) was answered502; the upstream's answer is now relayed, with no subprotocol, and the client decides, as RFC 6455 allows. A client that sends each subprotocol on its ownSec-WebSocket-Protocolline now has all of them offered upstream and selectable, not only the first - A WebSocket frame larger than 64 KiB was refused with close code
1009(message too big): by a proxied WebSocket in both directions, and by a mocked one for what the client sent. A frame from the client is now limited bymaxRequestBodySize(10 MiB by default) and one from the upstream bymaxResponseBodySize(50 MiB by default), as request and response bodies are. WithmaxRequestBodySizeset below 64 KiB, the limit on WebSocket frames from clients is now lower than before - A mocked WebSocket's message matchers now see a message the client sends in fragments (a text or binary frame followed by continuation frames) as one message. Before, each fragment was matched on its own, so a matcher for the whole text never matched, and a matcher for any frame answered every fragment. A whole message larger than
maxRequestBodySizecloses the WebSocket with code1009 - A proxied WebSocket closed by either side with a close frame now answers that side with a close frame of the same code and reason, as RFC 6455 requires. Before, the side that started the close got only the end of its connection, so browsers reported an abnormal close (
1006,wasCleanfalse) and other clients waited for a close frame that never came - A gRPC call that MockServer proxied or forwarded, with gRPC descriptors loaded, and whose response had no messages (such as a server stream that ended straight away) reached the client with one placeholder message, and so did every replay of its recording: the empty response was recorded with no body, which MockServer fills with an example message. It is now recorded as an empty JSON array (
[]) and sent, while proxying and on replay, as a stream with no messages and the upstream'sgrpc-status. Recordings made with earlier versions hold no body for such a call: re-record them, or set the response body to[]. A server stream with several messages, recorded as a JSON array of them, is now also sent as those messages over HTTP/1.1, HTTP/2 and HTTP/3; it was answeredINTERNAL. A forwarded client-streaming call that sent no messages no longer has an empty message added to it, and a recorded gRPC response no longer lists itsgrpc-statustwice (#2988) - A forwarded or proxied request whose every header is hop-by-hop (such as
Connection,Proxy-ConnectionorProxy-Authorization) kept all of them, because the filter that drops those headers left a request unchanged when it would have had no headers left. It is now forwarded with none. Contributed by Matthew Hall (@megahall) in #2954 and #2955 - With
persistRecordedExpectationson, a recording made in the last quarter of a second before MockServer stopped could be missing frompersistedRecordedExpectationsPath, because the file is written at most every 250 ms and the stop stopped writing it before that write. The stop now writes the file once more and waits for it (#2945) - (CI)
ForwardConnectFailureCauseIntegrationTestfailed intermittently with404s and a "host name could not be resolved" body where a refused connection was expected: it took its "closed" port by binding port 0 and closing the socket, and one of the MockServer instances the class then started could be given that same port by the operating system, so the forwards meant to be refused reached a MockServer instead. It, and four other tests that took a refused port the same way (BinaryThroughTunnelIntegrationTest,BinaryPersistentRelayIntegrationTest,NettyHttpClientUpstreamProxyFailureTest,NettyHttpClientBinaryRelayConnectTest), now use port 1 (ClosedPort.CLOSED_PORT), which no port allocator hands out.BinaryThroughTunnelIntegrationTest's check that a tunnel back into MockServer is refused also starts its server atINFO, as its siblings do, because it readsINFOlog lines and failed whenever the test log level was higher - With an extension response transformer loaded, the event log entry for a streamed forwarded response (for example server-sent events) now has the CORS headers (
enableCORSForAllResponses) anddefaultResponseHeadersthe client received, as it does with no extension loaded; before, they were missing from the recorded response - A
PUT /mockserver/trafficValidatethat arrives while MockServer is stopping is still answered503, but no longer logs anERRORwith a stack trace, and its body says only that MockServer is stopping rather than naming the internal executor and its pool sizes; other control-plane endpoints already treated a stopping server this way - A client that uses MockServer as its HTTP
CONNECT, SOCKS5 or SOCKS4 proxy for a protocol that is not HTTP, such as PostgreSQL, MySQL, Redis or SMTP, now has the tunnel proxied as a binary connection to the tunnel's destination, with binary expectations, the event log, in-band TLS (PostgreSQLsslmode=require), upstream proxies and the forward-target checks, as on a port-forwarded connection. Such a tunnel was answered400 Bad Request, or left waiting when the client's first bytes had no line end. MockServer tells the protocol from the client's first bytes: TLS, the h2c preface and an HTTP/1.x request line, whatever its method, are served as HTTP as before, and anything else is binary; first bytes that could still become a request line are held until the client has sent nothing for one second. A server that speaks first (MySQL, SMTP) needsforwardBinaryServerFirstWaitMillis, which now also applies to a tunnel from the moment it is open. MockServer never relays a binary connection, a tunnelled one included, back into one of its own listening ports, so tunnels cannot be nested inside each other through MockServer itself - A browser's CORS preflight (
OPTIONS) for a control-plane request, such as the one a dashboard on another origin sends before each call to a server it targets, is no longer recorded as a received request. It showed up in the server's recorded requests and the dashboard, and could makeverifyZeroInteractionsfail - Dashboard: the Verify view said the response matcher checks only responses from proxied or forwarded traffic; it also checks responses mocked by an expectation, and the caption now says so. MockServer's own
404for a request no expectation matched is not counted - A streamed forwarded response whose end the upstream marks only by closing its connection (no
Content-Lengthand no chunked encoding) is now recorded as truncated when MockServer closes that connection itself before the response ends, for example when the client goes away withrecordClientClosedStreamsCompleteoff, on a response write stall, or for an error or chaos action. It was recorded as complete, so the recording, and an expectation made from it, looked like the whole response. A chunked stream was already recorded as truncated in these cases - HTTP
CONNECTand SOCKS proxying answered502whenlocalBoundIPwas set: on Linux with IPv6 when MockServer was bound to127.0.0.1, on macOS when it was bound to::1, and everywhere when it was bound to any other address of the host. The tunnel now reaches MockServer at the address it is bound to. WithoutlocalBoundIP, requests sent through a tunnel on Linux with IPv6 were recorded with::1as their local and remote addresses, and are now recorded with127.0.0.1. - Fixtures written by the
record_llm_fixturesMCP tool now redact the configured body fields (fixtureBodyRedactFieldsand the tool'sredactBodyFields) in the data of each server-sent event. A complete streamed response is saved as anhttpSseResponse, and its events were written unredacted; only a truncated stream, saved as a static body, was redacted (#2929) - When MockServer is started with a proxy remote host (
MOCKSERVER_PROXY_REMOTE_HOST,PROXY_REMOTE_HOSTor-proxyRemoteHost), the host name is now looked up for each new connection to the target, not once at startup. A target that starts after MockServer, as in a Docker Compose file, was answered with502"upstream host name could not be resolved" for about ten seconds, and a target that restarted with a new IP address was not reached until MockServer restarted. An IP address is used as before. For a host name,ClientAndServer.getRemoteAddress()andMockServer.getRemoteAddress()now return an unresolved address, so itsgetAddress()isnull; usegetHostString(). - An upstream proxy set by host name in
forwardHttpProxy,forwardHttpsProxyorforwardSocksProxy(system property, environment variable, properties file or the Spring test listener) is now looked up for each new connection to the proxy, not once at startup. A proxy that started after MockServer, as in a Docker Compose file, was never reached throughforwardHttpsProxyorforwardSocksProxy: every forward through it was answered502"its host name could not be resolved" until MockServer restarted. A proxy that restarted with a new IP address was not reached through any of the three until MockServer restarted. An IP address is used as before. For a host name,Configuration.forwardHttpProxy(),forwardHttpsProxy(),forwardSocksProxy()andProxyConfiguration.getProxyAddress()now return an unresolved address, so itsgetAddress()isnull; usegetHostString().ConfigurationProperties.forwardHttpProxy(InetSocketAddress), and its HTTPS and SOCKS forms, also accept an address given by host name, which they rejected as not being<host>:<port>.NettyHttpClient.connectBinaryRelaywith four arguments no longer reaches an upstream proxy set by host name; pass the address fromlookUpBinaryRelayTunnelProxyto the five-argument form. - A request matching a callback expectation (
respond/forwardwith a closure, over the callback WebSocket) could rarely be answered404when it arrived just after the callback was registered: MockServer acknowledged the callback WebSocket before it could route requests to it. The connection is now routable before it is acknowledged. If a client reconnects with its client id and the new connection fails to open, its existing connection now stays registered and still receives breakpoint-released notices if it asked for them; before, it was unregistered, so its callback expectations were answered404and its breakpoints were removed - Fixtures written by the
record_llm_fixturesMCP tool replayed SSE events with the wrong delays when the recorded stream had comment-only chunks, such as:heartbeat. Each event took its delay by its position among the events, not by its recorded chunk, so every dropped comment moved the later events onto earlier delays and they arrived too early. Each event now takes the delay of its own chunk, and the delays of dropped comment or blank chunks are added to the next event, so later events keep their recorded timing. A recorded delay over 1 hour is capped at 1 hour. The recorded SSE text is now read exactly as the SSE specification says: trailing spaces in a field value are kept, and a line whose field name starts with whitespace is ignored (#2946) - Fixtures written by the
record_llm_fixturesMCP tool kept MockServer's internalx-mockserver-response-time-msheader, so their replays sent it to clients. It is now removed from every fixture, streamed or not, along with the other recording headers (#2947) - Forward-proxy authentication (
proxyAuthenticationUsername/proxyAuthenticationPassword) now accepts theBasicscheme name in any letter case, such asbasicorBASIC, and one or more spaces before the credential, as RFC 7235 and RFC 7617 allow; it rejected anything butBasicfollowed by exactly one space. The credential itself is still compared exactly. Contributed by Matthew Hall (@megahall) in #2954 - With
persistRecordedRequestsToDiskon, an exchange that completed just before MockServer stopped could be missing frompersistedRecordedRequestsPath, because the file was closed before the event log had finished writing the entries still queued in it. The file is now closed after the event log drains, and the state backend is closed even if an earlier shutdown step fails. Contributed by Matthew Hall (@megahall) in #2954 - A request sent through a
CONNECTor SOCKS tunnel was recorded with MockServer's own address (usually127.0.0.1) and an unrelated port as its client address, because MockServer handles a tunnel's requests on an internal connection back to itself. It is now recorded with the address of the client that opened the tunnel (or, withtransparentProxyEnabledon, for a tunnel opened over a connection whose PROXY protocol header named a source, that source; such a header is accepted from any client unlessproxyProtocolTrustedSourcesis set), so the event log, the dashboard,request.remoteAddressin response templates andclientIpmatching in expectations and verifications see the real client, and abinaryProxyListeneris given that address for a binary message sent through a tunnel. A control-plane HTTP request sent through a tunnel to MockServer itself is likewise recorded in the control-plane audit log, and counted for Basic-authentication failure throttling, under that client's address instead of one shared entry for MockServer's own address. AclientIpof127.0.0.1no longer matches requests tunnelled from other hosts. MCP and control-plane WebSocket requests sent through a tunnel still show the internal connection's address. The address comes only from MockServer's own record of the tunnel's connection: headers such asX-Forwarded-Forand anything else sent through the tunnel cannot change it. Contributed by Matthew Hall (@megahall) in #2955