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.
This commit is contained in:
Marco Allegretti 2026-10-09 10:03:30 +00:00
parent d60152f443
commit 16a184ad9e
No known key found for this signature in database
12 changed files with 269 additions and 140 deletions

110
Cargo.lock generated
View file

@ -6590,7 +6590,7 @@ dependencies = [
[[package]] [[package]]
name = "servo" name = "servo"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"bitflags 2.11.0", "bitflags 2.11.0",
@ -6651,7 +6651,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-allocator" name = "servo-allocator"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"libc", "libc",
"tikv-jemalloc-sys", "tikv-jemalloc-sys",
@ -6662,7 +6662,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-background-hang-monitor" name = "servo-background-hang-monitor"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"crossbeam-channel", "crossbeam-channel",
@ -6677,7 +6677,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-background-hang-monitor-api" name = "servo-background-hang-monitor-api"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"serde", "serde",
"servo-base", "servo-base",
@ -6686,7 +6686,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-base" name = "servo-base"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"crossbeam-channel", "crossbeam-channel",
@ -6711,7 +6711,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-canvas" name = "servo-canvas"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"crossbeam-channel", "crossbeam-channel",
@ -6736,7 +6736,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-canvas-traits" name = "servo-canvas-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"euclid", "euclid",
@ -6758,7 +6758,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-config" name = "servo-config"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
@ -6770,7 +6770,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-config-macro" name = "servo-config-macro"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -6781,7 +6781,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-constellation" name = "servo-constellation"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"content-security-policy", "content-security-policy",
@ -6828,7 +6828,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-constellation-traits" name = "servo-constellation-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"content-security-policy", "content-security-policy",
"encoding_rs", "encoding_rs",
@ -6863,7 +6863,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-deny-public-fields" name = "servo-deny-public-fields"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"syn", "syn",
"synstructure", "synstructure",
@ -6872,7 +6872,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-devtools" name = "servo-devtools"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"atomic_refcell", "atomic_refcell",
"base64 0.22.1", "base64 0.22.1",
@ -6901,7 +6901,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-devtools-traits" name = "servo-devtools-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"http 1.4.0", "http 1.4.0",
@ -6920,7 +6920,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-dom-struct" name = "servo-dom-struct"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -6930,7 +6930,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-embedder-traits" name = "servo-embedder-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"bitflags 2.11.0", "bitflags 2.11.0",
@ -6963,7 +6963,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-fonts" name = "servo-fonts"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 2.11.0", "bitflags 2.11.0",
@ -7016,7 +7016,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-fonts-traits" name = "servo-fonts-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"atomic_refcell", "atomic_refcell",
"dwrote", "dwrote",
@ -7039,7 +7039,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-geometry" name = "servo-geometry"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"app_units", "app_units",
"euclid", "euclid",
@ -7052,7 +7052,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-hyper-serde" name = "servo-hyper-serde"
version = "0.13.2" version = "0.13.2"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"cookie 0.18.1", "cookie 0.18.1",
"headers 0.4.1", "headers 0.4.1",
@ -7066,7 +7066,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-jstraceable-derive" name = "servo-jstraceable-derive"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn", "syn",
@ -7076,7 +7076,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-layout" name = "servo-layout"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"app_units", "app_units",
@ -7130,7 +7130,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-layout-api" name = "servo-layout-api"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"app_units", "app_units",
"atomic_refcell", "atomic_refcell",
@ -7164,7 +7164,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-malloc-size-of" name = "servo-malloc-size-of"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accountable-refcell", "accountable-refcell",
"app_units", "app_units",
@ -7204,7 +7204,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media" name = "servo-media"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"servo-media-audio", "servo-media-audio",
@ -7217,7 +7217,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-audio" name = "servo-media-audio"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"byte-slice-cast", "byte-slice-cast",
"euclid", "euclid",
@ -7240,7 +7240,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-derive" name = "servo-media-derive"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -7250,7 +7250,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-dummy" name = "servo-media-dummy"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"ipc-channel", "ipc-channel",
"servo-media", "servo-media",
@ -7264,7 +7264,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-player" name = "servo-media-player"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"ipc-channel", "ipc-channel",
"malloc_size_of_derive", "malloc_size_of_derive",
@ -7278,7 +7278,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-streams" name = "servo-media-streams"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"malloc_size_of_derive", "malloc_size_of_derive",
"servo-malloc-size-of", "servo-malloc-size-of",
@ -7288,7 +7288,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-thread" name = "servo-media-thread"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"euclid", "euclid",
"ipc-channel", "ipc-channel",
@ -7306,7 +7306,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-traits" name = "servo-media-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"malloc_size_of_derive", "malloc_size_of_derive",
"servo-malloc-size-of", "servo-malloc-size-of",
@ -7315,7 +7315,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-media-webrtc" name = "servo-media-webrtc"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"log", "log",
"servo-media-streams", "servo-media-streams",
@ -7325,7 +7325,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-metrics" name = "servo-metrics"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"malloc_size_of_derive", "malloc_size_of_derive",
"servo-base", "servo-base",
@ -7340,7 +7340,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-net" name = "servo-net"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"async-recursion", "async-recursion",
@ -7409,7 +7409,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-net-traits" name = "servo-net-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"content-security-policy", "content-security-policy",
"cookie 0.18.1", "cookie 0.18.1",
@ -7449,7 +7449,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-paint" name = "servo-paint"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"crossbeam-channel", "crossbeam-channel",
@ -7486,7 +7486,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-paint-api" name = "servo-paint-api"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"crossbeam-channel", "crossbeam-channel",
@ -7522,7 +7522,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-pixels" name = "servo-pixels"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"euclid", "euclid",
"image", "image",
@ -7537,7 +7537,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-profile" name = "servo-profile"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -7556,7 +7556,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-profile-traits" name = "servo-profile-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"ipc-channel", "ipc-channel",
@ -7573,7 +7573,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-script" name = "servo-script"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",
@ -7712,7 +7712,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-script-bindings" name = "servo-script-bindings"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"crossbeam-channel", "crossbeam-channel",
@ -7750,7 +7750,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-script-traits" name = "servo-script-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"content-security-policy", "content-security-policy",
@ -7787,7 +7787,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-storage" name = "servo-storage"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -7817,7 +7817,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-storage-traits" name = "servo-storage-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"malloc_size_of_derive", "malloc_size_of_derive",
"serde", "serde",
@ -7831,7 +7831,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-timers" name = "servo-timers"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"malloc_size_of_derive", "malloc_size_of_derive",
@ -7841,7 +7841,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-tracing" name = "servo-tracing"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -7851,7 +7851,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-url" name = "servo-url"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"encoding_rs", "encoding_rs",
"malloc_size_of_derive", "malloc_size_of_derive",
@ -7865,7 +7865,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-webgl" name = "servo-webgl"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"byteorder", "byteorder",
@ -7889,7 +7889,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-webgpu" name = "servo-webgpu"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"euclid", "euclid",
@ -7908,7 +7908,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-webgpu-traits" name = "servo-webgpu-traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"malloc_size_of_derive", "malloc_size_of_derive",
@ -7924,7 +7924,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-webxr" name = "servo-webxr"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"euclid", "euclid",
@ -7943,7 +7943,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-webxr-api" name = "servo-webxr-api"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"euclid", "euclid",
"ipc-channel", "ipc-channel",
@ -7959,7 +7959,7 @@ dependencies = [
[[package]] [[package]]
name = "servo-xpath" name = "servo-xpath"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/marcoallegretti/servo?rev=f0bb1aaf981b65c8dddc848bb647045d4c777d11#f0bb1aaf981b65c8dddc848bb647045d4c777d11" source = "git+https://github.com/marcoallegretti/servo?rev=5d90f51cf8156cd7f244a42e15f199c531116c21#5d90f51cf8156cd7f244a42e15f199c531116c21"
dependencies = [ dependencies = [
"log", "log",
"malloc_size_of_derive", "malloc_size_of_derive",

View file

@ -95,7 +95,7 @@ See `docs/security.md`. Key points:
## Servo fork ## Servo fork
- Servo: `https://github.com/marcoallegretti/servo` at `f0bb1aaf`, pinned by revision - Servo: `https://github.com/marcoallegretti/servo` at `5d90f51c`, pinned by revision
- Stylo: `https://github.com/marcoallegretti/stylo` at `f1ba4969`, through the root `[patch]` - Stylo: `https://github.com/marcoallegretti/stylo` at `f1ba4969`, through the root `[patch]`
- Patches: `backdrop-filter` parsing (Stylo) and rendering (Servo) - Patches: `backdrop-filter` parsing (Stylo) and rendering (Servo), rooting of compiled classic scripts and `navigator.servo` exposure (Servo)
- See `crates/weft-servo-shell/SERVO_PIN.md` for Servo integration status and known limitations - See `crates/weft-servo-shell/SERVO_PIN.md` for Servo integration status and known limitations

View file

@ -27,7 +27,7 @@ toml = { version = "0.8", optional = true }
[dependencies.servo] [dependencies.servo]
git = "https://github.com/marcoallegretti/servo" git = "https://github.com/marcoallegretti/servo"
rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" rev = "5d90f51cf8156cd7f244a42e15f199c531116c21"
optional = true optional = true
default-features = false default-features = false

View file

@ -48,6 +48,16 @@ impl ServoDelegate for WeftServoDelegate {
fn notify_error(&self, error: servo::ServoError) { fn notify_error(&self, error: servo::ServoError) {
tracing::error!(?error, "Servo error"); tracing::error!(?error, "Servo error");
} }
/// Loads not tied to the webview, such as `navigator.sendBeacon()`,
/// worklets and notification icons, also come from the application page,
/// and none of them is needed: all are refused.
fn load_web_resource(&self, load: servo::WebResourceLoad) {
let url = load.request().url.clone();
tracing::warn!(%url, "resource load outside the webview denied");
load.intercept(servo::WebResourceResponse::new(url))
.cancel();
}
} }
/// Frame and load progress reported by Servo, shared with the event loop. /// Frame and load progress reported by Servo, shared with the event loop.
@ -65,6 +75,8 @@ struct WeftWebViewDelegate {
signals: Arc<FrameSignals>, signals: Arc<FrameSignals>,
/// URL prefix of the application's UI directory; see `ui_scope`. /// URL prefix of the application's UI directory; see `ui_scope`.
scope: String, scope: String,
/// The UI directory with symbolic links resolved, if it exists.
ui_dir: Option<std::path::PathBuf>,
/// The bridge's WebSocket handshake URL, as the network layer requests it /// The bridge's WebSocket handshake URL, as the network layer requests it
/// (`ws:` becomes `http:`). /// (`ws:` becomes `http:`).
bridge: String, bridge: String,
@ -87,14 +99,18 @@ impl WebViewDelegate for WeftWebViewDelegate {
} }
} }
/// Every resource the page loads passes through here, including /// Every resource the webview loads passes through here, including
/// `fetch()`, XHR, subresources, redirects and WebSocket handshakes. The /// `fetch()`, XHR, subresources and WebSocket handshakes. The page may
/// page may read its own UI files and open the session bridge; any other /// read its own UI files and open the session bridge; any other local
/// local file or network destination is refused with a network error. /// file or network destination is refused with a network error. Network
/// Network access belongs to the component, under its fetch grants. /// access belongs to the component, under its fetch grants.
///
/// On a redirect Servo reports the first URL of the chain again, not the
/// target, so every redirect is refused.
fn load_web_resource(&self, _webview: servo::WebView, load: servo::WebResourceLoad) { fn load_web_resource(&self, _webview: servo::WebView, load: servo::WebResourceLoad) {
let url = load.request().url.clone(); let request = load.request();
if resource_allowed(url.as_str(), &self.scope, &self.bridge) { let url = request.url.clone();
if !request.is_redirect && self.allows(&ServoUrl::from_url(url.clone())) {
return; return;
} }
tracing::warn!(%url, "resource outside the application denied"); tracing::warn!(%url, "resource outside the application denied");
@ -160,15 +176,37 @@ fn in_scope(url: &str, scope: &str) -> bool {
}) })
} }
/// Whether an application page may load `url`: a file inside its UI impl WeftWebViewDelegate {
/// directory, an inline (`data:`, `blob:`, `about:`) resource, or the session /// Whether an application page may load `url`: a file inside its UI
/// bridge. /// directory, also after resolving symbolic links, an inline (`data:`,
fn resource_allowed(url: &str, scope: &str, bridge: &str) -> bool { /// `blob:`) resource, `about:blank`, or the session bridge.
in_scope(url, scope) fn allows(&self, url: &ServoUrl) -> bool {
|| url == bridge match url.scheme() {
|| ["data:", "blob:", "about:"] "file" => {
.iter() in_scope(url.as_str(), &self.scope)
.any(|scheme| url.starts_with(scheme)) && self.ui_dir.as_deref().is_some_and(|dir| {
url.to_file_path()
.ok()
.and_then(|path| path.canonicalize().ok())
.is_some_and(|path| path.starts_with(dir))
})
}
"data" | "blob" => true,
"about" => url.as_str() == "about:blank",
_ => url.as_str() == self.bridge,
}
}
}
/// The UI directory behind the URL prefix `scope`, with symbolic links
/// resolved.
fn ui_dir(scope: &str) -> Option<std::path::PathBuf> {
ServoUrl::parse(scope)
.ok()?
.to_file_path()
.ok()?
.canonicalize()
.ok()
} }
/// `value` as a single-quoted JavaScript string literal. /// `value` as a single-quoted JavaScript string literal.
@ -457,6 +495,7 @@ impl ApplicationHandler<ServoWake> for App {
.delegate(Rc::new(WeftWebViewDelegate { .delegate(Rc::new(WeftWebViewDelegate {
signals: Arc::clone(&self.signals), signals: Arc::clone(&self.signals),
scope: ui_scope(&self.url), scope: ui_scope(&self.url),
ui_dir: ui_dir(&ui_scope(&self.url)),
bridge: format!("http://127.0.0.1:{}/app", self.ws_port), bridge: format!("http://127.0.0.1:{}/app", self.ws_port),
})) }))
.user_content_manager(ucm) .user_content_manager(ucm)

View file

@ -27,7 +27,7 @@ tungstenite = "0.24"
[dependencies.servo] [dependencies.servo]
git = "https://github.com/marcoallegretti/servo" git = "https://github.com/marcoallegretti/servo"
rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" rev = "5d90f51cf8156cd7f244a42e15f199c531116c21"
optional = true optional = true
default-features = false default-features = false

View file

@ -6,13 +6,17 @@ The selected revisions are the ones recorded in the workspace `Cargo.lock`.
| Dependency | Source | Revision | Selected by | | Dependency | Source | Revision | Selected by |
|------------|--------|----------|-------------| |------------|--------|----------|-------------|
| Servo (`servo` crate) | <https://github.com/marcoallegretti/servo> | `f0bb1aaf981b65c8dddc848bb647045d4c777d11` | `rev` in both shell crates' `Cargo.toml` | | Servo (`servo` crate) | <https://github.com/marcoallegretti/servo> | `5d90f51cf8156cd7f244a42e15f199c531116c21` | `rev` in both shell crates' `Cargo.toml` |
| Stylo (`stylo`, `selectors`, `servo_arc`, ...) | <https://github.com/marcoallegretti/stylo> | `f1ba4969536d63f2e319a561e466c03e78b4a076` | `[patch."https://github.com/servo/stylo"]` in the root `Cargo.toml` | | Stylo (`stylo`, `selectors`, `servo_arc`, ...) | <https://github.com/marcoallegretti/stylo> | `f1ba4969536d63f2e319a561e466c03e78b4a076` | `[patch."https://github.com/servo/stylo"]` in the root `Cargo.toml` |
The Servo revision is `servo-weft` commit `8e7dc40` (backdrop-filter rendering) The Servo revision is `servo-weft` commit `8e7dc40` (backdrop-filter rendering),
plus `f0bb1aa`, which fixes that commit's `servo-layout` build errors. It lives plus `f0bb1aa`, which fixes that commit's `servo-layout` build errors, plus
on the fork branch `fix/backdrop-filter-build-errors` until it is merged into `b87e5a6`, which keeps compiled classic scripts rooted until they run, and
`servo-weft`; keep that branch until then so the revision stays fetchable. `5d90f51`, which withholds `navigator.servo` from `about:blank` and
`about:srcdoc` documents. It lives
on the fork branch `fix/root-pending-classic-scripts`, which is based on
`fix/backdrop-filter-build-errors`, until both are merged into `servo-weft`;
keep those branches until then so the revisions stay fetchable.
Servo's own `[patch]` table for Stylo does not apply to WEFT, because Cargo Servo's own `[patch]` table for Stylo does not apply to WEFT, because Cargo
only honours patches in the root workspace. Without the root override, WEFT only honours patches in the root workspace. Without the root override, WEFT
@ -37,7 +41,7 @@ servo-embed = ["dep:servo", "dep:winit", "dep:softbuffer"]
[dependencies.servo] [dependencies.servo]
git = "https://github.com/marcoallegretti/servo" git = "https://github.com/marcoallegretti/servo"
rev = "f0bb1aaf981b65c8dddc848bb647045d4c777d11" rev = "5d90f51cf8156cd7f244a42e15f199c531116c21"
optional = true optional = true
default-features = false default-features = false
@ -155,7 +159,7 @@ exercised is listed as unverified.
rather than tracking a branch, so a rebuild selects the same code. A pinned rather than tracking a branch, so a rebuild selects the same code. A pinned
revision must stay reachable from a published branch: never force-push, revision must stay reachable from a published branch: never force-push,
rebase or delete a branch that contains a revision a WEFT lockfile selects. rebase or delete a branch that contains a revision a WEFT lockfile selects.
Today Servo `f0bb1aa` is reachable only from `fix/backdrop-filter-build-errors` Today Servo `5d90f51` is reachable only from `fix/root-pending-classic-scripts`
and Stylo `f1ba496` only from Stylo's `servo-weft`. and Stylo `f1ba496` only from Stylo's `servo-weft`.
To move to new revisions: To move to new revisions:
@ -182,3 +186,5 @@ Each fork patch keeps its purpose, upstream status and removal condition here.
| Stylo: parse `backdrop-filter` for Servo | stylo `f1ba496` | Remove the `layout.unimplemented` gate | Not submitted | Upstream Stylo parses it for Servo | | Stylo: parse `backdrop-filter` for Servo | stylo `f1ba496` | Remove the `layout.unimplemented` gate | Not submitted | Upstream Stylo parses it for Servo |
| Servo: render `backdrop-filter` | servo `8e7dc40` | Stacking context and display list support | servo/servo issue [#41567](https://github.com/servo/servo/issues/41567) | Equivalent upstream support | | Servo: render `backdrop-filter` | servo `8e7dc40` | Stacking context and display list support | servo/servo issue [#41567](https://github.com/servo/servo/issues/41567) | Equivalent upstream support |
| Servo: fix `build_backdrop_filter` types | servo `f0bb1aa` | Make `servo-layout` compile | Part of the patch above | Same as above | | Servo: fix `build_backdrop_filter` types | servo `f0bb1aa` | Make `servo-layout` compile | Part of the patch above | Same as above |
| Servo: root compiled classic scripts | servo `b87e5a6` | A parser-blocking script waiting for a stylesheet was freed by a garbage collection and crashed the content process when it ran | Not submitted | Upstream roots or traces `ClassicScript::record` |
| Servo: no `navigator.servo` for blank and srcdoc documents | servo `5d90f51` | An application's `about:srcdoc` frame could change engine preferences | Not submitted | Upstream limits `ServoInternals` exposure the same way |

View file

@ -16,7 +16,7 @@ System UI host. Renders one WebView pointing at `system-ui.html` using the embed
### weft-app-shell ### weft-app-shell
Per-application Servo host. Spawned by `weft-appd` after the Wasm runtime signals READY. Takes `<app_id>` and `<session_id>` as arguments. Resolves `weft-app://<app_id>/ui/index.html` and injects the `weftIpc` WebSocket bridge into the page. The bridge authenticates with the per-session token from `WEFT_BRIDGE_TOKEN` and can only exchange messages with its own session. It is installed only in top-level documents inside the application's UI directory, and top-level navigation outside that directory is denied; framed documents never receive the bridge. Every resource the page loads (subresources, `fetch()`, XHR, redirects and WebSocket handshakes) is checked by the shell: the page may load files inside its UI directory, inline `data:`, `blob:` and `about:` resources, and the session bridge; any other local file or network destination fails with a network error. Network access belongs to the Wasm component, under its fetch grants. Registers with the compositor as window type `application`. Exits when the appd session ends. Per-application Servo host. Spawned by `weft-appd` after the Wasm runtime signals READY. Takes `<app_id>` and `<session_id>` as arguments. Resolves `weft-app://<app_id>/ui/index.html` and injects the `weftIpc` WebSocket bridge into the page. The bridge authenticates with the per-session token from `WEFT_BRIDGE_TOKEN` and can only exchange messages with its own session. It is installed only in top-level documents inside the application's UI directory, and top-level navigation outside that directory is denied; framed documents never receive the bridge. Every resource the page loads (subresources, `fetch()`, XHR, workers and WebSocket handshakes) is checked by the shell: the page may load files inside its UI directory, also after symbolic links are resolved, inline `data:` and `blob:` resources, `about:blank` and the session bridge; any other local file or network destination, and every redirect, fails with a network error. Loads Servo does not attribute to the webview, such as `navigator.sendBeacon()`, are all refused. Network access belongs to the Wasm component, under its fetch grants. Servo's privileged `navigator.servo` interface, which can change engine preferences, is not exposed to `about:blank` or `about:srcdoc` documents (a fork patch; see `crates/weft-servo-shell/SERVO_PIN.md`). Registers with the compositor as window type `application`. Exits when the appd session ends.
### weft-appd ### weft-appd

View file

@ -13,7 +13,7 @@ let
# One hash per git source in Cargo.lock: the Servo fork and the Stylo fork # One hash per git source in Cargo.lock: the Servo fork and the Stylo fork
# (keyed by its `selectors` crate). Every package vendors both, so both must # (keyed by its `selectors` crate). Every package vendors both, so both must
# match the pinned revisions. Recompute them whenever a revision changes. # match the pinned revisions. Recompute them whenever a revision changes.
# The Servo hash is not yet known for f0bb1aa; a Nix build reports it. # The Servo hash is not yet known for 5d90f51; a Nix build reports it.
outputHashes = { outputHashes = {
"servo-0.0.1" = pkgs.lib.fakeHash; "servo-0.0.1" = pkgs.lib.fakeHash;
"selectors-0.36.0" = "13y6pa19j4w2zsxfhv6mrl03wsa0frazlsssbqkzpwci8k9gzl4i"; "selectors-0.36.0" = "13y6pa19j4w2zsxfhv6mrl03wsa0frazlsssbqkzpwci8k9gzl4i";

View file

@ -9,21 +9,29 @@ The page probes, and paints one band per probe:
- the session bridge reaches the component, which answers; - the session bridge reaches the component, which answers;
- an image just outside its UI directory (../outside.png) fails to load; - an image just outside its UI directory (../outside.png) fails to load;
- an image elsewhere on disk (a file: URL) fails to load; - an image elsewhere on disk (a file: URL) fails to load;
- an image reached through a symbolic link in the UI directory fails to load;
- an image from a local HTTP server fails to load; - an image from a local HTTP server fails to load;
- a no-cors fetch from that server is rejected; - a no-cors fetch from that server is rejected;
- a WebSocket to a local listener fails. - a WebSocket to a local server that completes the handshake fails;
- a no-cors fetch from a worker is rejected;
- an about:srcdoc frame has no navigator.servo, which could change engine
preferences.
The page also imports a stylesheet, loads a font and sends a beacon to the
HTTP server, and frames an about:srcdoc document showing an image from it.
Each refused probe would succeed without the policy: the images are valid, Each refused probe would succeed without the policy: the images are valid,
the fetch accepts an opaque response and the listener accepts connections. the fetches accept an opaque response and the WebSocket server accepts the
upgrade. Every band must be green, and the HTTP server and the WebSocket
Every band must be green, and the HTTP server and the TCP listener must see server must see no connection at all, so the refusals happen in the
no connection at all, so the refusals happen in the renderer, not after a renderer, not after a request left it.
request left it.
Requires Xvfb, xwd and ImageMagick's convert. Requires Xvfb, xwd and ImageMagick's convert.
""" """
import argparse import argparse
import base64
import hashlib
import http.server import http.server
import shutil import shutil
import socket import socket
@ -40,8 +48,8 @@ from check_counter import AppdClient, free_port, read_endpoint # noqa: E402
from session import ROOT, Desktop, SessionError, missing_tools, parse_ppm, pixel # noqa: E402 from session import ROOT, Desktop, SessionError, missing_tools, parse_ppm, pixel # noqa: E402
APP_ID = "org.weft.test.confinement" APP_ID = "org.weft.test.confinement"
PROBES = ["own-image", "bridge", "outside-image", "other-image", "http-image", "http-fetch", PROBES = ["own-image", "bridge", "outside-image", "other-image", "linked-image", "http-image",
"websocket"] "http-fetch", "websocket", "worker-fetch", "srcdoc-internals"]
GREEN = (0, 192, 0) GREEN = (0, 192, 0)
# The app window's page area on the 1024x768 nested desktop. # The app window's page area on the 1024x768 nested desktop.
PAGE_TOP, PAGE_HEIGHT, PAGE_X = 35, 600, 400 PAGE_TOP, PAGE_HEIGHT, PAGE_X = 35, 600, 400
@ -59,10 +67,10 @@ def png():
class Counting(http.server.BaseHTTPRequestHandler): class Counting(http.server.BaseHTTPRequestHandler):
requests = 0 requests = []
def do_GET(self): def do_GET(self):
Counting.requests += 1 Counting.requests.append(f"{self.command} {self.path}")
body = png() body = png()
self.send_response(200) self.send_response(200)
self.send_header("Content-Type", "image/png") self.send_header("Content-Type", "image/png")
@ -71,49 +79,79 @@ class Counting(http.server.BaseHTTPRequestHandler):
self.end_headers() self.end_headers()
self.wfile.write(body) self.wfile.write(body)
do_POST = do_GET
def log_message(self, *args): def log_message(self, *args):
pass pass
def make_package(store, http_port, tcp_port, other): def websocket_server(connections, stop):
package = store / APP_ID """A listener that completes WebSocket handshakes, so a WebSocket that
(package / "ui").mkdir(parents=True) reaches it opens. Returns its port."""
(package / "wapp.toml").write_text(
f'[package]\nid = "{APP_ID}"\nname = "Confinement"\nversion = "0.1.0"\n'
'[runtime]\nmodule = "app.wasm"\n[ui]\nentry = "ui/index.html"\n')
shutil.copy(ROOT / "examples/org.weft.demo.counter/app.wasm", package / "app.wasm")
page = (Path(__file__).parent / "confinement/index.html").read_text()
page = (page.replace("@HTTP_PORT@", str(http_port)).replace("@TCP_PORT@", str(tcp_port))
.replace("@OTHER_URL@", other.as_uri()))
(package / "ui/index.html").write_text(page)
(package / "ui/own.png").write_bytes(png())
(package / "outside.png").write_bytes(png())
other.write_bytes(png())
def run(args, desktop, store):
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Counting)
threading.Thread(target=server.serve_forever, daemon=True).start()
listener = socket.socket() listener = socket.socket()
listener.bind(("127.0.0.1", 0)) listener.bind(("127.0.0.1", 0))
listener.listen() listener.listen()
listener.settimeout(0.2) listener.settimeout(0.2)
connections = []
def accept(): def serve():
while not stop.is_set(): while not stop.is_set():
try: try:
connection = listener.accept()[0] connection = listener.accept()[0]
except OSError: except OSError:
continue continue
connections.append(connection) connections.append(connection)
connection.close() connection.settimeout(5)
try:
request = b""
while b"\r\n\r\n" not in request:
chunk = connection.recv(4096)
if not chunk:
break
request += chunk
key = next((line.split(b":", 1)[1].strip() for line in request.split(b"\r\n")
if line.lower().startswith(b"sec-websocket-key:")), b"")
accept = base64.b64encode(hashlib.sha1(
key + b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest())
connection.sendall(b"HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\n"
b"Connection: Upgrade\r\nSec-WebSocket-Accept: " + accept
+ b"\r\n\r\n")
except OSError:
pass
listener.close()
threading.Thread(target=serve, daemon=True).start()
return listener.getsockname()[1]
def make_package(store, http_port, ws_port, other_dir):
package = store / APP_ID
(package / "ui").mkdir(parents=True)
(package / "wapp.toml").write_text(
f'[package]\nid = "{APP_ID}"\nname = "Confinement"\nversion = "0.1.0"\n'
'[runtime]\nmodule = "app.wasm"\n[ui]\nentry = "ui/index.html"\n')
shutil.copy(ROOT / "examples/org.weft.demo.counter/app.wasm", package / "app.wasm")
fixture = Path(__file__).parent / "confinement"
other = other_dir / "other.png"
page = (fixture / "index.html").read_text()
page = (page.replace("@HTTP@", f"http://127.0.0.1:{http_port}/")
.replace("@WS@", f"ws://127.0.0.1:{ws_port}/")
.replace("@OTHER_URL@", other.as_uri()))
(package / "ui/index.html").write_text(page)
shutil.copy(fixture / "worker.js", package / "ui/worker.js")
(package / "ui/own.png").write_bytes(png())
(package / "outside.png").write_bytes(png())
other.write_bytes(png())
(package / "ui/linked").symlink_to(other_dir)
def run(args, desktop, store, other_dir):
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Counting)
threading.Thread(target=server.serve_forever, daemon=True).start()
stop = threading.Event() stop = threading.Event()
threading.Thread(target=accept, daemon=True).start() connections = []
ws_port = websocket_server(connections, stop)
try: try:
make_package(store, server.server_port, listener.getsockname()[1], make_package(store, server.server_port, ws_port, other_dir)
store.parent / f"{store.name}-other.png")
t = Path(args.target) t = Path(args.target)
desktop.launch_client("appd", [t / "weft-appd"], { desktop.launch_client("appd", [t / "weft-appd"], {
"WEFT_RUNTIME_BIN": str(t / "weft-runtime"), "WEFT_RUNTIME_BIN": str(t / "weft-runtime"),
@ -143,12 +181,11 @@ def run(args, desktop, store):
if failed: if failed:
raise AssertionError(f"probes not as required: {failed} ({colours})") raise AssertionError(f"probes not as required: {failed} ({colours})")
if Counting.requests or connections: if Counting.requests or connections:
raise AssertionError(f"requests left the renderer: {Counting.requests} HTTP, " raise AssertionError(f"requests left the renderer: HTTP {Counting.requests}, "
f"{len(connections)} TCP") f"{len(connections)} WebSocket")
finally: finally:
stop.set() stop.set()
server.shutdown() server.shutdown()
listener.close()
def main(argv=None): def main(argv=None):
@ -168,11 +205,12 @@ def main(argv=None):
print("missing: " + ", ".join(missing), file=sys.stderr) print("missing: " + ", ".join(missing), file=sys.stderr)
return 2 return 2
store = Path(tempfile.mkdtemp(prefix="weft-store-")) store = Path(tempfile.mkdtemp(prefix="weft-store-"))
other_dir = Path(tempfile.mkdtemp(prefix="weft-other-"))
try: try:
with Desktop(args.compositor, args.output, outputs=["appd.log", "confinement.ppm"]) \ with Desktop(args.compositor, args.output, outputs=["appd.log", "confinement.ppm"]) \
as desktop: as desktop:
try: try:
run(args, desktop, store) run(args, desktop, store, other_dir)
except AssertionError: except AssertionError:
(args.output / "confinement.ppm").write_bytes(desktop.capture()) (args.output / "confinement.ppm").write_bytes(desktop.capture())
raise raise
@ -182,7 +220,7 @@ def main(argv=None):
return 1 return 1
finally: finally:
shutil.rmtree(store, ignore_errors=True) shutil.rmtree(store, ignore_errors=True)
(store.parent / f"{store.name}-other.png").unlink(missing_ok=True) shutil.rmtree(other_dir, ignore_errors=True)
print("confinement check passed") print("confinement check passed")
return 0 return 0

View file

@ -106,23 +106,33 @@ def install_app(store, page):
def slow_style(directory, delay): def slow_style(directory, delay):
"""Create `directory/reveal.css`, a stylesheet revealing the page, that """Create `directory/reveal.css`, a stylesheet revealing the page, that
cannot be opened until `delay` seconds have passed. A write lease makes cannot be opened until `delay` seconds after the host first tries to. A
any other process's open() wait until the lease is released. The write lease makes another process's open() wait until the lease is
stylesheet is a local file next to the page, so an application host released, and the kernel signals the holder when an open() starts
confined to its UI directory may load it.""" waiting. The stylesheet is a local file next to the page, so an
application host confined to its UI directory may load it."""
sheet = directory / "reveal.css" sheet = directory / "reveal.css"
sheet.write_text("body { visibility: visible; }", encoding="utf-8") sheet.write_text("body { visibility: visible; }", encoding="utf-8")
# The kernel signals the lease holder when another open() waits on it.
signal.signal(signal.SIGIO, signal.SIG_IGN)
lease = os.open(sheet, os.O_WRONLY) lease = os.open(sheet, os.O_WRONLY)
fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_WRLCK) held = threading.Event()
def release(): def release():
time.sleep(delay)
fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_UNLCK) fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_UNLCK)
os.close(lease) os.close(lease)
threading.Thread(target=release, daemon=True).start() def opening(_signal, _frame):
if not held.is_set():
held.set()
timer = threading.Timer(delay, release)
timer.daemon = True
timer.start()
signal.signal(signal.SIGIO, opening)
try:
fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_WRLCK)
except OSError as error:
os.close(lease)
raise SessionError(f"cannot hold back {sheet} with a file lease: {error}") from error
def hidden_until_styled(page, destination): def hidden_until_styled(page, destination):

View file

@ -4,9 +4,12 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>confinement</title> <title>confinement</title>
<style> <style>
@import url('@HTTP@style.css');
@font-face { font-family: probe; src: url('@HTTP@font.woff'); }
html, body { margin: 0; height: 100%; } html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; } body { display: flex; flex-direction: column; font-family: probe; }
div { flex: 1; background: #808080; } div { flex: 1; background: #808080; }
iframe { position: absolute; width: 1px; height: 1px; border: 0; }
</style> </style>
</head> </head>
<body> <body>
@ -14,17 +17,24 @@
<div id="bridge"></div> <div id="bridge"></div>
<div id="outside-image"></div> <div id="outside-image"></div>
<div id="other-image"></div> <div id="other-image"></div>
<div id="linked-image"></div>
<div id="http-image"></div> <div id="http-image"></div>
<div id="http-fetch"></div> <div id="http-fetch"></div>
<div id="websocket"></div> <div id="websocket"></div>
<div id="worker-fetch"></div>
<div id="srcdoc-internals"></div>
<span>probe</span>
<iframe srcdoc="<img src='@HTTP@srcdoc.png'><script>parent.postMessage('servo:' + typeof navigator.servo, '*');</script>"></iframe>
<script> <script>
// One band per probe: green when the outcome matches the policy, red when it // One band per probe: green when the outcome matches the policy, red when it
// does not. Every refused probe would succeed without the policy: the images // does not. Every refused probe would succeed without the policy: the images
// are valid PNG files, the fetch uses no-cors, so an opaque response would // are valid PNG files, the fetches use no-cors, so an opaque response would
// resolve it, and the WebSocket listener accepts connections. The harness // resolve them, and the WebSocket listener completes the handshake. The
// substitutes the ports and the path of a file outside the package. // stylesheet import, the font, the frame's image and the beacon have no band;
var HTTP = 'http://127.0.0.1:@HTTP_PORT@/'; // the harness requires that none of them reaches its server. The harness
var TCP = 'ws://127.0.0.1:@TCP_PORT@/'; // substitutes the server URLs and the path of a file outside the package.
var HTTP = '@HTTP@';
var WS = '@WS@';
var OTHER = '@OTHER_URL@'; var OTHER = '@OTHER_URL@';
function mark(id, ok) { function mark(id, ok) {
@ -40,19 +50,39 @@ function image(id, src, shouldLoad) {
image('own-image', 'own.png', true); image('own-image', 'own.png', true);
image('outside-image', '../outside.png', false); image('outside-image', '../outside.png', false);
image('other-image', OTHER, false); image('other-image', OTHER, false);
image('linked-image', 'linked/other.png', false);
image('http-image', HTTP + 'image.png', false); image('http-image', HTTP + 'image.png', false);
fetch(HTTP + 'probe', { mode: 'no-cors' }).then( fetch(HTTP + 'probe', { mode: 'no-cors' }).then(
function () { mark('http-fetch', false); }, function () { mark('http-fetch', false); },
function () { mark('http-fetch', true); }); function () { mark('http-fetch', true); });
try { try {
var ws = new WebSocket(TCP); var ws = new WebSocket(WS);
ws.onopen = function () { mark('websocket', false); }; ws.onopen = function () { mark('websocket', false); };
ws.onerror = function () { mark('websocket', true); }; ws.onerror = function () { mark('websocket', true); };
} catch (e) { } catch (e) {
mark('websocket', true); mark('websocket', true);
} }
try {
var worker = new Worker('worker.js');
worker.onmessage = function (event) { mark('worker-fetch', event.data === 'refused'); };
worker.onerror = function () { mark('worker-fetch', false); };
worker.postMessage(HTTP + 'worker');
} catch (e) {
mark('worker-fetch', false);
}
// A srcdoc frame holds this page's content and must not reach the engine's
// privileged navigator.servo interface.
addEventListener('message', function (event) {
if (typeof event.data === 'string' && event.data.indexOf('servo:') === 0) {
mark('srcdoc-internals', event.data === 'servo:undefined');
}
});
try { navigator.sendBeacon(HTTP + 'beacon', 'probe'); } catch (e) {}
(function bridge() { (function bridge() {
if (!window.weftIpc) { setTimeout(bridge, 50); return; } if (!window.weftIpc) { setTimeout(bridge, 50); return; }
window.weftIpc.onmessage = function (raw) { window.weftIpc.onmessage = function (raw) {

View file

@ -0,0 +1,6 @@
// Reports whether a fetch to the URL it is sent leaves the worker.
onmessage = function (event) {
fetch(event.data, { mode: 'no-cors' }).then(
function () { postMessage('fetched'); },
function () { postMessage('refused'); });
};