Commit graph

2 commits

Author SHA1 Message Date
7cf8639ae3
fix(compositor): bind each app session's Wayland client to its session through appd
The compositor stored appd's (pid, session) announcements and never used
them, so no surface could be attributed to a session and any client
could claim any app ID or the panel role.

weft-appd now creates a connected socket pair for each session, gives
the app shell one end as standard input with WAYLAND_SOCKET=0 and no
WAYLAND_DISPLAY, and sends the other end to the compositor with the
session and app ID over the compositor IPC socket (SCM_RIGHTS). The
compositor inserts it as a client bound to that session: holding the
connection is the session's identity. A session's zweft_shell windows
carry its app ID, the panel and overlay roles are refused to sessions
with a new role_not_permitted error, the session's first toplevel is
reported to appd, an ended session's client is closed, and a client's
disconnection is reported. The compositor accepts one appd connection
at a time.

The counter desktop check now requires the compositor to bind the app's
client to its session and to close it when the session is terminated.
2026-10-09 15:07:33 +00:00
db712e056e
fix(appd): authorize WebSocket clients by role and session
The browser-facing WebSocket accepted requests from any local page, so a
page could launch or terminate apps and inject messages into any session.

Every connection now completes the upgrade and sends HELLO within five
seconds. The system role authenticates with a token appd writes to
$XDG_RUNTIME_DIR/weft/appd.systoken (mode 0600) and may manage sessions,
but never sees or sends application messages. The app role authenticates
with a per-session bridge token passed to weft-app-shell in
WEFT_BRIDGE_TOKEN and exchanges APP_MESSAGE envelopes with its own
session only; it is disconnected when that session stops.

weft-servo-shell hands the system endpoint only to the system UI
document and denies navigation away from it. weft-app-shell installs the
bridge only in top-level documents inside the application's UI
directory and denies navigation outside it. The launcher renders package
names as text.

tests/frame/check_counter.py drives the Counter demo end to end through
the compositor, appd, the Wasm runtime and the app shell.
2026-10-09 07:45:49 +00:00