Commit graph

31 commits

Author SHA1 Message Date
656c3df8fd
Merge fix/confine-file-portal: confine file portal operations beneath the granted directory (#28) 2026-10-10 09:25:46 +02: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
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
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
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
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
04cde8901c
Merge remote-tracking branch 'origin/fix/confine-app-renderer' into fix/resolve-verified-package 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
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
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
d2bc176344
Merge branch 'main' into fix/appd-session-readiness
# Conflicts:
#	crates/weft-appd/src/runtime.rs
2026-10-09 08:57:41 +00:00
4d39ec3a8b
Merge branch 'main' into docs/add-engineering-contract 2026-10-09 08:56:42 +00:00
cc69c048c0
fix(appd): keep app data apart from installed packages
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.
2026-10-09 08:43:42 +00:00
722cd7479e
docs: stop runner toolchain installs and widen maintenance form
The verification runner inherited rustup's default of installing a
missing pinned toolchain or component on demand, contradicting its
documented guarantee. Run every profile with RUSTUP_AUTO_INSTALL=0 so a
missing toolchain fails the check, and document how to install it.

The maintenance form and CONTRIBUTING described only duplication and
fallback problems, while the architecture debt scout also reports
ownership, untrusted-authority and unenforced-grant problems through that
form. Widen both descriptions to match. Correct the README CI trigger to
pushes to main and pull requests.

This branch builds on docs/add-stability-blueprint, which adds the
BLUEPRINT.md the contract and toolkit checks link to; merge that first.

Validation, against the committed lockfiles:
- verify.py toolkit: checker passes, 28 tests pass
- verify.py portable packages: pass
2026-10-09 08:34:48 +00:00
dcc09f319d
docs: add engineering contract, contributor toolkit and templates
Add AGENTS.md as the single engineering contract: sources of truth,
evidence and proof requirements, ownership, working modes, the reviewed
change loop, maintenance isolation, decision authority, dependency and
fork rules, the 0.0.x to 0.1.0 release progression, and branch and
publication rules.

Add .agents/ with scope, implement, verify, maintenance and release
procedures; reviewer, architecture debt scout, simplicity and refactoring
roles; skills for the compositor, Servo rendering, runtime capabilities,
appd sessions, packages and data, Linux deployment, integration
verification and documentation; and verify.py, which runs the existing
check profiles with --locked from any directory, stops on the first
failure and supports --dry-run.

check_toolkit.py validates local links and heading anchors, metadata,
catalog coverage and issue forms. A new contributor-toolkit CI job runs
both. The structure follows the Resina Design System toolkit at
1e768064f57a1e403ab271822383e732795905a6, adapted to WEFT.

Validation, against the committed lockfiles:
- verify.py toolkit: checker passes, 28 runner/checker tests pass
- verify.py portable, demos, packages: pass
- verify.py linux, runtime, servo-embed: fail on existing defects
  (clippy collapsible_if in the winit backend, three clippy lints in
  weft-runtime with wasmtime-runtime, and an E0308 in the selected Servo
  revision's servo-layout); the runner reports the failing status

Add CONTRIBUTING.md, issue forms for defects and changes, maintenance
problems and decisions of direction, and a pull request template asking
for ownership, proof and the validation actually performed. README.md
links the contribution guide.
2026-10-09 08:34:48 +00:00
0d30ed4ed9
Merge branch 'main' into ci/drop-windows-job 2026-10-09 10:29:22 +02:00
51ca194acb
fix(runtime): close fetch and preopen gaps in grant enforcement
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.
2026-10-09 08:25:40 +00:00
29a7f6f508
ci: build and test on Linux only
WEFT OS targets Linux and systemd. The Windows runner only compiled and
tested the crates without Linux system libraries, which says nothing
about a supported configuration, and was the slowest job in every run.

The job is now `portable` on Ubuntu, matching the verification profile
of the same name. The building guide, README and development
environment notes now state that builds are validated on Linux only.
2026-10-09 08:16:59 +00:00
f9945c055c
fix(appd): report sessions running only after the UI host is ready
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
2026-10-09 01:41:09 +00:00
64f8cff6fd
fix(shells): paint and present Servo frames and report readiness truthfully
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
2026-10-09 01:02:26 +00:00
93b67834a7
build: select compiling Servo and Stylo fork revisions
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
2026-10-09 00:13:08 +00:00
2ae05312dc docs: correct openSUSE package names verified against rpmfind
- Replace Mesa-libEGL-devel and Mesa-libGLES-devel (do not exist on
  openSUSE) with libglvnd-devel (Khronos EGL/GLES dispatch headers)
- Replace libseat-devel (does not exist on openSUSE) with seatd-devel

Package names confirmed via rpmfind.net against Tumbleweed and Leap
repositories.
2026-03-12 20:52:34 +01:00
7b4dbcdaf6 docs: replace apt-get/Debian package references with openSUSE/zypper
- README.md: zypper install with openSUSE package names
- docs/building.md: zypper install with openSUSE package names
- crates/weft-servo-shell/SERVO_PIN.md: openSUSE package names,
  remove Fedora/RHEL note
2026-03-12 20:48:17 +01:00
0b26c2e548 docs: remove internal tracking labels from all public documentation
- README.md: remove internal tracking labels; replace with plain
  English descriptions
- docs/security.md: rename section heading, remove tracking reference
- crates/weft-servo-shell/SERVO_PIN.md: replace tracking labels with
  descriptive headings; rename section to Known limitations
2026-03-12 20:45:56 +01:00
e3504c324b feat(infra): NixOS VM config, CI type-check job, documentation
- flake.nix, infra/nixos/: NixOS VM with Mesa, virtio-gpu, Wayland,
  systemd user services for compositor and session supervisor
- infra/vm/: QEMU build and run scripts
- .github/workflows/ci.yml: add Linux job to type-check weft-servo-shell
  and weft-app-shell with --features servo-embed
- docs/architecture.md, docs/security.md, docs/building.md: replace
  stale pre-implementation design documents
- README.md: rewrite to reflect current codebase
- crates/weft-servo-shell/SERVO_PIN.md: update implementation status and add
  SpiderMonkey process boundary statement
2026-03-12 20:03:25 +01:00
afffe29090 docs: update README to accurately reflect current implementation state 2026-03-11 12:59:24 +01:00
8b65f81396 Initialize Rust workspace and repository metadata 2026-03-10 18:47:06 +01:00