Repository navigation
Releases
v2.38.1
This is a security release. It hardens message templating against a set of denial-of-service attacks, where a crafted template could crash the server, exhaust its memory or outrun the execution deadline in a single request. It also stops slow S3 attachment uploads and unresponsive web push endpoints from tying up memory, connections and goroutines, and applies the web push subscription limit per IP prefix. Upgrading is strongly recommended.
Security:
- Message templating: values are now checked before they are printed or JSON-encoded, so a template can no longer crash the server by printing a value that references itself, or build a huge string by printing a list of many references to one value
- Message templating:
printfonly accepts plain directives (no explicit argument indexes or%p) and no lists or dicts as arguments, and thehtml,jsandurlqueryfunctions are no longer allowed - Message templating: the execution deadline is now also enforced inside a single template action, so a long pipeline or deeply nested function calls can no longer outrun it
- Message templating: the
regexMatch,regexFind,regexFindAll,regexReplaceAll,regexReplaceAllLiteralandregexSplitfunctions (and theirmustvariants) now reject patterns longer than 1024 bytes or that compile to more than 5000 instructions, so a template can no longer make the server compile and run a huge regular expression - Message templating: limit the result size of the
cat,toPrettyJSON,concatandkeysfunctions, and the list size ofuniq,withoutandhas, so a small template can no longer build a huge string or list in a single call - Message templating: apply the iteration limit of
until,untilStepandseqto decreasing sequences too, so a negative step can no longer build an unbounded list - Attachments: buffer S3 uploads of unknown size in small chunks as data arrives, instead of allocating a full 5 MB part up front (and a second one for multipart uploads), so that slow or stalled uploads no longer pin 5-10 MB of memory each
- Web push: use a timeout for deliveries and always close the push service response, so slow or unresponsive push endpoints can no longer leak connections and goroutines; a timeout or network error no longer removes the subscription
- Web push: count the subscription limit per IP prefix (the same IPv6 /64 or configured prefix as all other limits) instead of per full IP address, so rotating addresses within one prefix no longer bypasses it
Bug fixes + maintenance:
- Stripe billing: when an abandoned checkout expires (
incomplete_expired) after the user paid for another subscription, the webhook no longer replaces the paying subscription with the expired one (#2199) - Message templating: errors in an inline message template (
X-MessagewithX-Template: yes) now name the message parameter instead of the priority parameter
v2.38.0
This release shares every visitor's rate limits across the nodes of a cluster: a client spread over several nodes is now limited once instead of once per node, and a node that restarts or crashes takes the limits over from its peers instead of forgetting them. It also fixes a denial-of-service bug in message templating, where a crafted template could build an oversized string and crash the server, and builds ntfy with Go 1.27.4 (security fixes).
Features:
- Cluster: the nodes share every visitor's rate limits (requests, failed logins, signups and password resets, topic creation, e-mails, attachment bandwidth, Firebase pauses) over the mesh every second, so a client spread over several nodes gets its limits once, not once per node; a node that restarts or crashes takes the limits over from its peers before it serves (#2182)
Bug fixes + maintenance:
- Message templating: the
replace,regexReplaceAllandjoinfunctions now cap the size of the string they build, so a template can no longer amplify small inputs into a multi-gigabyte string and crash the server with an out-of-memory error (thanks to Robert Flosbach of Neodyme for the responsible disclosure) - WebSocket subscribers that a node closes while draining are no longer counted and logged as internal server errors (HTTP 500, ntfy error 50001); on ntfy.sh, each node's drain counted ~18k of them and tripped the 5xx alert, although clients never saw an error (#2171)
Security:
- Build with Go 1.27.4, which includes security fixes to cgo, the go command, the compiler, the linker and
net/http
v2.37.2
v2.37.1
This release fixes a database slowdown in v2.37.0 when using visitor-subscriber-rate-limiting with a user database: the subscriber activity of UnifiedPush topics was written far too often.
Bug fixes + maintenance:
- With
visitor-subscriber-rate-limitingand a user database, write a UnifiedPush topic's subscriber activity every one to two hours instead of every 5 minutes, spread over time, and not at all when a poll or reconnect only repeats the same subscriber; on ntfy.sh, v2.37.0's writes of ~45k topics every 5 minutes, all due in the same minute, slowed down the database (#2151)
v2.37.0
This release makes UnifiedPush work across several servers: the subscriber who pays for a topic's pushes is shared through the database, and app servers are told with 410 Gone when a subscription has been abandoned for 4 days. It also adds Retry-After and the draft RateLimit headers to rate limit responses, and frees the memory of one-off visitors sooner.
Features:
- With
visitor-subscriber-rate-limiting, the subscriber of a UnifiedPush topic (who pays for its pushes) is kept in the user database and shared by all servers, so a push to any server is billed to the subscriber instead of answered with 507 (#2136; see subscriber-based rate limiting) - Send a
Retry-Afterheader with HTTP 429 responses that are caused by a rate limit with a known wait, e.g. the request, e-mail or daily message limits (#2142; see rate limiting) - Send the IETF draft
RateLimit-PolicyandRateLimitheaders with publish responses (and with every 429 caused by a limit with a quota), for the request and daily message limits (#2143; see rate limiting) - New metric
ntfy_topics_unifiedpush_total: the UnifiedPush topics whose subscriber state a server keeps in memory (#2136)
Behavior changes:
- With
visitor-subscriber-rate-limiting, a UnifiedPush push to a topic that has had no subscriber (subscribe, poll or open stream) for 4 days is answered with410(error code 41002) instead of507, so app servers like Mastodon remove the expired subscription (#664, #2136); a Matrix push to such a topic gets its pushkey rejected (before: after 12 hours without a subscriber on the server that got the push) - With
visitor-subscriber-rate-limiting, UnifiedPush messages are counted against the subscriber's account only while it has a tier, and against the subscriber's IP address otherwise (also after the account lost its tier or was deleted); a tier change applies to the next message (#2136) - Ban feed: weights may be fractional (down to
0.001), auth failures (42909) now weigh 2 instead of 10, and a UnifiedPush push without a subscriber (50701) or to an abandoned topic (41002) weighs 0.05, so app servers pushing to many offline phones are not banned for it (#2147) - The rate limit state of a visitor is forgotten about a minute after it has fully recovered (all buckets refilled) instead of after a day without use, which frees the memory of one-off visitors such as floods of new IPs. The
visitorsstat and thentfy_visitors_totalmetric therefore count the visitors of roughly the last minute, not of the last day (#2126) - Topics without subscribers are dropped from memory after 6 hours without use instead of 16; a publish to such a topic recreates it (and counts against
visitor-topic-creation-limit-burst) (#2136)
Bug fixes + maintenance:
- With PostgreSQL and several servers, daily usage a server counted in the last seconds of a visitor's 24-hour period is no longer added to the next period (a double count); it is dropped instead (#2136)
- Cluster: a forwarded message for a topic without subscribers on the receiving node now counts as wasted (
ntfy_cluster_messages_wasted_total) and no longer keeps that idle topic in memory (#2140)
v2.36.0
This release keeps the daily limits across restarts and, with PostgreSQL, shares them between servers, so a visitor gets one daily allowance in total. Each visitor's day now starts at its own time instead of midnight UTC. It also adds an experimental local admin socket.
Features:
- Daily limits (messages, e-mails, phone calls) are stored in the user database, so they survive restarts; with PostgreSQL, all servers share them. Each visitor's day starts at its own time instead of midnight UTC, and the account page and
/v1/account(stats.reset_at) show when it resets (#2131, see message limits) - Experimental local admin socket (
experimental-listen-admin-unix, off by default) that serves the admin API without credentials to whoever can open it; the shipped systemd unit setsRuntimeDirectory=ntfyfor it (see admin socket) - Export
ntfy_db_upper PostgreSQL pool, and health-check the primary like the replicas (#2133)
Upgrade notes:
- Everyone's daily counts start over at the upgrade: the
stats_*columns of the user table are zeroed and no longer used - Servers that share a PostgreSQL database must keep their clocks in sync (NTP)
- Visitors without a tier have a daily e-mail limit again (24h /
visitor-email-limit-replenish) - The whole server config is checked again when
base-urlor amessage-size-limitabove 4K is set, so an invalid config that used to start now fails at startup (#1969, thanks to @mikejgray for the contribution)
Bug fixes + maintenance:
- Web app: Messages replayed by a poll or a reconnect no longer bring back deleted notifications, lose their read state or notify again (#2098, #2090, thanks to @mattford63, @arminus and @tobykaspar79 for reporting)
- CLI:
ntfy pub --wait-pidnow waits for processes owned by other users instead of failing with "not running" (#1710, thanks to @bekoeppel for the contribution) - Admin API (internal): manage other users' tokens, tiers and password reset links, return 4xx instead of 500 for invalid input, and remove a deleted user's web push subscriptions
v2.35.0
This release keeps what a user already spent when their tier changes, and makes a tier's daily email limit a hard cap. It also fixes intermittent 403s under concurrent requests from the same IP, and the Matrix push gateway storing messages under a protected topic on SQLite.
Security:
- Reject Matrix push gateway requests whose push key does not name a valid topic. Publishing strips NUL bytes and invalid UTF-8 from the topic after authorization, so an anonymous push key like
/sec%00retwas authorized against an unmatched topic and then stored under the protected topicsecret(SQLite only; on PostgreSQL the request was denied; thanks to Efe Γam for reporting)
Features:
- A tier change (an upgrade, a downgrade, or a tier edited in place) applies on the user's next request and keeps what was already spent; before, it refilled the request, email and attachment bandwidth limits (#2104, #2105)
- A tier's daily email limit is a hard cap; before, the tier's email burst came on top of it, so a user could send more emails a day than the tier allows
Bug fixes + maintenance:
- Fix intermittent 403s and panics in the account handlers under concurrent requests from the same IP: a login or logout could change the user under another request, so a request with valid credentials was treated as anonymous, or the other way around. Every request now gets its own visitor (#1051, #2113, #2118, thanks to @ivanetinajero for reporting)
- A tier with a daily email limit of zero sends no emails; before, it could still send the server's email burst (
visitor-email-limit-burst) - An attachment upload rejected at a size limit is no longer charged to the attachment bandwidth limit for the part that went over
- Rate limits live in one shared limit service, keyed by
ip:<prefix>oruser:<id>, instead of in each visitor, which uses less memory per visitor and takes a global lock off the request path - Accept terabyte units (e.g.
1T) in size settings such as attachment and tier limits, matching how sizes are displayed (#2078, thanks to @cangen185-sudo for the contribution)
v2.34.0
This release prepares the experimental cluster to run behind load balancers: nodes drain on shutdown instead of dropping all of their clients at once, ntfy can listen on several addresses, and access changes reach every node. It also fixes a revoked or deleted user keeping some of their subscriptions, on every server.
Features:
- Allow several comma-separated addresses in
listen-http, so a load balancer can hold more than ~63k connections to one ntfy node - Cluster nodes drain on shutdown: an active node withdraws (stops being ready), then turns read-only and closes its subscriber connections gradually (
experimental-cluster-drain-delay,experimental-cluster-drain-duration), so its clients move to the other nodes without a reconnect storm (experimental, see draining on shutdown)
Security:
- End all of a user's subscriptions when their access to a topic is reset or the user is deleted: only the first one was ended, so the others kept receiving the topic's messages (#1845, thanks to @gigioneggiando for reporting)
- In an experimental cluster, tell the other nodes when access changes (e.g. a reservation or a revoked permission), so they reload their access cache and disconnect subscribers who lost access; the access cache reload also catches changes made elsewhere, e.g. by the
ntfy accessCLI, and now runs every 67 seconds instead of 87
Bug fixes + maintenance:
- Fix a deadlock when ending subscriptions (reserving a topic with live subscribers, revoking access, deleting a user) while debug logging or
log-level-overridesis on: the subscriptions' topic stayed locked for good - Fix a data race when
log-level-overrideschanges (e.g. on a config reload with SIGHUP) while the server logs
v2.33.1
This release builds ntfy with Go 1.27.3 (security fixes, including rejecting the compromised eMudhra intermediate CAs), and adds monitoring for the experimental cluster: each node's view of its peers, per-peer and database connection pool metrics.
The v2.33.0 release had an issue that made it crash on older CPU architectures. The v2.33.1 release fixes that (see #2092).
Features:
- Show each cluster node's view of its peers with
ntfy cluster status,/v1/cluster/statuson the cluster listener, and per-peer metrics, so a link that only works in one direction is visible (experimental clustering, see cluster status) - Export PostgreSQL connection pool metrics (
ntfy_db_pool_*: connections in use, and queries that waited for a free connection, per pool), to sizepool_max_conns(see PostgreSQL)
Security:
- Build with Go 1.27.3, which includes the security fixes of Go 1.27.2 (
crypto/tls,net/http,html/templateand others) and 1.27.3 (crypto/x509: certificate chains through the compromised eMudhra intermediate CAs are rejected) - Reject phone number verification unless Twilio confirms the code as approved, instead of accepting any successful response
- Ignore duplicate topics in a subscription and limit a subscription to 150 topics, so a single request cannot replay the same topic's cache over and over
Bug fixes + maintenance:
- Count published messages from every cluster node: each node adds its own publishes to the stored total instead of the leader overwriting it with its own count (experimental clustering)
- Fix "Illegal instruction" crash of the amd64 binaries on CPUs without x86-64-v3 (AVX2/BMI2), by building releases on Ubuntu 24.04 again (#2092, thanks to @frank-bg for reporting)
v2.32.0
This release prepares ntfy.sh for a passive cluster node: jobs that write to the shared database run only on the cluster leader, and each database store now records the oldest schema version it works with. Streaming subscriptions also tell proxies not to buffer them.
Features:
- Set the
Incremental: ?1header (RFC 10036) on streaming subscriptions, so proxies that support it forward messages without buffering (#2056, thanks to @bt90 for the suggestion)
Bug fixes + maintenance:
- Fix template files (
?tpl=<name>) ignoring the priority sent with the request when the file has noprioritykey (#2045, thanks to @6801318d8d for reporting) - Return HTTP 409 instead of 500 when deleting or changing the password of a user provisioned via
auth-usersthrough the admin API (#2062, thanks to @daniloamiranda for reporting) - Run the shared-database housekeeping (pruning expired messages, attachments and tokens, web push expiry warnings, writing the published-messages total) on the cluster leader only, so a passive node no longer overwrites the total with its own count (experimental clustering)
- Record the oldest schema version each database store still works with, so an older ntfy refuses to start on a database that a newer version migrated in a breaking way, instead of misreading it; none of today's migrations are breaking (#2060)