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.
- 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.
Servo e5d9a51 replaces the root that kept a pending classic script
alive with tracing through the document that holds it. A root also
kept the script's global alive, so a document dropped while a script
was pending would leak. The crash the root fixed stays fixed.
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.
appd created $XDG_RUNTIME_DIR/weft with the umask mode when it opened
its own socket, wrote its port or system token, or opened a portal
socket, so the 0700 mode requested for session sockets never applied.
All of them now use one helper that creates the directory 0700 and
tightens an existing one.
Session sockets are named by session ID and every test registry starts
at 1, so test processes running at the same time shared one socket path
in the common test runtime directory and broke each other's sessions.
Each test process now uses its own directory under the system temporary
directory, and directories of ended test processes are removed. The
test of a closed IPC connection connects to the socket itself instead
of relying on python3 in a child script.
A session whose component closes its IPC connection during startup now
stops before it is reported ready. The weft runtime directory is
created with mode 0700, and the socket is removed if its permissions
cannot be restricted.
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.
One test set WEFT_APP_STORE while another, running on a parallel
thread, expected the default store roots, so the default-roots test
failed intermittently (5 of 60 local runs, and in CI). The four tests
that read or change the variable now share a lock, and the default-roots
test clears the variable for its duration (0 of 30 runs fail).
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
When a systemd user manager was detected, weft-appd launched the runtime
with `systemd-run --user --scope --wait ...`. systemd rejects that
combination while parsing options ("--wait may not be combined with
--scope"), so every app launch on such a host exited immediately and the
session stopped without the runtime ever starting.
A scope already runs the command in the foreground: systemd-run registers
the scope and then executes the command in its own process, so stdout and
the exit status still reach appd without --wait.
The options now live in one constant. A Linux test runs the installed
systemd-run with them against an empty runtime directory and bus address
and requires it to reach the manager connection; option and combination
errors stop it earlier. The test does not validate the -p property values
or start a scope. It requires systemd-run to be installed.
This keeps the existing ownership scope for the runtime only; placing the
app shell and helpers under the same owner is separate lifecycle work.
Validation:
- systemd-run 255: the test passes with the new options and fails with
the old --wait (and with --pty) using systemd's own message
- cargo test -p weft-appd (38 passed), clippy -D warnings, fmt --check
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
When a systemd user manager was detected, weft-appd launched the runtime
with `systemd-run --user --scope --wait ...`. systemd rejects that
combination while parsing options ("--wait may not be combined with
--scope"), so every app launch on such a host exited immediately and the
session stopped without the runtime ever starting.
A scope already runs the command in the foreground: systemd-run registers
the scope and then executes the command in its own process, so stdout and
the exit status still reach appd without --wait.
The options now live in one constant. A Linux test runs the installed
systemd-run with them against an empty runtime directory and bus address
and requires it to reach the manager connection; option and combination
errors stop it earlier. The test does not validate the -p property values
or start a scope. It requires systemd-run to be installed.
This keeps the existing ownership scope for the runtime only; placing the
app shell and helpers under the same owner is separate lifecycle work.
Validation:
- systemd-run 255: the test passes with the new options and fails with
the old --wait (and with --pty) using systemd's own message
- cargo test -p weft-appd (38 passed), clippy -D warnings, fmt --check
Built without the wasmtime-runtime feature, weft-runtime printed READY
and exited without executing anything. weft-appd treats READY on the
runtime's stdout as the readiness signal, so such a build made a session
appear to start successfully although no component ran.
The feature-disabled build now exits with an error naming the missing
feature, so appd sees the runtime close without READY and stops the
session. The binary still builds for the portable type, lint and unit
checks. The Nix package keeps building the engine-enabled runtime.
Validation:
- new unit test: run_module in a feature-disabled build returns an error
naming the feature; it fails against the previous stub
- feature-disabled binary against a minimal package: exits 1 with the
error and prints no READY
- cargo test -p weft-runtime (5 passed), clippy -D warnings, fmt --check
Both Servo hosts tracked the marcoallegretti/servo `servo-weft` branch,
which the lockfile resolved to 8e7dc40. That revision's servo-layout does
not compile (E0308 and E0716 in build_backdrop_filter). WEFT also resolved
upstream Stylo dca3934, where backdrop-filter is gated behind
layout.unimplemented, because the Servo fork's own [patch] for Stylo does
not apply to dependents.
Pin Servo by revision to f0bb1aa (8e7dc40 plus the build fix) and add a
root [patch."https://github.com/servo/stylo"] selecting the
marcoallegretti/stylo fork at f1ba496 for all eight Stylo crates Servo
uses. Cargo.lock changes only the 66 source lines of those packages.
Record both pins, their reachable branches, purpose and removal
conditions in SERVO_PIN.md, and restate its limitations against executed
evidence. Update the Nix outputHashes: the Stylo hash is recomputed for
f1ba496 with the method that reproduces the previous dca3934 value; the
Servo hash is not yet known for f0bb1aa and is left as lib.fakeHash, so
Nix builds report the expected value instead of using a stale one.
Validation:
- cargo metadata --locked: ok; no servo/stylo sources remain in the lock
- cargo check -p weft-servo-shell --features servo-embed --locked:
all of Servo, including servo-layout, compiles; the remaining errors are
in the shell's own embedder code
- cargo fmt --check; portable workspace tests: 78 passed
- Nix fetchgit could not run here (archive downloads and the sandbox's
TLS to the proxy fail), so the Servo hash remains unverified
The two consecutive registry lock acquisitions after READY left a window
where session state was Running but the AppReady broadcast had not yet
been sent. A concurrent reader winning the lock in that window would
observe Running without a corresponding event. Combining into one
acquisition closes the window.
- supervise: in the stdout-read-error-before-READY case, immediately
kill the child process, tear down the file portal, mark the session
Stopped, and return; previously the function fell through to child.wait()
leaving the session in Starting state with no guaranteed cleanup path
- supervise: restructure app_shell binding as a match expression so the
compiler can verify the initial None value is not silently discarded
- weft-runtime: replace Mutex::lock().unwrap() with unwrap_or_else in
the weft:app/ipc send, recv, and connect host functions so a poisoned
mutex does not panic inside the Wasmtime host-call context
- blit_software: replace expect() on softbuffer Context and Surface
creation with log-and-skip so a frame failure does not crash the process
- blit_software: replace NonZeroU32::new(1).unwrap() with NonZeroU32::MIN
- resumed: replace create_window().expect() with a match that calls
event_loop.exit() and returns on failure instead of unwinding
- build_rendering_ctx: return Option<RenderingCtx> instead of panicking
when SoftwareRenderingContext creation fails; callers exit cleanly
- resumed (app-shell): exit without emitting READY when no rendering
context is available so weft-appd observes a clean session failure
- weft-servo-shell: bound gesture forwarding to one active thread at a
time using JoinHandle::is_finished(); excess batches are dropped with
a debug log to prevent unbounded thread creation per event loop tick
- shell_client (both shells): replace post-ensure! unwrap() with expect()
that documents the invariant
- winit backend: client insertion and dispatch_clients failures now log
and continue instead of unwinding the event loop
- winit backend: bind/render/submit failures in the redraw handler skip
the frame and log a warning; the compositor stays running
- DRM backend: same client insertion and dispatch_clients treatment
- DRM device_added: use .context()? instead of unwrap() when inserting
the new device entry after the drm field is known to be initialised
- DRM render_output: use guard-return instead of unwrap() to access drm
state that was already verified non-None lines above
- compositor state: duplicate layer surface mapping from a misbehaving
client logs a warning and returns instead of panicking