The launcher button, app icons and taskbar entries were custom elements
with click handlers only: none could be focused, named or activated from
the keyboard, and the launcher overlay neither took nor returned focus.
They are now buttons with accessible names and a visible focus ring. The
launcher is a modal dialog that a Super tap or the Apps button opens
with focus on its first app; Tab moves between apps, Enter opens one and
Escape or another Super tap closes it, returning focus to the Apps
button. Each taskbar entry has an activate and a close button reachable
with Tab, and focus moves to a remaining control when an entry closes or
goes away. Notifications, including the offer to force quit, are
announced as status.
Servo does not tell the document when its window loses keyboard focus,
so weft-servo-shell calls window.weftShellBlurred() then and the launcher
closes; the next Super tap opens it again. Servo does not evaluate
prefers-reduced-motion either, so the page has no transitions.
tests/frame/check_system_ui.py drives the real page on the nested
desktop with keys: opening apps from the launcher, reaching the shell
with a Super tap from an application, a Super chord that stays with the
app and leaves no Super modifier held there, activating and closing apps
from the taskbar, the launcher closing when the shell loses focus, and
toggling it. It fails without the compositor's Super handling or the
focus-loss call.
weft-pack approve read only the user store, so an app in the system
store, or installed as a verified image, could not be approved. The
remedy the launch refusal named also did not work.
approve now resolves the package in weft-appd's store order. It also
accepts the capabilities by name, which is how an image is approved,
since weft-pack cannot read its manifest.
An install or rollback without --approve now drops approvals for
capabilities the package no longer declares. A capability declared
again later therefore asks again. Both commands report what still needs
approval. weft-appd validates capabilities without side effects first,
then refuses unapproved ones, then derives grants, so an unsupported
capability is reported as such and not as one needing approval. The
docs state that approvals are per user.
Every capability a package declared was granted at launch, so a signed
package received all the permissions it asked for. Blueprint 5.2 rules
that out.
A package now gets only the capabilities the user approved. weft-pack
install --approve approves those the installed package declares, and
weft-pack approve <id> approves those of the installed app later.
Without approval, install lists what still needs it. The approval is
recorded in $XDG_DATA_HOME/weft/approvals/<id>. weft-appd refuses to
launch an app declaring a capability the record does not hold, with
403 and the capabilities named, after refusing unknown or unsupported
ones as before.
An update that declares a new capability needs approval again, and
uninstalling forgets the approval. Private app data is a minimal
execution resource and needs no approval, so Notes and the existing
fixtures are unchanged.
Unit tests cover the approval record, install and approve, an update
adding a capability, uninstall, and appd refusing and then launching.
tests/frame/check_update.py launches a real app declaring notifications:
it is refused until weft-pack approve, then runs.
The documentation range was matched as 3ff0::/12 instead of 3fff::/20,
which also refused unallocated global space. ORCHIDv2 (2001:20::/28)
was missing. IPv4-translated addresses are now judged by the IPv4
address they carry. Tests cover the NAT64 /32 outside the well-known
/96.
The public-address check missed several kinds of IPv6 address:
- IPv4-compatible and 6to4 addresses carrying a private IPv4 address;
- site-local, Teredo, local-use NAT64, discard-only, benchmarking,
ORCHID and documentation ranges.
It also refused all well-known NAT64 addresses, which would break every
named grant on a DNS64 network.
Addresses carrying an IPv4 address are now judged by that address, and
the special-purpose ranges are refused. The HTTP client is told never to
take a proxy from the environment, since it would connect to the proxy
rather than to the checked address.
Path parsing drops '.' components, empty components and a trailing '/'.
A request like dir/. was therefore accepted, and a write renamed over
the directory itself instead of failing. The path text is now checked as
given.
Other fixes:
- A replaced file keeps its permission bits.
- A connection's slot is released even when its handler panics.
- Connections close after 60 seconds without a request.
- Temporary files get unique names and are not listed.
- A request of exactly the line limit is accepted.
A new test swaps a link between a directory inside the granted root and
one outside while reads and writes run, and checks that nothing outside
is read or written.
weft-appd no longer sets WEFT_FILE_PORTAL_SOCKET for the runtime, which
no longer reads it.
A fetch grant for a host name, or for any host, let a component reach
this machine and the local network whenever the name resolved there. A
granted name could therefore be pointed by DNS at loopback, link-local
metadata or private services.
The runtime now resolves each destination itself. It passes only the
allowed addresses to the HTTP client, so the address checked is the one
connected to. Names and the wildcard reach only public unicast
addresses. An IPv4 address named in a grant is still reached as
declared. Credentials in a URL are refused.
tests/runtime/check_grants.py runs the real component and checks these
refusals: the local server through the wildcard, the name localhost,
and credentials in a URL. The server records that none of the refused
requests reached it.
The portal normalised a request path to check it against the granted
directories, but then operated on the raw path. A link inside a granted
directory, followed by '..', therefore reached files outside it. Links
pointing outside were followed too.
Each granted directory is now opened once. Every request is resolved
beneath that descriptor with openat2(RESOLVE_BENEATH | NO_MAGICLINKS),
so the kernel keeps the operation inside the directory even when links
are replaced while it runs. Paths with '.' or '..' components are
refused.
Other changes:
- Writes replace the file atomically and no longer create directories.
- Files are limited to 16 MiB, listings to 10,000 entries, request
lines to the size of a full write, and the portal to 4 concurrent
connections.
- The runtime no longer passes the portal's socket path to components,
which cannot reach it.
The test also covers the refusal reported when no other store has the
app. The new comment states that a package found and then refused is not
replaced by another store's copy. The architecture doc says that a
re-signed copy of the same content is visible at once.
Installing the same content with another signature file gives the same
revision name. The existing revision, possibly the active one, was
removed before the new copy was renamed into place, so a failure in
between left the store link pointing at nothing. The new copy now
replaces it in one exchange.
If an activation fails before its switch, the kept rollback link is
restored, and dropping a stale rollback link is flushed. The staging
claim is released once the copy is placed, so launches are not refused
while the operation finishes. A launch now passes over a store whose
entry for the app is unusable, as the listing does.
An update of a package directory from before revisions removed it
together with the app data an earlier weft-appd kept in its data
directory. That data is now moved out under the uninstall rules first,
or the update stops.
A failure after the store link was switched removed the new revision
while the link pointed to it. The switch is now the commit point;
cleanup after it is left to collection.
Other fixes:
- A revision is reused only when its content and signature file match.
- The revisions directory is flushed before activation.
- A rollback link is not inherited by a new installation, and rollback
refuses a link to the active revision.
- Staging and unpacking directories are held while in use, so another
operation never collects them.
- weft-appd refuses a launch, instead of waiting, while a package
operation holds the revision.
- Listings read only an app's active package.
An installed package could not be updated: install refused it, and
uninstalling and reinstalling it was neither atomic nor safe for running
sessions, which read files from the package directory.
A package is now staged, checked, verified, admitted and flushed. It is
then renamed to an immutable revision named by its content digest,
<store>/.revisions/<id>/<digest>, and activated by one rename of the
link <store>/<id>. A failure or interruption at any point leaves the
previously active revision active, and a failed first installation
leaves nothing installed. The revision active before an update is kept,
and weft-pack rollback makes it active again after checking it against
the owner record. Other revisions are collected by later operations on
the app, unless a session still runs from them. Leftovers of interrupted
operations are collected too.
weft-appd follows the store link only to one of the app's own
revisions. It runs a session from the revision directory and holds a
shared lock on it for the session's lifetime, so an update, rollback or
uninstall never changes or removes the bytes of a running session. A
package directory from before revisions is still read. An update
replaces it in one exchange, and only while no session runs from it.
A stop requested while a session was starting could still be queued
when the app shell reported ready. The session was then shown as
running and asked to close, instead of being stopped. The supervisor
now checks for that request before it marks the session running.
Stop requests use a small bounded queue. A repeated request on a
stopping session is neither queued nor broadcast again; only a forced
one is sent. The taskbar's Force quit returns to a normal close when
the entry is activated, or 20 s after it is offered.
An application with the ask close policy could decline every close, and
nothing could end it. TERMINATE_APP now takes force, which terminates
the session without asking. The taskbar offers it as Force quit once an
app has had longer than the close timeout to answer.
The close interaction now comes before Running -> Stopping, as blueprint
6.2 requires. The session stays running while the application answers,
and a declined close no longer moves Stopping back to Running. Stop
requests reach the supervisor on a channel, so a repeated or forced
request during the close wait is seen without registering again. A
declining window is brought to the front, so its prompt is visible. A
clean exit after a close request is recorded as a close on request. A
decline report is recognised after page output that lacks a newline.
Notes keeps a pending Save and close when asked again. It saves text
typed during that save before closing, and reports when it cannot save
because it is not connected.
A package declares its unsaved-change policy in [ui].close. With
"ask", the app shell dispatches a cancelable weftclose event before
the window closes and waits up to 2 s for the page. A page that
cancels the close keeps running, and the app shell reports this to
weft-appd with its readiness token, which returns the session to
running. The page closes itself later with window.close().
Notes declares "ask". With unsaved changes it offers Save and close,
Close without saving, and Cancel. It closes after a save only once the
save is acknowledged. The taskbar shows a declined close as running
again.
TERMINATE_APP broadcasts the Stopping state, so every system UI marks
the entry. A closing taskbar entry is marked once and no longer sends
ACTIVATE_APP. The docs describe which stopped sessions are kept.
A repeated TERMINATE_APP during the close wait no longer removes the
session from the registry. The close wait also watches the runtime and
the IPC relay, and reports a failed app shell exit as a failure rather
than a close. A session being closed is not saved for restore, only the
32 most recent stopped sessions stay registered, and the taskbar shows
an entry as closing until its session stops.
TERMINATE_APP, which the taskbar sends, killed the session's processes
at once, so an application had no chance to finish, for example to
save. A running session is now asked to close through the compositor
(AppCloseRequest, which sends xdg_toplevel close to its windows) and
the app shell is given five seconds to exit by itself before what
remains is terminated. The stop reason records whether the app closed
or was terminated after the timeout. TERMINATE_APP replies stopping and
the session stays registered until it settles; a starting session is
stopped at once, and appd shutting down terminates sessions without a
close.
check_counter.py requires the compositor to ask the session's window
to close and the app shell to exit with status 0 on the close; a unit
test requires an app that ignores the close to be terminated after the
timeout and not before.
There was no compositor-owned way to close an application window. Alt+F4
is now taken by the compositor: it sends xdg_toplevel close to the
focused application window, never the panel, and the key does not reach
the client.
Closing exposed a crash in both Servo hosts: their shell-protocol
client, created on winit's Wayland display, was dropped after that
display was torn down, so wl_proxy_destroy touched freed memory and
the process ended with SIGSEGV. The hosts now release Servo and the
shell client in winit's exiting handler, while the display is alive.
check_activation.py closes the focused application with Alt+F4 and
requires its session to stop with the app shell exiting with status 0,
the window to disappear, and Alt+F4 with the panel focused to leave
the panel in place.
Laying windows out re-mapped every application window, which smithay
puts on top, so a session mapping another window, an exclusive zone
change or an output resize pushed the shell's home back under the
applications while it kept keyboard focus. Placement now re-maps every
window in its current order. Panels are lowered only when they
register, and a window that maps without taking focus goes beneath the
window in front, so a session cannot cover the shell's home or another
application by creating windows. A panel's zweft window that is
destroyed while its surface lives also removes its window slot.
With applications filling the work area, the system UI's launcher, drawn
in the panel beneath them, could not be seen while any application was
open. Clicking the panel now brings it to the front as the shell's home
until an application is activated again.
A panel that is destroyed, or whose client goes away, releases its
reserved strip and the applications are laid out again; dead panels no
longer count toward the work area, so a restarted shell does not reserve
the strip twice. A work area is never configured with a zero size. The
zweft_shell configure for an application window, at creation and in
reply to set_geometry, reports the work area the layout gives it, and a
panel's reports the output.
check_activation.py now clicks the taskbar strip, requires the panel to
cover both applications, and activates one back.
Application windows opened at the client's default size at the origin,
so one as large as the output hid the taskbar with no way back.
zweft_shell_window_v1 version 3 adds set_exclusive_zone: a panel
reserves a strip along an output edge, and other windows get the new
invalid_exclusive_zone error. weft-servo-shell reserves its 48-pixel
taskbar at the bottom (TASKBAR_HEIGHT, matching --taskbar-height in the
system UI). The compositor computes the work area as the output less the
reserved strips and configures every application window to fill it,
again when the output or a reservation changes.
The desktop harness now uses a 1400x900 X screen so the nested
compositor's whole 1280x800 output is captured. check_activation.py
requires both applications to fill the work area and end at the
reserved strip; check_notes.py finds the Discard button from the window's
right edge and check_confinement.py samples its probes from the measured
page instead of a fixed 800x600 window.
When the focused window closed, keys went to a dead surface until the
next click; the topmost remaining application window, or the panel,
now gets focus. Only a session's first window takes focus when it
maps, so a client cannot take keystrokes meant for another application
by creating windows. A panel is fitted and kept beneath however the
shell orders its requests, and focusing the panel clears the
applications' activated state. ACTIVATE_APP is refused while the
compositor is not connected rather than queued.
check_activation.py now also ends the focused application and checks
that keys reach the remaining one.
The system shell's panel was an ordinary toplevel at winit's default
size, stacked by map order with the applications, and clicking or the
taskbar could never bring an application back to the front.
The compositor now sizes the panel to the output and keeps it beneath
every application window. A newly mapped, clicked or activated
application window is raised, marked activated and given keyboard
focus. weft-appd accepts ACTIVATE_APP for a running session and asks
the compositor to activate that session's window (AppFocusRequest),
and the system UI's taskbar entries send it when chosen.
check_activation.py runs the system shell with a solid panel page and
two test applications: the panel fills the output beneath them, each
launch comes to the front with keyboard focus, ACTIVATE_APP switches
between the sessions with focus, and activating a session that is not
running is refused.
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.
weft-pack install copied any package into the store: signatures were
never checked, no key was trusted for anything, any publisher could
install over another's app ID and reach its retained data, and the
signing inventory followed symbolic links, so a package could sign and
install files from outside itself.
Installation now requires a signature by a key in the trust store
($XDG_CONFIG_HOME/weft/trusted-keys and /etc/weft/trusted-keys, or
$WEFT_TRUSTED_KEYS alone). Unsigned or untrusted content installs only
with --dev, recorded as development content. The package is copied
into the store, checked and verified on that copy, and renamed into
place, so the verified bytes are the installed bytes.
The first installation of an app ID records its owner beside the app
data; later installations must have the same owner, so neither another
publisher nor a development build can take the ID over. The record
outlives uninstall while app data remains.
The content digest moves to weft_ipc_types::trust and refuses links,
special files and non-UTF-8 paths; it keeps the existing inventory
format, and both committed demo signatures still verify. Catalogs list
only directories named after their package ID. The security guide
described a signature over wapp.toml and app.wasm only; it now
describes the full inventory and the trust and ownership rules.
- A verified image in any store now takes precedence over a directory
install in any store, so a user's directory cannot shadow a system
image of the same app.
- The package root must be a directory and wapp.toml a regular file,
not links to content outside the root the entries are checked in.
- Incomplete or malformed image metadata is refused with 403; a
missing helper, a failed mount or an unreadable manifest with 500.
- A supervisor test records the arguments of both children and
requires the resolved component and UI document.
The documentation states that the root hash is read from the store
and not yet authenticated.
The runtime, the app shell and grant derivation each searched the
package stores and parsed wapp.toml on their own, so they could use
different roots; the runtime ignored [runtime].module, the image loader
looked for companion files the builder never wrote, and a failed image
mount fell back to the mutable directory install.
weft-appd now resolves a launch once: a verified image wins over a
directory in the same store, and when any image file exists the image
must mount or the launch is refused. The manifest must declare the
requested ID, and both entries must be plain relative paths to regular
files without links. The runtime receives --module and the app shell
--ui; neither looks for the package. Grants come from the same
manifest, and the mount belongs to the session.
The manifest parser and the image file names move to weft-ipc-types,
shared with weft-pack, whose check now applies the same entry rules.
Mapper devices are named after their per-launch mountpoint, so
concurrent sessions no longer collide.
Review of the renderer policy found loads it did not see or judged
wrongly:
- Loads Servo does not attribute to the webview, such as
navigator.sendBeacon(), reached the network. They are all refused.
- On a redirect Servo reports the first URL again, so every redirect
is refused.
- A symbolic link inside the UI directory led anywhere on disk; file
loads are checked again after resolving links.
- Only about:blank is allowed among about: URLs.
The Servo pin moves to 5d90f51, which keeps compiled classic scripts
rooted until they run (a parser-blocking script waiting for a failed
stylesheet import crashed the content process) and withholds
navigator.servo from about:blank and about:srcdoc documents.
The confinement check gains probes for links, workers, beacons,
imports, fonts and srcdoc frames, and its WebSocket server completes
the handshake. The slow stylesheet's delay now starts when the host
first tries to open it.
An application page could load any local file through file: URLs and
reach any network destination with images, fetch, XHR or WebSockets,
bypassing the component's fetch grants. The shell now checks every
resource load: files inside the UI directory, inline data:, blob: and
about: resources and the session bridge are allowed; anything else
fails with a network error before a request leaves the renderer.
tests/frame/check_confinement.py probes each path on the nested desktop
and requires that no HTTP request or TCP connection reaches the host.
The frame check's slow stylesheet becomes a file next to the page held
back with a file lease, so it stays inside the confined scope.
IPC_FORWARD held the registry lock while awaiting a send to the
component; with a full queue it stalled appd, and once the relay was
closed it locked the registry again and deadlocked. It now sends without
waiting and reports an error when the session has no relay or its queue
is full.
A relay whose component disconnected left the session running with no
way to exchange messages. The session now stops when its IPC connection
closes. The relay releases its task and socket when dropped, so a
cancelled supervisor leaks neither, and the socket is created with mode
0600.
New tests fail against the previous code: IPC_FORWARD against a missing
relay and a full queue must answer at once, and a runtime that closes
its IPC connection while still running must end its session. The test
runtime directory lives under target/ instead of one directory per run.
dispatch opened each session's IPC socket and registered its sender
before the supervisor existed, and nothing released them: a relay whose
runtime never connected waited forever with its socket file in place,
and every stopped session left its sender registered, so app messages
for it were still accepted and queued.
The supervisor now opens the relay after its early checks, and the
session owns it: every exit path stops the relay task, removes the
socket and unregisters the sender. A session whose socket cannot be
opened does not start. The relay accepts a single connection.
A dispatch-level test launches a package whose runtime reports ready
and exits without connecting; it requires the stopped session to leave
no sender and no socket, and fails against the previous code. The
Counter and Notes checks pass end to end.
weft-pack uninstall moved earlier app data only when the package
manifest could be read and declared an app-data capability, and only
when the store path was spelled exactly as the user store; otherwise it
removed the package directory with the data in it. A directory left
holding only data by an earlier weft-appd, which has no manifest, was
deleted that way.
A data directory is now never removed with a package. In the user
store, recognised by its real location rather than its spelling, it is
moved when the package declares app data or its manifest cannot be
read; in every other case uninstall stops and changes nothing. Tests
cover a directory holding only data, a store reached through '..', a
symbolically linked home, an app without the capability and another
store.
weft-appd reports both locations when a move fails with an I/O error and
creates the data directory with mode 0700 instead of tightening it
afterwards.
weft-pack treated any top-level data directory in a package as app
data from the earlier layout, in every store and for every app: a
package shipping data/ lost that content to the app data directory on
uninstall and could then no longer be uninstalled. Data is now moved
only from ~/.local/share/weft/apps/<id>/data, the only place earlier
versions wrote it, and only for packages declaring an app-data
capability; packages may no longer contain a top-level data entry.
The move left an empty package directory behind, which then blocked
weft-pack install although nothing was listed; an emptied package
directory is now removed, and install accepts an empty leftover. The
rename uses RENAME_NOREPLACE, so a target created after the check is
reported as a conflict instead of being replaced, and a move across
filesystems is refused with a message naming both locations instead of
a bare OS error. Directories moved by weft-pack are made private too,
and a symbolic link at the target is refused rather than followed.
The system UI now shows launch refusals, which it only logged, and the
weft-appd unit may write under ~/.local/share/weft, which
ProtectSystem=strict made read-only. check_app_data.py also types into
Notes after the move and requires the save to reach the moved file, and
checks that no empty package directory remains.
App data lived in ~/.local/share/weft/apps/<id>/data, inside the user
package store under the installed package directory. Uninstalling a
package deleted its data, and launching a package installed elsewhere
created that directory, after which installing the package for the user
failed because its directory already existed.
App data now lives in $XDG_DATA_HOME/weft/app-data/<id>, one shared
rule in weft_ipc_types::package, and is made private (0700) on every
launch. Data in the earlier location is moved there in one rename on the
first launch with an app-data capability, and by weft-pack before it
uninstalls a package or installs over a directory holding only data. If
both locations hold data, nothing is moved: the launch is refused with
409 and weft-pack stops, so neither copy is lost or merged.
tests/frame/check_app_data.py launches the Notes demo on the nested
desktop with notes in the earlier location and checks that they arrive
byte for byte (including a literal backslash sequence and non-ASCII
text), that the old directory is gone, that the new one is 0700 and that
a second copy makes the next launch fail with 409 without changing
either. The weft-pack tests that change the environment now share a lock.
A component with a host-specific fetch grant could reach another origin
by setting its own Host header, and could inject request lines through
the method string, which ureq writes unvalidated. Fetch now accepts only
standard methods and refuses Host, framing and hop-by-hop headers. Fetch
grants accept canonical DNS names and dotted IPv4 addresses only, so a
grant can never be written in a form that silently never matches.
--preopen split host and guest at the first `::`, so a host path
containing `::` widened the preopened directory; it now splits from the
right, and appd refuses host paths that are not UTF-8 or contain `::`.
appd validated capabilities one at a time, creating the data directory
before a later capability was refused, and required HOME even for
packages without filesystem capabilities. It now checks every capability
first, resolves host directories only when needed, validates the app ID
with the rule weft-pack uses (now shared in weft_ipc_types::package), and
reports 400, 404, 403 or 500 according to the cause. user-dirs.dirs is
read as a shell would: the last assignment wins, $HOME must be followed
by a slash, escaped values are ignored and a relative XDG_CONFIG_HOME is
not used.
The grants probe now also overwrites, renames, removes and creates
directories in read-only data, and sends a forged Host header, an
injected method and a file: URL; it fails when directory permissions of
a read-only preopen are widened or the header check is removed. A new
CI job builds the runtime with its engine and fetch support and runs the
check. The mount test that sets WEFT_APP_STORE now holds the env lock.
Package images are still located separately from directory installs;
deriving grants from the verified image is part of resolving one package
descriptor.
Every host import was registered and callable whatever the package
declared, read-only directory capabilities were preopened read-write,
and appd launched packages whose capabilities it could not satisfy. The
fetch import also could not be linked: the host returned a tuple where
the WIT declares the response record, so any component importing
weft:app/fetch failed to instantiate.
One capability vocabulary now lives in weft_ipc_types::capability and
is used by weft-pack, weft-appd and weft-runtime. weft-appd derives a
session's grants once, before the session exists, and refuses the launch
with error 403 when a capability is unknown, unsupported (hw:gpu:*) or
unsatisfiable (documents without an XDG documents directory). The
documents directory now comes from user-dirs.dirs instead of a guessed
~/Documents.
The runtime receives grants explicitly (--grant CAP, --preopen
HOST::GUEST::ro|rw), preopens read-only directories read-only, and checks
the grant on every notifications, clipboard and fetch call. Fetch accepts
only http and https to granted hosts, returns redirects and HTTP error
statuses as responses instead of following or failing them, and bounds
connect time, total time and response size. The file portal takes
read-only directories with --allow-read and refuses writes there.
tests/runtime/check_grants.py runs the real runtime on a probe component
under each kind of grant and checks the outcome of every operation; it
fails when read-only data is writable or an import ignores its grant.
The appd dispatch tests that read WEFT_RUNTIME_BIN now hold the env lock
shared with the tests that set it.
A file URL whose path holds an encoded slash or backslash keeps the UI
directory prefix while a loader may decode it into a path outside that
directory. Navigation and the bridge now refuse such URLs.
appd removes the system token file at shutdown only while it still holds
its own token, and the HELLO deadline in unit tests is one second.
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.
weft-appd marked a session Running and broadcast APP_READY as soon as the
runtime printed READY, then started weft-app-shell with its output
discarded and never watched it. A session with no UI, a UI host that
failed to start, or one that crashed was still reported running. Early
failure paths skipped parts of the cleanup: the image mount was not
unmounted, the compositor association was not released, and the abort
sender leaked on spawn failure. Readiness was any stdout line equal to
READY, which a Wasm guest (inherited stdout) or a page (window.alert
writes to the app shell's stdout) could print.
Now a session becomes Running only after the runtime and then the app
shell report readiness, each within 30 s; WEFT_APP_SHELL_BIN is required
and checked before anything starts. After that, the runtime exiting, the
app shell exiting or a terminate request ends the session. Every exit
path goes through one teardown that kills both children, releases the
compositor association, unmounts the image, stops the file portal and
broadcasts Stopped.
Readiness uses a per-session random token passed to both children in
WEFT_READY_TOKEN. weft-runtime and weft-app-shell print READY <token>,
and appd accepts only a line ending with it; guests receive only the
variables the runtime names and pages cannot read the host environment.
Child output is read in bounded, lossily decoded lines, so invalid UTF-8
or long lines no longer stop the readers. Compositor notifications use
try_send so a disconnected compositor cannot stall teardown, and all
children are killed if the supervisor is dropped.
The IPC relay is not yet owned by the session, and children are killed
without a graceful period.
Validation:
- cargo test -p weft-appd (43 passed); new tests cover: not ready until
the app shell is ready, runtime exit before that, no app shell
configured (runtime never starts), app shell exit ending a running
session with the runtime process gone, and READY lines without the
token; they fail against the previous supervisor
- end to end with weft-compositor (nested), weft-appd, weft-runtime
(wasmtime-runtime) and weft-app-shell: the Counter demo reaches
APP_READY and is on screen; a page that prints a READY line through
alert and never loads is stopped after 30 s without APP_READY;
terminate leaves no child processes
- clippy -D warnings and fmt --check for weft-appd and weft-runtime