WEFT_OS/.github/workflows/ci.yml
Marco Allegretti 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

135 lines
4 KiB
YAML

name: ci
on:
push:
branches:
- main
pull_request:
jobs:
# Crates that must compile on every supported host platform.
cross-platform:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.93.0
components: rustfmt, clippy
- name: cargo fmt
run: cargo fmt --all --check
- name: cargo clippy (cross-platform crates)
run: >
cargo clippy --workspace
--exclude weft-compositor
--exclude weft-servo-shell
--exclude weft-app-shell
--all-targets -- -D warnings
- name: cargo test (cross-platform crates)
run: >
cargo test --workspace
--exclude weft-compositor
--exclude weft-servo-shell
--exclude weft-app-shell
# Wayland compositor and other Linux-only system crates.
# These require libwayland-server and other Linux kernel interfaces.
linux-only:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.93.0
components: rustfmt, clippy
- name: install Linux system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends \
libwayland-dev \
libxkbcommon-dev \
libegl-dev \
libgles2-mesa-dev \
libgbm-dev \
libdrm-dev \
libinput-dev \
libseat-dev \
libudev-dev \
libsystemd-dev \
libdisplay-info-dev \
pkg-config
- name: cargo clippy (linux-only crates)
run: >
cargo clippy
-p weft-compositor
-p weft-servo-shell
-p weft-app-shell
--all-targets -- -D warnings
- name: cargo test (linux-only crates)
run: >
cargo test
-p weft-compositor
-p weft-servo-shell
-p weft-app-shell
# weft-runtime with its Wasm engine and fetch support, exercised on a real
# component under each kind of capability grant.
runtime-grants:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.93.0
components: clippy
targets: wasm32-wasip2
- name: cargo clippy (weft-runtime with wasmtime-runtime and net-fetch)
run: >
cargo clippy
-p weft-runtime
--features wasmtime-runtime,net-fetch
--all-targets -- -D warnings
- name: cargo build (weft-runtime with wasmtime-runtime and net-fetch)
run: cargo build -p weft-runtime --features wasmtime-runtime,net-fetch
- name: grants check
run: python3 -B tests/runtime/check_grants.py
# Type-check the servo-embed feature gate.
# Full Servo compilation (30-60 min) is not run in CI; this job checks
# that the feature-gated code at least type-checks against the declared deps.
servo-embed-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.93.0
- name: install Linux system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends \
libwayland-dev \
libxkbcommon-dev \
libegl-dev \
libgles2-mesa-dev \
libgbm-dev \
libdrm-dev \
libfontconfig-dev \
llvm \
pkg-config
- name: cargo check servo-embed (weft-servo-shell)
run: >
cargo check
-p weft-servo-shell
--features servo-embed
- name: cargo check servo-embed (weft-app-shell)
run: >
cargo check
-p weft-app-shell
--features servo-embed