0.1.9
0.1.8 was never published to npm: its manifests were generated with
npminstead ofpnpm, which leftworkspace:*in the publishedoptionalDependencies. 0.1.9 carries the same changes with correct manifests.
Hardening on top of the 0.1.7 charter. Four things: the privileged channel is now bound to the document the kernel stamped, the web process sandbox is set explicitly instead of inherited, the Node bridge can be granted per handler rather than as a whole, and the grants can be scoped to the documents you name with an automatic lock when the window navigates away.
Two packaging and SDK bugs are fixed alongside them: packaged artifacts were
shipping without the stock native modules, and app.on('second-instance') never
fired. Window corners are now rounded on every webview — including the
embedded ones and the window-button bar — following the desktop theme instead of
a hardcoded fallback, and two layers that were painting the corners back are
gone. app.info().version reports the real version instead of a frozen 0.1.0.
The benchmark harness was under-reporting the footprint because of the
packaging bug.
Document token: the channel belongs to one document
The bridge script is stamped with a per-window secret at injection time and
every message must carry it. The token lives in a closure inside the injected
script — never on window — so a script that did not receive that injection has
no way to obtain it.
That closes a real hole proven by the e2e suite: the native message handler is
registered per view, so a subframe could previously postMessage raw
messages straight into the kernel (a granted call would have executed even
though window.ow does not exist there). Now:
- a subframe's raw call is dropped by the kernel (it does not even reach the charter, so it is not audited — it never happened);
- the privileged document keeps working unchanged (
ow.invoke,ow.emit,invokeSyncandow-rpc://all carry the token automatically).
The same check runs on every renderer path, because they are equally
reachable and ow-rpc:// is registered as CORS-enabled:
| Path | Where the token is checked |
|---|---|
ow.invoke / ow.emit (postMessage) |
Window/Common/Messages.cpp |
ow-rpc:// (fetch) |
Webview/linux/Backend/Protocols.cpp, Webview/win/Backend/Handlers.cpp |
invokeSync (ow-sync://, blocking XHR) |
Webview/linux/Backend/Protocols.cpp |
Messages that fail the check are logged as
bridge: unauthenticated message dropped (document token mismatch).
Explicit process sandbox
webkit_web_context_set_sandbox_enabled(context, TRUE) is now called on the web
context and the resulting state is logged:
[ow] webview: sandbox del web process: on
The web process is what runs page JS, so this is the OS-level boundary — the
equivalent of Electron's sandbox: true. Before this it was left to the WebKit
build default.
Declared Node surface
Granting the Node bridge no longer means granting every handler the main process registered. The capability names the handler:
defineCharter({ allow: ['node:myapp.save', 'node:myapp.open'] })
node:myapp.savegrants exactlyapp.handle('myapp.save', …).node:call(andnode:*) keeps working as the legacy "any handler" grant, so existing apps do not break.- A refused handler is audited with its own name
(
charter: capability 'node:myapp.deleteEverything' is not granted…), which turns the audit trail into an inventory of what the page actually tried to reach.
Tests
tests/e2e/charter_guard.py — 23 assertions / 0 failures against a live
kernel, including the ones that cover this release:
surface.names.the.handler/surface.refuses.other.handlers— per-handler granularity.bridge.raw.iframe.call.dropped— a subframe's raw call for a granted capability has no effect.bridge.raw.iframe.not.dispatched— and it is not even audited, i.e. the kernel dropped it before dispatch.bridge.granted.call.still.works— the same capability, used from the privileged document, still works (through the token-checkedow-rpc://path).origins.stored/origins.allows.declared.document— the origins reach the kernel and the declared document keeps its grants.origins.auto.lock— after navigating to the same server through a different host (localhost→127.0.0.1), the very same call is refused withcharter: the current document is not in the declared origins.
tests/charter_test.cpp (ctest) covers the matching rules of every kind of
entry, deny beating allow, handler-scoped grants, clear/forget, and the
origin matcher including the fail-closed case for an unknown URL.
The standard suite stays green: 48 OK / 0 failures (all, builtins,
veto + the SDK path), with 0 unauthenticated messages in normal operation,
and ctest 5/5.
Benchmarks
The policy check is measured deterministically in tests/charter_test.cpp
(2,000,000 iterations per row), over a loop-only baseline: no charter 47 ns,
granted 277 ns, denied 257 ns, and the document token compare 0.3 ns.
Worst case is 277 ns = 0.0415% of the 668 µs IPC round-trip reported in
benchmarks/RESULTS.md, so the charter does not move the needle on call
latency.
The end-to-end script (benchmarks/charter/bench.py) is kept but its delta is
below the noise of a loaded machine — two runs of the same binary disagreed
by more than the effect, including "allow" coming out faster than "off". The
only reproducible end-to-end effect is the audit event: a refused call broadcasts
charter.denied, so denials cost more than grants by design. Details in
benchmarks/charter/RESULTS.md.
The suite also corrects the Size column of benchmarks/RESULTS.md. It
measured build/linux-release/src/owear plus build/linux-release/api — a
path that stopped existing when the APIs moved to src/api/. The miss was
silent (du failing on a missing directory returned None, which or 0 turned
into a clean zero), so the 17 stock modules were never counted and the published
footprint was the bare kernel. It is now the kernel plus the stock modules,
counting only the final .so/.dylib rather than the whole build tree:
3.9 MB, and a net score of 75% instead of 70%.
Origin scoping and auto-lock
The charter is per window, so by default the grants follow the window wherever
it navigates — the same footgun Electron's preload has. origins closes it:
defineCharter({
allow: [charterPresets.shell, 'fs:readText'],
origins: [charterPresets.localOrigins], // 'app://*', 'http://localhost:*', …
})
- Patterns are globs against the full URL, and a trailing
*is added when missing, so a bare origin matches its paths. - Empty
origins(the default) keeps the old behaviour: any document. - Auto-lock: navigating to a document outside the list refuses every
grant until the window comes back, with
charter: the current document is not in the declared origins: <url>and an audit event whose capability isorigin. - The URL comes from the platform backend (
GetURL()onIWebviewBackend, implemented for WebKitGTK and WebView2). If a backend cannot report it, the check fails closed.
Packaged apps carry the stock modules
ow build app copied the kernel executable on its own and left behind the
sibling modules/ directory that holds the stock modules. A packaged app
therefore launched, opened its window, and then failed at the first call into
any of them — the dispatcher rejecting the unknown function as
función desconocida: dialog/messageBox.
The failure was silent by construction: the loader skips non-existent search
directories, so startup only logged
funciones de módulos dinámicos cargadas: 0 (both messages come from the
kernel, whose runtime strings are in Spanish) and nothing surfaced until a user
clicked a button.
The stock modules are now copied into the bundle and into every staged layout.
The loader does not recurse (src/Core/ModuleLoader.cpp:112), so they are laid
out one .so per module; the app's own native/*.cpp modules are copied
afterwards and win any name collision. This covers binary, deb, appimage
and msi, plus the installer payload, which is assembled through the same path.
The cost is honest and measurable: the single-file artifact goes from 1.9 MB to 2.8 MB, and the measured footprint from 1.8 MB to 3.9 MB. The modules were always required to run; the footprint simply was not counting them.
app.on('second-instance') fires again
requestSingleInstanceLock made the kernel emit the event, but built-in modules
publish on the module.event control channel while the SDK only listened to
app.event — so app.on('second-instance') never fired. The Starter template
ships that exact subscription, so every app generated with ow create had a
dead listener. The SDK now maps the kernel's camelCase secondInstance onto
the public kebab-case name.
Every webview follows the window corners
A frameless window used to round only its own webview. Embedded webviews
(webview.create) painted square, so any child covering a window edge hid the
rounded corners of the main one behind it — the overlay child is drawn on
top, so the square won. That is why a browser built on Owear showed square
corners under titleBarStyle: 'custom'.
The corner rounding is now a shared helper applied to every webview the
kernel creates. Each corner is decided independently: a webview rounds only the
corners that actually touch a window edge, so a panel in the middle of a window
keeps its square corners instead of looking like a floating window. Moving a
webview (webview.setBounds) recomputes them, and the applied stylesheet is
replaced rather than accumulated.
An embedded webview also no longer grows past the bounds it was given.
gtk_widget_set_size_request() sets a minimum, not a maximum, and WebKit asks
for its natural size as the page loads — and again when the view takes focus on
a click. The container then expanded downwards and covered whatever was below
it, which in a browser ate the status bar. The child's own size request is now
pinned to 1×1 so the bounds passed to setBounds are what actually govern.
[ow] window: esquinas del tema: 15px (izq=1 arr=1 der=1 abj=1) ← la principal
[ow] window: esquinas del tema: 15px (izq=1 arr=0 der=0 abj=0) ← una embebida
The radius also follows the desktop theme properly now. It was read only from
gtk-3.0/, so on a theme that ships the rule in gtk-4.0/ it silently fell
back to 10px — rounded, but not your rounded. It now tries gtk-4.0,
gtk-3.20 and gtk-3.0, and gtk-light.css alongside gtk-dark.css, in
theme order. The lookup is cached per theme name: setBounds arrives on every
scroll, and re-reading the theme's CSS from disk each time was not an option.
Values are clamped to 64px, because some themes ship border-radius: 9999px to
get a circle and the webview would end up looking like a pill.
Two things were painting the corners back
Rounding the web content is only half of it — whatever sits under it fills the clipped corner instead. Two layers were doing that.
backgroundColor cancelled the transparency. In a frameless window the
main webview's background is set to fully transparent so the rounded corners
show the desktop. backgroundColor then set it back to opaque, later in the
same function, so any app passing a background colour lost its rounded corners
and got square ones painted in that colour — black-looking when the colour is
dark. It now keeps alpha 0 when the window is frameless; the colour still
applies where it is actually visible, the page's own background.
The window-button bar drew a square. With titleBarOverlay the theme's own
min/max/close buttons sit in a box against the top-right corner, and that box
painted its background over the rounded corner. It now carries the theme radius
on its top-right corner only, dropping to 0 when maximised or fullscreen — which
is exactly when the window has no rounded corners either — and the radius is
re-applied when the window is maximised.
app.info().version finally reports the real version
OW_VERSION_STRING was hardcoded to 0.1.0 in two places and nobody bumped
it, so app.info().version answered 0.1.0 no matter what the package said —
while npm was already at 0.1.7. CMake now reads the version from package.json,
which is what tools/version.mjs already treats as the source of truth, so the
kernel, the SDK and the registry cannot drift again.
Not in this release
Isolated world on WebKitGTK (webkit_user_script_new_for_world) remains the
defense-in-depth item: with the document token, the origin lock and the
kernel-side enforcement in place, it no longer guards against anything that is
reachable today.