mirror-cockpit-project-cockpit/pkg
Allison Karlitskaya 99deafc66f shell: fix forwarding of iframe "init" messages
The shell currently accidentally forwards the "init" message from each
iframe to the shell, meaning an extra init message gets sent for every
page.

Based on the comments in this function about "Only control messages with
a channel are forwardable" and "Everything else gets forwarded", it
seems unintentional that init messages (which are explicitly handled and
don't have a channel) were ever intended to be forwarded.

Unfortunately, the "does it have a channel?" check is an "else if" in
the same chain of conditions as the check for `command == "init"` and
(unlike all of the other commands that are checked for) the `"init"`
case doesn't have a `return;` statement at the bottom.

As a result, we accidentally fall through to the "Everything else gets
forwarded" case and send the init message from the iframe along to the
ws.

This bug dates all the way back to the original version of the shell
added in bf2f46943b ("shell: Implement new multiple dashboards
navigation").  It went unnoticed because the websocket handling code
doesn't check if an init message was already received.

Unfortunately, because the shell is served by the bridge, we need to
support old versions of the shell indefinitely.  In order to avoid
regressions, add a test to ensure that cockpit-ws will always accept
these extra init messages.
2026-04-08 14:34:58 +02:00
..
apps pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
base1 shell: fix forwarding of iframe "init" messages 2026-04-08 14:34:58 +02:00
kdump pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
lib pkg/lib: fix qunit template 2026-03-31 13:52:05 +02:00
metrics pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
networkmanager networkmanager: Rewrite WifiConnectDialog with cockpit/dialog 2026-03-04 10:17:15 +01:00
packagekit packagekit: handle empty history after successful update 2026-02-04 10:26:00 +01:00
playground pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
selinux REUSE: Convert license headers to SPDX format 2026-02-04 10:24:11 +01:00
shell shell: fix forwarding of iframe "init" messages 2026-04-08 14:34:58 +02:00
sosreport pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
static login.js: fix a faulty check on X-Conversation challenges 2026-03-20 16:33:43 +01:00
storaged storaged: use context manager to close mtab file 2026-02-11 16:16:38 +01:00
systemd pkg: drop leftover ABRT/reportd integration 2026-02-11 14:50:43 +01:00
users pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
Makefile.am pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00
ruff.toml pkg: Add missing license declarations 2026-02-04 10:24:11 +01:00