Commit graph

335 commits

Author SHA1 Message Date
2418cb636a
Merge pull request #37 from marcoallegretti/build/set-version-0.0.1-alpha.0
Some checks failed
ci / portable (push) Has been cancelled
ci / linux-only (push) Has been cancelled
ci / runtime-grants (push) Has been cancelled
ci / servo-embed-linux (push) Has been cancelled
ci / contributor-toolkit (push) Has been cancelled
2026-10-10 18:10:41 +02:00
d0864fcbe9
build: set the workspace version to 0.0.1-alpha.0
The workspace declared 0.1.0, the stable target, although nothing has
been released: it was a development placeholder. The workspace crates
and the Nix packages now carry 0.0.1-alpha.0, the first prerelease
toward 0.0.1, and the README records that 0.1.0 was never published.
Application, package and WIT interface versions are unchanged.
2026-10-10 15:37:19 +00:00
90669ae93b
Merge fix/confine-mount-helper: confine the setuid mount helper and install it in the graphical VM (#35) 2026-10-10 09:28:06 +02:00
f2d84de5f1
Merge remote-tracking branch 'origin/main' into fix/confine-mount-helper
# Conflicts:
#	docs/security.md
2026-10-10 07:27:58 +00:00
5937025697
Merge fix/image-session-wiring: start the reference session's services and connect them to the compositor (#34) 2026-10-10 09:27:29 +02:00
7e9df63d87
Merge fix/end-runtime-on-ipc-hangup: end the runtime when its session's IPC connection closes (#36) 2026-10-10 09:27:22 +02:00
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
0c527dfada
Merge fix/runtime-resource-limits: bound component memory and app messages in the runtime (#27) 2026-10-10 09:26:39 +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
8e874714ad
Merge fix/ipc-relay-framing: keep component messages whole in the session IPC relay (#32) 2026-10-10 09:25:51 +02:00
da3247667e
Merge fix/nixos-mesa-package: use the mesa package for the VM's graphics drivers (#31) 2026-10-10 09:25:49 +02: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
3f4545ae66
Merge fix/keyboard-system-navigation: reach and operate the system UI from the keyboard (#33) 2026-10-10 09:25:35 +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
c557b24dce
Merge fix/reserve-panel-work-area: reserve the taskbar strip and lay application windows out in the work area (#21) 2026-10-10 09:24:31 +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
87b7125281
Merge fix/activate-app-windows: own window stacking and focus in the compositor and activate app windows on request (#20) 2026-10-10 09:24:09 +02: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
94d43b12f3
Merge feat/capability-approval: grant an app only the capabilities the user approved (#29) 2026-10-10 09:22:36 +02:00
74135a462a
Merge feat/transactional-package-install: install and update packages as immutable revisions activated atomically (#25) 2026-10-10 09:22:06 +02:00
76839f6ec2
Merge fix/verify-packages-at-launch: verify package owner and signature before a session starts (#19) 2026-10-10 09:21:40 +02:00
9b1e7cb940
Merge fix/verify-package-trust: install only trusted packages and bind each app ID to its owner (#17) 2026-10-10 09:21:27 +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
83fca91772
fix(runtime): log to standard error, without colours when piped
weft-runtime and weft-app-shell logged to standard output, which carries
their readiness line to weft-appd. weft-appd keeps that stream only at
debug level, so the runtime's warnings and errors, such as a failed
grant or an ended IPC connection, never reached its log, and the lines
carried terminal colour codes.

Both now log to standard error, which weft-appd records at info level,
with colours only on a terminal. In the nested desktop Counter check,
the runtime's own lines appear in weft-appd's log; the grants check
reads the hangup message from standard error.
2026-10-09 21:13:29 +00:00
57f364890f
fix(runtime): end the runtime when its session's IPC connection closes
A runtime outlived the weft-appd that started it. Runtimes run in their
own systemd scopes, outside weft-appd's service, and a component that
waits for messages, as the Counter and Notes demos do, keeps polling a
closed connection forever. Each time weft-appd stopped or restarted and
restored the previous session, the earlier runtimes stayed behind.

The connection is the session: a thread waits for it to hang up, without
reading from it, and the runtime then exits whatever the component is
doing. That covers weft-appd closing the connection, weft-appd ending,
and the runtime ending the connection itself after a failed send or an
overlong message. A runtime given an IPC socket it cannot connect to now
fails instead of running unreachable. weft-appd's relay notes that it
must not shut down half of the connection, which would now end the
session.

tests/runtime/check_grants.py runs the real runtime on the Counter
component over a Unix socket: it answers an increment, and once the test
closes its end the runtime exits with status 0 within 10 seconds; with
the watcher removed it keeps running and the check fails. A unit test
checks that the wait sees a hangup but neither wakes on nor consumes
pending data; CI's runtime-grants job now runs the runtime's unit tests
with its features. The nested desktop Counter and Notes checks pass with
this runtime.
2026-10-09 21:11:23 +00:00
bc649d17c4
fix(nixos): show the session and install the mount helper setuid
The VM ran without graphics, so the desktop could not be seen, and
weft-appd was pointed at the mount helper's store path, which cannot be
set-user-ID, so verified package images could not mount.

The VM opens a graphics window, with tty0 as the primary console and the
serial console as a secondary one. weft-mount-helper is installed
through security.wrappers, setuid root and executable only by the
users group, built to run cryptsetup's veritysetup, and weft-appd uses
/run/wrappers/bin/weft-mount-helper.
2026-10-09 20:56:52 +00:00
076ed95eb1
fix(mount-helper): confine what a setuid caller can mount and unmount
weft-mount-helper is meant to be installed setuid root, but it trusted
its caller entirely: it ran veritysetup, mount and umount from the
caller's PATH, mounted a caller's image at any directory, such as over
/etc, and unmounted any mountpoint. Any local user could have gained
root through it.

It now mounts only at an empty directory
/run/user/<uid>/weft/mnt/<name> of the real user, where weft-appd puts
its mountpoints, with every component from <uid> on owned by that user,
not writable by others and opened without following symbolic links,
and mounts through the opened directory, so the path cannot be swapped
meanwhile. It opens the image and hash tree with the real user's
permissions, checks the root hash is a hex digest, mounts read-only with
nosuid, nodev and noexec through mount(2), and unmounts only an EROFS
filesystem at such a directory. veritysetup runs from the absolute path
fixed at build time (WEFT_VERITYSETUP, /usr/sbin/veritysetup by
default), with an empty environment. Devices are named
weft-<uid>-<name>, so a user reaches only their own; a device left by an
interrupted mount is closed by the next mount or unmount at that
directory, and a user may have at most 64 open, counted from the
kernel's list of device-mapper devices under a root-owned lock. Closed standard streams
are reopened on /dev/null before anything else is opened, and errors and
panics are printed as one-line messages.

Run setuid as nobody with a PATH holding a hostile veritysetup and
mount, the helper refuses /etc and another user's directory as
mountpoints, a symbolic link to /etc, a file nobody cannot read, a
malformed root hash, and unmounting /etc or a directory with no image;
a valid request reaches veritysetup at its fixed path, also with the
standard streams closed, and the hostile programs never run. Unit tests cover the mountpoint rules.
2026-10-09 20:56:52 +00:00
a1edac63b8
fix(session): start the session as user units through its own target
The tty1 login hook ran systemctl --user start graphical-session.target,
which systemd refuses (RefuseManualStart=yes), so none of the NixOS
session's services started. The units in infra/systemd were wanted by
graphical.target, a system target, although weft-appd's needs the
session user's runtime and home directories and the compositor publishes
its socket to the user manager; run as system units the shell could
never learn the socket.

weft-session.target binds graphical-session.target and wants the
compositor, shell and weft-appd, in the NixOS configuration and as a
user unit in infra/systemd; the login hook starts it. The services are
part of the graphical session, the shell no longer hardcodes the
compositor's socket, and the compositor's units unset WAYLAND_DISPLAY
and DISPLAY so a restarted compositor does not take them for an
enclosing session and pick the nested backend. As a user unit, weft-appd
drops ProtectSystem= and PrivateTmp=, which a user manager implements
with PrivateUsers=yes, under which the setuid mount helper cannot mount
verified images. docs/building.md adds the VM's disabled graphics and
its mount helper, which the Nix store cannot hold setuid, to what still
keeps the image from a working desktop.

Rendered from the NixOS configuration, and as installed from
infra/systemd, the units pass systemd-analyze --user verify.
2026-10-09 20:35:58 +00:00
239afc2d11
fix(compositor): publish the Wayland socket to the systemd user manager
The services started after the compositor had no way to learn its
socket: the NixOS shell service hardcoded wayland-1, weft-appd's service
had no WAYLAND_DISPLAY at all, so the app shells it starts could not
connect, and the plain unit's comment claimed the compositor posted the
socket to the environment, which it did not.

Started by systemd, the compositor now sets WAYLAND_DISPLAY in the user
manager with systemctl --user set-environment right after creating its
socket and before reporting readiness, so the units ordered after it
inherit it. The winit backend now reports readiness too, as a Type=notify
unit expects.
2026-10-09 20:34:33 +00:00
5db3d1ddce
fix(nixos): start weft-appd and give the session its shell page and app shell
The reference session could not show the system UI or open an app, even
with every package built:

- weft-servo-shell ignores command-line arguments, yet
  infra/systemd/servo-shell.service passed it the page path, and the
  binary's packaged fallback named a path no package provides. The
  Nix package did not install the page and its NixOS service did not
  name it either, so the shell exited at startup.
- The NixOS weft-appd user service was wanted by nothing, so it never
  started, and it had no WEFT_APP_SHELL_BIN, so every launch would stop
  before its UI host started.

The weft-servo-shell package now installs the page as
share/weft/shell/system-ui.html, the binary falls back to that path in
the package's active revision, the systemd unit drops the ignored
argument, and the NixOS service sets WEFT_SYSTEM_UI_HTML to the package's
copy. weft-appd is wanted by the graphical session and is given the app
shell. docs/building.md lists what still keeps the image from a working
desktop: the Servo source hash, servo-embed in the shell packages and the
fixed Wayland socket name.
2026-10-09 20:26:05 +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
e83c3f6df0
fix(appd): list installed apps in name order
The catalog followed the store's directory listing, so the launcher's
order, and with it its keyboard order, could change between scans. Apps
are listed by name, ignoring case, then by ID.
2026-10-09 20:21:26 +00:00
73dc2cbaa5
fix(shells): report the Super keys to pages as Meta
winit names the Super keys NamedKey::Super, which the key conversion did
not map, so pages saw an Unidentified key. The DOM names these keys
Meta.
2026-10-09 20:21:26 +00:00
72dda72432
fix(compositor): show the shell on a Super key tap
From an application window there was no keyboard path to the system
shell: only a pointer click on the taskbar strip raised the panel.

The Super keys now belong to the compositor and are never delivered to
an application. A tap, Super pressed and released without another key,
activates the shell's panel, raising it with keyboard focus, and then
delivers the tap to it so the shell can open its launcher; a key or a
pointer button pressed meanwhile makes it no tap. Keys pressed while
Super is held reach the focused window with the Super modifier: a client
is sent the modifiers whenever a key the compositor takes changes them,
so none stays held there. With several panels, the first registered one
is the shell's.
2026-10-09 20:21:26 +00:00
8c476fdf15
fix(appd): keep the relay's platform attribute on the function and bound frames exactly
The frame limit constant was inserted between spawn_ipc_relay's doc
comment and its cfg(unix) attribute, so the attribute applied to the
constant instead. A non-Unix build would have had two definitions of
the function.

The size is now checked before the line ending, so a frame one byte
over the limit is refused even when its line break arrives in the same
read. A message that is not UTF-8 ends the relay, as it did before,
rather than reaching the page with replacement characters. The test now
also covers a message at exactly the limit ending in CRLF.
2026-10-09 19:43:20 +00:00
2cd7ee735b
fix(appd): keep a component's message whole when the relay also forwards one from the page
The session's IPC relay read component messages with read_line inside
select!, into a buffer created anew on each pass. When a message from
the page won the select while a component message was half read, the
read part was lost, and the page received the remainder as a message of
its own. The line was also unbounded.

The relay now keeps the frame being read across passes and fills it
with read_until, which keeps partial reads when cancelled. It ends the
relay on a line longer than any message the runtime sends.

A new test writes half a component message, has the relay forward a page
message, then completes it and checks that it arrives whole. On the
previous code the test receives only the second half. It also checks
that an overlong line ends the relay.
2026-10-09 19:39:01 +00:00
d0ee6d685e
fix(nixos): use the mesa package for the graphics drivers
nixpkgs deprecates mesa.drivers in favour of mesa, and evaluating the VM
configuration warned about it.
2026-10-09 19:35:48 +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
0c9b2c2b0d
fix(runtime): do not wait for the process wl-copy leaves serving the selection
wl-copy forks a process that keeps serving the selection. That process
inherits the helper's output pipes, so reading them to the end would
block a clipboard write until the selection changed. wl-copy's output is
now discarded, and its failure is reported by exit status.
2026-10-09 19:27:39 +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
e482fec07c
fix(pack): add approvals by name only for installed, declared capabilities
Pruning compared a list of the declared capabilities with the set of
approved ones by length. A manifest repeating a capability could
therefore keep an approval it no longer declared. The two are now
compared as sets.

weft-pack approve <id> <capability>... replaced the app's approval
instead of adding to it. It also accepted any app ID and any
capability, which let an approval cover a capability declared later. It
now adds to the approval, requires the app to be installed, and for a
package weft-pack can read, requires each listed capability to be
declared. The docs state the remaining limits for verified images.
2026-10-09 19:20:52 +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
0f4fafe701
test(portal): point the relative escape link at the planted directory
The relative link in the race test climbed one level too high, so it
pointed at a directory that does not exist and could not catch a read
that left the granted directory.
2026-10-09 19:00:54 +00:00