The mod_websocket continuation-frame patch accumulated fragments in an
unbounded dataBuffer with no size limit, fragment count limit, or
timeout. A buggy or malicious client sending endless continuation
frames without FIN could exhaust memory and degrade the entire server.
Add a configurable websocket_max_message_size option (default 2 MB)
that closes the connection with code 1009 ("Message too big") and
resets the buffer when exceeded. Also add wss-perf-analysis.md
documenting the WebSocket performance and drop investigation.
Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/8>
4.4 KiB
4.4 KiB
Prosody source patches
Unified diffs against pristine prosody-0.12.6, applied in the Dockerfile builder stage with
patch -p1 from the extracted source root, before ./configure && make install. Paths inside
each patch (a/... / b/...) are relative to the source root, so no separate mapping file is
needed. patch --fuzz=0 is used so any upstream drift fails the build loudly instead of
half-applying.
To change a patch: extract the pristine tarball, apply all patches, edit, and regenerate with
diff -u pristine/<path> patched/<path> (keep the a/<path> / b/<path> header form).
Patch intent
| Patch | Target | What it does / why |
|---|---|---|
mod_carbons.patch |
plugins/mod_carbons.lua |
Hook vnc-rest-message (fired by mod_http_rest) so REST-injected messages are carbon-copied. |
mod_mam.patch |
plugins/mod_mam/mod_mam.lua |
Archive REST-injected messages (vnc-rest-message hook, stored under the sender); always store (shall_store → true, because users live in the external HTTP auth backend so user_exists() can't be trusted); only archive stanzas with a <body>. |
mod_muc_mam.patch |
plugins/mod_muc_mam.lua |
Keep MUC archives when a room is destroyed (upstream deletes them). Expiry/cleanup needs no patch since 0.12: muc_log_expires_after = "never" (set in the config template) disables the whole cleanup path upstream. |
mod_muc.patch |
plugins/muc/mod_muc.lua |
Route iq-set/bare/xmpp:vnctalk:unregister:query to the new handle_unregister_iq (see register.lib.patch). |
register.lib.patch |
plugins/muc/register.lib.lua |
Add handle_unregister_iq: fires vnc-muc-kick (consumed by mod_vnc_track_kicks) and removes the requester's room affiliation. |
muc.lib.patch |
plugins/muc/muc.lib.lua |
(a) broadcast() also routes to offline remote affiliated members; (b) suppress the unavailable self-presence in publicise_occupant_status; (c) let owner/admin/member post to a room without being a present occupant (bypasses the muc-occupant-groupchat event and its not-in-room rejection); (d) fire muc-config-sub-mitted on config changes — consumed by an external service. |
hidden.lib.patch |
plugins/muc/hidden.lib.lua |
Hide the "publicly searchable" room config option for everyone when public rooms are restricted (upstream exempts admins). |
mod_muc_unique.patch |
plugins/mod_muc_unique.lua |
Rework muc#unique handler; answer item-not-found for bare-JID requests. |
mod_websocket.patch |
plugins/mod_websocket.lua |
Re-add WebSocket continuation-frame (fragmented-message) support that was removed upstream in the 0.12/13.0 rewrite. VNCtalk clients fragment large WebSocket messages (e.g. vCard sets with avatars >~64 KB); 13.0.6's validate_frame hard-rejected any frame with FIN=false (close code 1003) silently — no log was emitted because the rejection fired on the partial-frame path before handle_frame was reached, and websocket_close() itself does not log. This patch removes the blanket not frame.FIN rejection from validate_frame and restores the dataBuffer fragment-accumulation logic from 0.11.6 inside handle_frame: text frames (opcode 0x1) with FIN=false start a buffer, continuation frames (opcode 0x0) append to it, and the concatenated data is returned only when a frame with FIN=true arrives. The accumulated size is capped by the configurable websocket_max_message_size option (default 2 MB, 2×1024×1024); if exceeded the connection is closed with WebSocket close code 1009 ("Message too big") and the buffer is reset, preventing unbounded memory growth from buggy or malicious clients that never send a FIN frame. |
Patches removed at the 0.12.6 upgrade (M1)
moduleapi.patch(module:open_host_store) — the two consumers (mod_vnc_muc_fcm,mod_vnc_muc_fcm_hin) now callrequire "core.storagemanager".open(host, name, type)directly.mod_admin_telnet.patch/portmanager.patch(bind telnet console on*) — replaced byconsole_interfaces = { "*" }in the config template.- The operator-precedence hunk formerly in
muc.lib.patch— fixed upstream in 0.12. - The
dumpTable/table_clonedebug helpers and info-level log spam formerly carried in several patches — dropped; they had no functional effect.
See upgrade-plan.md in the repo root for the per-version disposition of every patch.