Commit graph

58 commits

Author SHA1 Message Date
a454efa869
Merge remote-tracking branch 'origin/main' into fix/end-runtime-on-ipc-hangup
# Conflicts:
#	docs/architecture.md
2026-10-10 07:27:15 +00:00
e1796d39a1
Merge fix/bound-desktop-helpers: bound the clipboard and notification helpers and attribute notifications (#30) 2026-10-10 09:26:47 +02:00
e28897d987
Merge remote-tracking branch 'origin/main' into fix/runtime-resource-limits
# Conflicts:
#	tests/runtime/check_grants.py
2026-10-10 07:26:31 +00:00
656c3df8fd
Merge fix/confine-file-portal: confine file portal operations beneath the granted directory (#28) 2026-10-10 09:25:46 +02:00
2020bfe2c2
Merge fix/fetch-public-destinations: reach only public addresses through a fetch grant for a name (#26) 2026-10-10 09:25:44 +02:00
373cec1bab
Merge remote-tracking branch 'origin/main' into fix/keyboard-system-navigation
# Conflicts:
#	docs/building.md
2026-10-10 07:25:25 +00:00
400f430ced
Merge feat/app-close-policy: let an application decline a close to keep unsaved changes (#24) 2026-10-10 09:25:00 +02:00
da485a182b
Merge fix/close-sessions-gracefully: close app sessions gracefully before terminating them (#23) 2026-10-10 09:24:51 +02:00
3577b3ee1a
Merge fix/close-app-windows: close the focused window on Alt+F4 and let the Servo hosts exit without crashing (#22) 2026-10-10 09:24:41 +02:00
4b9e7b7773
Merge remote-tracking branch 'origin/main' into fix/reserve-panel-work-area
# Conflicts:
#	docs/building.md
2026-10-10 07:24:23 +00:00
bc2c155d24
Merge remote-tracking branch 'origin/main' into fix/activate-app-windows
# Conflicts:
#	docs/building.md
2026-10-10 07:23:50 +00:00
ff6ecacbb6
Merge fix/bind-app-surfaces-to-sessions: bind each app session's Wayland client to its session through appd (#18) 2026-10-10 09:23:18 +02:00
8e910c507c
docs(architecture): say where weft-appd's children log
Following the move of weft-runtime and weft-app-shell logging to
standard error: their stdout carries only the readiness line, and appd
records stderr at info level and other stdout output at debug level.
2026-10-09 21:22:29 +00:00
fda9a7c22f
fix(shell): make the system UI operable from the keyboard
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.
2026-10-09 20:21:32 +00:00
6055e0b0a0
fix(runtime): keep helper error messages, and send notification bodies as plain text
Discarding wl-copy's output also lost its error message, such as a
missing Wayland connection. Its standard error is now kept and read
only when it fails, which is always before it leaves its selection
server.

Other fixes:
- An output over the limit is reported as such, instead of as the
  helper dying of the broken pipe.
- The clipboard is read as any text type, since the content is checked
  as UTF-8 anyway.
- Notification bodies are sent with markup escaped, since notification
  servers may render links and images.
- A failed wait for a helper kills and reaps it.
2026-10-09 19:30:47 +00:00
cb4e50b78c
fix(runtime): bound the clipboard and notification helpers, and attribute notifications
The clipboard and notification imports ran wl-paste, wl-copy and
notify-send with no deadline and no size limits, and took the clipboard
text whole. A notification's icon could be any path or URL, and nothing
said which app sent it, so an app could pass one off as the system's.

Each helper now runs with a 5-second deadline, after which it is killed
and the call fails. Clipboard text is at most 1 MiB in either direction.
A notification's title is at most 256 bytes and its body 4096, its icon
must be an icon theme name, and it is sent with the app's ID as the
application name.

Unit tests run real processes for the deadline, the output limit, input
passing and failure reporting, and check the notification bounds.
check_grants.py still passes.
2026-10-09 19:26:47 +00:00
9b83625778
fix(pack): approve the package weft-appd launches, and drop approvals no longer declared
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.
2026-10-09 19:18:22 +00:00
3186e524ab
feat: grant an app only the capabilities the user approved
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.
2026-10-09 19:11:53 +00:00
044634692f
fix(runtime): bound component memory and app messages
The runtime set no limits of its own:
- A component could grow its linear memory until the host ran out, with
  no ceiling at all where systemd is unavailable.
- An app message could contain line breaks and split into several
  messages.
- An overlong message from weft-appd was buffered without bound.
- A closed connection looked the same as an empty one.

The Wasmtime store now has a limiter: linear memory is capped at 256 MiB
by default (--max-memory-mib changes it), and tables and instances are
bounded too. A memory that would grow past the limit does not grow, and
the component sees an allocation failure.

App messages are single lines of at most 64 KiB, the limit weft-appd
applies. A longer message, or one containing a line break, is refused.
A longer line from weft-appd ends the connection, and sending afterwards
reports that it is closed. The systemd scope also gets TasksMax=64.

The grants probe component now also tries a 300 MiB allocation and the
two refused messages. tests/runtime/check_grants.py checks that the
allocation fails at the default limit and succeeds with a 512 MiB
limit.
2026-10-09 18:23:07 +00:00
5f5474774a
fix(runtime): match the IPv6 special-purpose ranges exactly
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.
2026-10-09 18:17:57 +00:00
b163655b87
fix(runtime): judge IPv6 forms of IPv4 addresses and never fetch through a proxy
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.
2026-10-09 18:16:42 +00:00
50418d4c0b
fix(portal): refuse indirect paths as given and harden connection handling
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.
2026-10-09 18:15:28 +00:00
4e95c49062
fix(runtime): reach only public addresses through a fetch grant for a name
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.
2026-10-09 18:12:31 +00:00
f519832af1
fix(portal): confine file operations beneath the granted directory
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.
2026-10-09 18:06:25 +00:00
d76d4c726d
test(appd): check that an unusable store entry does not hide a later store
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.
2026-10-09 17:56:27 +00:00
a65fb89662
fix(pack): replace a differing revision of the same name in one exchange
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.
2026-10-09 17:52:38 +00:00
194fb9f0fa
fix(pack): keep earlier app data and committed activations through updates
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.
2026-10-09 17:44:50 +00:00
a57cdbc8be
feat(pack): install and update packages as immutable revisions activated atomically
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.
2026-10-09 17:33:57 +00:00
d509513e0a
fix(appd): stop a session whose stop request races its readiness
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.
2026-10-09 17:16:42 +00:00
ddd79f6ab1
fix(appd): keep a session running while it answers a close, and add a forced stop
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.
2026-10-09 17:10:15 +00:00
551df84562
feat: let an application decline a close to keep unsaved changes
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.
2026-10-09 17:00:08 +00:00
e72c55c87c
fix(appd): tell every client that a session is closing
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.
2026-10-09 16:45:25 +00:00
0866befc16
fix(appd): keep a closing session registered until it settles
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.
2026-10-09 16:41:30 +00:00
80d7451abf
fix(appd): close a running session as a user close would before terminating it
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.
2026-10-09 16:36:29 +00:00
828984be4b
fix(compositor): close the focused window on Alt+F4 and let the shells exit without crashing
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.
2026-10-09 16:22:59 +00:00
cdc4a9e15d
fix(compositor): keep the stacking order through layout changes
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.
2026-10-09 16:11:20 +00:00
8399914dfa
fix(compositor): show the shell's home on a panel click and release a dead panel's strip
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.
2026-10-09 16:06:19 +00:00
5253eaf251
fix(compositor): reserve the taskbar strip and lay app windows out in the work area
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.
2026-10-09 16:00:38 +00:00
65c02231a0
fix(compositor): restore focus when a window closes and keep later windows from taking it
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.
2026-10-09 15:42:42 +00:00
aa67e7f190
fix(compositor): own stacking and focus, and activate app windows on request
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.
2026-10-09 15:36:55 +00:00
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
88c2e9f6a5
fix(pack): install only trusted packages and bind each app ID to its owner
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.
2026-10-09 13:49:49 +00:00
8eed654be7
fix(appd): let no directory shadow an image, and refuse linked roots
- 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.
2026-10-09 11:08:41 +00:00
e2f9746fb5
Merge remote-tracking branch 'origin/fix/confine-app-renderer' into fix/resolve-verified-package
# Conflicts:
#	docs/architecture.md
2026-10-09 10:18:47 +00:00
2148ffc8ae
fix(appd): resolve each launch to one package and fail closed on images
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.
2026-10-09 10:03:40 +00:00
16a184ad9e
fix(app-shell): close the remaining paths out of the application page
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.
2026-10-09 10:03:30 +00:00
d60152f443
fix(app-shell): confine application pages to their UI files and bridge
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.
2026-10-09 09:39:37 +00:00
26bd5b5079
fix(appd): end sessions whose IPC connection closes and never block on it
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.
2026-10-09 09:18:39 +00:00
d9d9d24205
fix(appd): make the IPC relay part of the session it serves
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.
2026-10-09 09:11:35 +00:00
1928ffb661
fix(pack): never delete a data directory that was not moved
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.
2026-10-09 09:01:28 +00:00