Commit graph

242 commits

Author SHA1 Message Date
d67ea24004
fix(pack): create a missing store at 0755 regardless of umask
A first root install under a restrictive umask created the store and its
parents unreadable to other users even though the package inside was
0755/0644. Missing store directories are now created and set to 0755.
The copy comment and the hard-link note in the security docs describe
exactly what is checked and what the kernel enforces.
2026-10-09 14:22:37 +00:00
8221e6fc3d
fix(pack): set installed modes regardless of umask and hold one descriptor per level
Modes requested at creation were masked by the umask, so a root install
under umask 077 produced system packages other users could not read.
They are now set explicitly after creation. The copy reads each
directory's names and closes the listing before recursing, so deep
trees hold one descriptor per level. The owner-lock test now uses an
ID that would otherwise open, and the docs describe the copy check and
its device-node residual precisely.
2026-10-09 14:20:35 +00:00
181aa0fefa
fix(pack): copy packages by directory descriptor so swapped links cannot redirect the copy
Checking each file's device and inode against a path-based listing still
followed a directory replaced by a link after it was listed. The copy now
holds each source directory open and opens its entries relative to it
with O_NOFOLLOW, checking type, device and inode against the listing.
Only real packages in other stores keep an owner record, the store list
is deduplicated, archive names must be valid app IDs, and the help text
is wrapped.
2026-10-09 14:17:09 +00:00
c64ee531ee
fix(pack): take the app ID from the staged copy and check copied file identity
The app ID now comes from the staged copy, so a source changed after
validation cannot steer paths outside the store or the owners directory,
and lock_owner refuses invalid IDs. Copied files must keep the device and
inode they were listed with, and are opened without following links or
blocking on FIFOs, which no longer depends on /proc. Uninstall keeps an
owner record while another known store holds the package, and a failure
to inspect app data refuses rather than counting as no data.
2026-10-09 14:13:18 +00:00
39f7ca2a3f
fix(pack): close inventory forgery, serialize ownership changes and refuse to follow links
Names with control characters have no content digest, so a crafted name
can no longer reproduce other inventory lines and drop signed files.
Installs and uninstalls of an ID hold a per-ID lock, so a failed
concurrent install cannot remove the record of the one that won. App
data without a recorded owner goes to a new owner only with
--claim-data. Uninstall releases a record left by an interrupted
install once no data remains. Files are opened without following links
and, on Linux, must be the file that was listed.
2026-10-09 14:04:53 +00:00
d175bf012e
fix(pack): normalize installed modes and never leave a partial or orphaned owner record
Installed files take fixed modes (0644, or 0755 when executable) and
directories 0755, so a world-writable source cannot install as such.
An owner record created by an installation whose package then fails to
be placed is removed, and records are written under a temporary name
and linked into place, so they are never partial. Archives unpack into
a random private directory that is always removed. Uninstall frees an
ID only when the app data is truly absent, signatures are checked with
verify_strict, and list marks development installs.
2026-10-09 13:59:54 +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
5c82b540e6
Merge fix/resolve-verified-package: resolve each launch to one package and fail closed on images (#16)
weft-appd resolves each launch once: a verified image in any store wins over a directory install and must mount or the launch is refused, with no fallback to a mutable directory. The manifest must declare the requested ID and its entries must be contained regular files without links. weft-runtime receives --module and weft-app-shell --ui; neither searches the stores. Grants come from the same manifest and the mount belongs to the session. The manifest parser and image file names are shared through weft-ipc-types with weft-pack.
2026-10-09 14:53:49 +02:00
cad8c016d6
Merge remote-tracking branch 'origin/main' into fix/resolve-verified-package 2026-10-09 12:50:31 +00:00
c0fdca18b6
Merge fix/confine-app-renderer: confine application pages to their UI files and bridge (#15)
weft-app-shell checks every resource load: files inside the UI directory, also after resolving links, inline data: and blob: resources, about:blank and the session bridge are allowed; other files and network destinations, redirects and loads not tied to the webview fail before a request leaves the renderer. The Servo pin moves to e5d9a51, which keeps pending classic scripts traced until they run and withholds navigator.servo from about:blank and about:srcdoc documents.
2026-10-09 14:50:24 +02:00
ba82535ae2
Merge remote-tracking branch 'origin/main' into fix/confine-app-renderer 2026-10-09 12:33:46 +00:00
8214c12d7e
Merge fix/session-owned-ipc-relay: make the IPC relay part of the session it serves (#14)
The session supervisor opens and owns each session's IPC relay; every exit path stops the relay task, removes its socket and unregisters its sender. A session ends when its IPC connection closes. IPC_FORWARD never waits on a component and reports an error for a missing relay or a full queue. appd's runtime directory is created mode 0700 and the relay socket 0600.
2026-10-09 14:33:28 +02:00
969f719d2d
Merge remote-tracking branch 'origin/main' into fix/session-owned-ipc-relay 2026-10-09 12:18:43 +00:00
84930b13d8
Merge fix/separate-app-data: keep app data apart from installed packages (#13)
App data lives in $XDG_DATA_HOME/weft/app-data/<id>, private to the user, and is moved from the earlier layout in one no-replace rename; conflicting or cross-filesystem data is never moved or deleted. weft-pack never removes a data directory with a package. Notes stores text exactly, refuses saves edited from a stale revision and writes through a locked, synced staging file.
2026-10-09 14:18:28 +02:00
1f58a7be11
Merge remote-tracking branch 'origin/main' into fix/separate-app-data 2026-10-09 11:57:17 +00:00
744acc8164
Merge fix/enforce-session-grants: enforce effective capability grants per session (#12)
weft-appd derives each session's grants once, before the session exists, from one shared capability vocabulary and refuses packages it cannot satisfy. weft-runtime receives them as --grant and --preopen arguments, preopens read-only directories read-only and checks every notifications, clipboard and fetch call. Fetch is limited to http and https to granted hosts, standard methods, no Host or hop-by-hop headers, unfollowed redirects and bounded time and size.
2026-10-09 13:56:57 +02:00
6f2f566fe4
Merge remote-tracking branch 'origin/fix/confine-app-renderer' into fix/resolve-verified-package
# Conflicts:
#	crates/weft-runtime/src/main.rs
2026-10-09 11:43:01 +00:00
b45fe27e9b
Merge remote-tracking branch 'origin/fix/session-owned-ipc-relay' into fix/confine-app-renderer 2026-10-09 11:37:44 +00:00
cda9c14426
Merge remote-tracking branch 'origin/fix/separate-app-data' into fix/session-owned-ipc-relay 2026-10-09 11:37:17 +00:00
b17b74f310
Merge remote-tracking branch 'origin/fix/enforce-session-grants' into fix/separate-app-data 2026-10-09 11:36:27 +00:00
12e4c1d91a
Merge remote-tracking branch 'origin/main' into fix/enforce-session-grants
# Conflicts:
#	.gitignore
#	README.md
#	docs/building.md
2026-10-09 11:30:01 +00:00
0ab429b2ea
Merge fix/authorize-session-messages: authorize WebSocket clients by role and session (#11)
weft-appd's WebSocket requires HELLO within 5 seconds. A system role authenticated with appd.systoken manages sessions; an app role authenticated with a per-session bridge token exchanges APP_MESSAGE envelopes with its own session only. The Servo hosts hand credentials only to their own top-level documents and deny navigation outside them.
2026-10-09 13:28:43 +02: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
04cde8901c
Merge remote-tracking branch 'origin/fix/confine-app-renderer' into fix/resolve-verified-package 2026-10-09 10:29:32 +00:00
fecf4c5b55
fix(app-shell): report a UI path that is not absolute 2026-10-09 10:29:32 +00:00
1641bf31a8
build(servo): trace pending classic scripts instead of rooting them
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.
2026-10-09 10:29:24 +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
d056045ad8
test(appd): launch complete packages in the supervisor tests
Launch tests wrote manifests without names, versions or entries, which
the shared parser rejects. They now write complete packages.
2026-10-09 10:18:36 +00:00
687439a2a3
test(frame): make the worker and srcdoc confinement probes observable
Servo refuses worker scripts for file: pages, blob: ones included, so
the worker probe now requires only that no worker fetch succeeds, and
the worker is built from the page itself. The srcdoc frame reports to a
listener installed before the frame exists. Band failures and requests
that reached the servers are reported together, so a run without the
policy shows every leak.
2026-10-09 10:16:22 +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
010573eb16
fix(appd): create the runtime directory private wherever it is made
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.
2026-10-09 09:27:28 +00:00
ec00531c75
test(appd): give each test process its own runtime directory
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.
2026-10-09 09:24:49 +00:00
67bce2fb22
Merge branch 'main' into fix/authorize-session-messages 2026-10-09 09:19:26 +00:00
5174a58d47
Merge pull request #9: report sessions running only after the UI host is ready
Sessions become Running only after token-authenticated READY from the runtime and the app shell, and every exit path shares one teardown.
2026-10-09 11:19:16 +02:00
818a831895
Merge pull request #6: stop reporting readiness without an engine
A runtime built without wasmtime-runtime now exits with an error instead of printing READY; its env-dependent tests are serialised.
2026-10-09 11:19:13 +02: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
ac6559a814
Merge pull request #10: add the stability blueprint, engineering contract and contributor toolkit
BLUEPRINT.md defines the 0.1.0 target; AGENTS.md and .agents/ give the contribution procedures and checks.
2026-10-09 11:14:20 +02: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
481495d929
fix(notes): show loading status and check the editor after a failed load
The first load showed an empty status while the editor was read-only;
it now says loading. check_notes.py also types and saves after a failed
load and requires the stored file to stay unchanged.
2026-10-09 09:07:27 +00:00
c1ea57fbef
fix(notes): keep Discard usable after a failed load
Discard waited for a stored revision, so after a load failed (stored
notes not valid UTF-8, a read error, a lost reply) the editor stayed
read-only with no way to reload. The page now tracks the outstanding
load itself: Discard is refused only while a load or save is in flight,
a load error or a ten-second timeout ends the load, and Discard retries.

A save acknowledgement arriving after its timeout and after Discard had
started a reload replaced the saved state while the editor still showed
older text, so the next save would silently revert it. Acknowledgements
are ignored while a load is outstanding, and a reload forgets the last
save.

The component removes a lock whose token could not be written and
cleans up renamed stale locks with the abandoned staging files.
check_notes.py adds a failed load followed by a repaired file and
Discard; the previous package stays read-only there and fails.
2026-10-09 09:05:25 +00:00
87436d0e08
fix(notes): apply only the outstanding load and own the save lock
A second load reply, from Discard clicked twice or during the first
load, replaced the editor again after it had become editable. Only the
reply to the outstanding load is applied now, and Discard does nothing
while a load is outstanding.

The save lock holds an owner token and is released only by its owner; a
stale lock is renamed away before removal, so two saves cannot both take
it over. A save removes only a staging file it created and, holding the
lock, removes staging files left by saves that ended before their
rename. A save acknowledgement arriving after the page's timeout is
still accepted, and text that cannot be encoded is refused before it is
sent. app.wasm is rebuilt and the package re-signed with the demo key.
2026-10-09 09:01:28 +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
d2bc176344
Merge branch 'main' into fix/appd-session-readiness
# Conflicts:
#	crates/weft-appd/src/runtime.rs
2026-10-09 08:57:41 +00:00
e3c2e80142
Merge branch 'main' into fix/runtime-stub-readiness 2026-10-09 10:57:06 +02:00
8ae7b8517c
docs: describe the portable profile without implying other hosts
The portable checks run on Linux only; they cover the crates that need
no Linux system libraries.
2026-10-09 08:57:00 +00:00
1e344d684d
docs: name the portable CI job in the verification runner
The portable profile mirrors the CI job that now runs on Ubuntu only
under the name portable.
2026-10-09 08:56:50 +00:00
4d39ec3a8b
Merge branch 'main' into docs/add-engineering-contract 2026-10-09 08:56:42 +00:00
87222599f1
Merge pull request #8: verify native pointer and keyboard input through weft-compositor
tests/frame/check_input.py drives a page through weft-compositor with real X input and checks the presented pixels.
2026-10-09 10:56:29 +02:00