Skip to content

v1.1.7

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Dec 20:50
d24292e

Community

Mercure 1.1.7 is the fastest and most secure Mercure yet. It fixes 13 vulnerabilities found by Anthropic's OSS Scanner, 5 of them rated high, and delivers up to 2.5x more updates per second on 2.5x less CPU. All users should upgrade.

⚡ Up to 2.5x Faster

Two changes compound in this release:

  • Faster URL Patterns: go-urlpattern 1.2.0 and its URL parser, whatwg-url 0.9.1, test a topic against a URL Pattern 4 to 5x faster with 87% fewer allocations, and compile patterns 2x faster. URLs that took 10 ms to parse now take 0.1 ms. See the go-urlpattern 1.1.0 release.
  • Batched writes: the hub now writes every update already queued for a subscriber, then flushes once, instead of paying one write syscall per update and subscriber. Each update keeps its own dispatch_timeout, and a batch never writes past the token's exp. by @dunglas in #1500

1.1.6 and 1.1.7 compared on Linux (Docker, arm64), hub pinned to 5 CPUs and the load generator to 5 others, 1,000 subscribers, medians of 5 runs (3 for Bolt replays), no lost delivery:

Scenario 1.1.6 1.1.7
Broadcast to URL Pattern subscribers: throughput 1,230,000 deliveries/s 2,180,000 deliveries/s (1.8x)
Broadcast: hub CPU time 4 s 2.2 s (1.8x less)
Broadcast: delivery p99 75 ms 24 ms (3.2x lower)
200 URL Patterns, every topic new to the hub: throughput 2,700 updates/s 6,900 updates/s (2.5x)
200 URL Patterns: hub CPU time 9 s 3.5 s (2.5x less)
200 URL Patterns: delivery p99 16 ms 8.5 ms (1.9x lower)
Bolt history replay, 900 updates: duration 0.71 s 0.32 s (2.2x faster)
Bolt history replay: hub CPU time 3 s 1 s

The security fixes add no measurable cost: exact-topic, private and Bolt fan-out at 2,000 updates/s use the same CPU time with the same or lower latency.

🔒 Security Fixes

High:

  • URL Patterns: crafted URL Patterns could stall publishing for seconds or pin hundreds of MB of memory. Costly regexp groups are now refused, and the URL Patterns of a subscribe request or a token may total 8 KiB. (GHSA-67jq-5q8f-jmgr)
  • Subscription events: any subscriber could burn CPU and fill the disk with subscription events. The matchers of a subscribe request may now total 16 KiB, and the Bolt transport keeps the last 10,000 updates when size is unset. (GHSA-p2f7-8293-4xm5)
  • Subscription API: clients that stopped reading responses could exhaust the hub's memory. Responses are now streamed, and stalled clients are dropped after dispatch_timeout. (GHSA-65rj-8f2v-m5g4)
  • Subscribe: HEAD requests and subscribe requests with a body could hold connections. The hub now discards these bodies, within max_request_body_size, and answers HEAD without subscribing. (GHSA-qcrf-69wp-qjjr)
  • Topic matcher cache: cached matchers kept whole subscribe requests in memory after the subscriber left. (GHSA-hghw-8gfj-4rp7)

Medium:

  • History replay: a replay could cost seconds of CPU. It now runs at most 100,000 URL Pattern and URI Template tests. (GHSA-2xqh-6298-gj5c)
  • URL Patterns: topics with long URL authorities cost 9 ms per evaluation. Fixed by go-urlpattern 1.2.0. (GHSA-5j9m-v57p-f6vh)
  • Token expiration: a client delaying its request body could publish or receive updates after its token expired. (GHSA-cw7q-6w8c-mjg4)
  • Logs: unauthenticated requests produced log lines 230 times larger than ordinary refusals. (GHSA-cqv7-w268-p9c3)
  • Event IDs: a scoped publisher could choose IDs that made other subscribers miss updates on reconnect. Publisher-supplied IDs must now be printable ASCII, without leading or trailing spaces. (GHSA-3x23-68w2-896q)
  • Compatibility mode: dot segments in topics bypassed publish grants and selectors. (GHSA-2ppf-g46w-9jj9)
  • Audience: a malformed request host could change the expected token audience. (GHSA-r82r-f2cw-mv9r)

Low:

  • HTTP/3: failed writes to subscribers were ignored, allowing event forgery over HTTP/3. (GHSA-p333-8q9m-78p5)

Some fixes change defaults or reject inputs accepted before: read the 1.1.7 upgrade notes before upgrading.

✨ New Features

  • The hub warns at startup when publish_origins lists null, which lets sandboxed iframes, data: URLs and local files publish with a user's cookie. by @dunglas in #1498

🐛 Bug Fixes

  • Caddy: with playground on, / no longer redirects to the debugger, so applications sharing the site block, such as FrankenPHP's php_server, keep their home page. by @dunglas in #1487
  • Caddy: a dev hub (playground) now exits in about a second. by @dunglas in #1473
  • Errors for malformed origins such as NULL now quote the origin. by @dunglas in #1499

🔧 Internal Improvements

  • Replace gorilla/mux with Go's http.ServeMux and unrolled/secure with a small wrapper, and tighten the security headers. Unclean paths now get a 307 redirect, and code mounting SubscriptionsHandler or SubscriptionHandler on another router must set the path values. by @dunglas in #1489

📦 Dependencies

Enterprise

Mercure Enterprise 1.1.7 ships every security fix and performance improvement above. On Mercure Cloud and with the provided rate-limit.Caddyfile, QUERY subscriptions now count against the subscribe rate limit and the plan's concurrency limit, as GET subscriptions already did. Release archives are published to the S3 mirror again.

Mercure Cloud hubs are upgraded automatically: use Mercure Cloud to get security fixes like these without managing upgrades yourself.

Enterprise releases ship under the Enterprise SLA, with prioritized security patches and direct support. Contact contact@mercure.rocks for the managed Cloud offering, on-premise licenses, custom development, consulting, and training.

Full Changelog: v1.1.6...v1.1.7