Repository navigation
Ariadne shell SH11: the network, credentials, keys and sign-ins per principal - #1576
Merged
Merged
Conversation
…rincipal A program's verbs are bound to the network of the principal its scope runs as (docs/roadmap/ARIADNE_SHELL.md 4.12), so a document mounted beside nicotina cannot post as the reader or reach the origins nicotina may. - principal.h: a table per app of scope to principal (local, file:<dir>, remote:<origin>), the innermost recorded scope deciding and a local one inside a sandboxed one unable to raise it; hosts may check a principal as it is recorded. - CredentialStore: one store and file, viewed per principal (for_principal); each view has its own entries, bindings and renewers. File lines are "<principal> <name> <origin> <token>"; three-word lines load as local. - enable_net: each program's http verbs, fetch, http-upload, ws-*, net-*, open-url and oidc-* use net_host_access(app, scope): the launcher's for local, its own origin and granted origins for remote:, granted origins only for file:. A local application may have its own policy, credential store and e2ee store. - WebSocket handles and OIDC sign-ins are their owner's; a sandboxed principal's sign-ins are not posted to the global oidc# channel. - e2ee: a sandboxed principal gets its own in-memory key store. - Pictures, video and Save with auth: are fetched as the widget's principal. - Tests: ariadne_net_principal_test (credential isolation, allowlists, the file, nicotina's own policy and store against a local stand-in, WebSockets, sign-ins, e2ee, pictures) and the store's own in net_policy_test.
transfix
marked this pull request as ready for review
November 27, 2026 05:12
The new scope member sat between auth and w in ImageRequest, so the positional initializers in ariadne_media_test.cpp (uri, auth, w, h, fit, shape) no longer compiled, and every package job failed on it. Each struct now ends with scope, so an initializer written before SH11 still lines up and leaves scope empty (the launcher's).
…principals-8f9594
- open_mount records the mount's principal (SH1's mount_principal, with the entry's net_policy, credential_store and e2ee_store) under its scope before any of its programs is built; a check that fails refuses the mount. close_mount and the Runtime's teardown clear it. - shell.ari: a catalog entry's net_policy, credential_store and e2ee_store (relative to the catalog) are kept with its row; such an entry opens under its slug with them written into shell.apps.<slug> first. - Tests: a catalog mount as local and another file as file:<dir> (credentials and allowlist), a local application's own network from its entry and the refusals, and shell.ari's catalog entry with its own network. - ARIADNE.md 6.7 lists the entry's keys; ARIADNE_SHELL.md's SH11 note says where the principal is recorded.
…bare name - close_mount cleared the mount's principal right after quit_app, before the children that share its scope were killed, and the Runtime's teardown before the group's own teardown reaped what was left. A program built in between would have run as the scope's parent, local in a catalog shell. Both now clear it once the mount's processes are gone. - mount_principal gave "file:" (no directory) for a mount whose name has no directory and whose loader gives no canonical path, and SH11's store refuses an empty file: principal, so open_mount refused every such mount (AriadneDeepNesting.AMountsSlotsEntriesDraw, from #1586). Such a name is in the current directory: file:.
transfix
enabled auto-merge (squash)
November 27, 2026 20:12
AriadneComponents.ShellGivesACatalogEntryItsOwnNetwork compared the credential store's path with temp_directory_path() / ... after lexically_normal. On the windows-2022 runner the temp directory comes back in its 8.3 spelling (C:/Users/RUNNER~1/...), while the store's path is resolved to long names, so the same file compared unequal. Both sides are now weakly_canonical. Reproduced locally with TMP set to a short-name folder: the old assertion fails, the new one passes.
transfix
added a commit
that referenced
this pull request
Nov 27, 2026
…l's own left out From SH11's review of the hand-off (#1576): - policy_origin is cvc::net::parse_origin_spec(spec)->str(), the parse SH11's net host reads net_origins with. An origin it refuses (a path after it, not http(s)) is refused at grant time with its reason, in the requires: warning, the grants: warning and the mount's refusal: the net host would otherwise fail every request of the mount without a word. - The origins a mount holds are worked out with its principal before the wrapper moves, so SH11's set_scope_principal block can take them before any program is built, and a remote: principal's own origin is left out (it reaches it anyway; listing it only costs a cache key). Tests: AriadneGrants.PolicyOriginsAndSignalNames (a path refused, with its reason), AriadneGrantsRuntime.AMountHoldsTheOriginsItsSlotGrants (a mount asking for an origin with a path is refused, naming why).
Conflicts resolved keeping both sides: - open_mount: #1594's mount_principal(..., slot.catalog), then SH11's block recording the principal (a flag change reopens the entry through close_mount and open_mount, so the new principal is recorded again). - shell.ari shell-open: sets the catalog flag on what it opens, as #1594 does; an entry with a network of its own opens under its slug with its flag and network written first, so it opens as local. - ARIADNE.md 6.8: #1594's paragraph, plus SH11's sentence on what a principal reaches. ARIADNE_SHELL.md's SH11 note says so.
transfix
added a commit
that referenced
this pull request
Nov 28, 2026
SH11's ScopePrincipal::net_origins now gets what SH7 grants: open_mount records a mount's held origins with its principal, and a hot reload that changes them records the new list. Conflicts kept both sides (the source list takes principal.cpp and grants.cpp; the shell entry list takes grants/argv and net_policy/credential_store/e2ee_store; finish_context passes the scope to install_host_verbs and the held grants to has?).
transfix
added a commit
that referenced
this pull request
Nov 28, 2026
docs/ARIADNE.md: the mounts entry keys keep both SH3's background and SH11's net_policy, credential_store and e2ee_store.
transfix
added a commit
that referenced
this pull request
Nov 28, 2026
…ications, argv: (#1598) * Ariadne shell SH7: asks and grants, input and signals to granted applications, argv: docs/roadmap/ARIADNE_SHELL.md 4.5, 4.6 and the SH7 row; ARIADNE.md 5.6, 5.7, 6.3, 6.8, 13. - Grant tokens (inc/cvc/ariadne/grants.h): delegate.keys, .pointer, .signals, extend.menubar, .tray, .context_menu, .settings, access.settings(.read), request.main_view, request.open and net.origin, with a meaning for authors and words for the sheet. A mounted document asks in its requires: (net.origin with origins:), the loading document grants with grants: on its load: or mounts: slot ({delegate.signals: [...]} and {net.origin: [...]} limit what they cover), deny: takes tokens away, and with neither the mount gets extend.tray and extend.settings. A token holds when asked and granted (the defaults without asking); a mount grants its own mounts only what it holds. A mounts: entry's own grants pick from its slot's. - A required token not granted fails a load: (the document's load) or refuses a mounts: entry, named; an optional one leaves (has? ...) false. (has? NAME) answers per mount in programs (the held set taken on the host thread with the context, kept by spawned children), init: and the read lane; the document's own scope answers as it would alone. The entry gets holds and net_origins back. extend.tray gates a loaded application's tray icons. - Input: post_input queues what a mount may take; the drain routes a key to the focused application holding delegate.keys (its on_key: and its keys: bindings at <sub>.keys.<id>), after the document's own bindings, and to none while a text field outside it has the keyboard; the pointer over an application's window to its on_pointer: with delegate.pointer. The focus follows the focused window (Backend::window_focused, window_hovered, item_has_keyboard, reports_focus; ImGui answers them) or (app-focus AS), mirrored at ariadne.focus. InputEvent::ui marks what the host's UI took: arigl posts it marked instead of dropping it. - Signals: without an on_signal: of its own, the shell passes an interrupt to the focused application (taken over) and a request to end to every application holding delegate.signals (the host's default still applies); with one, (app-signal AS NAME) passes one on. - argv: a load:'s argv: or a mounts: entry's argv is parsed by the mounted document's args:, published under its sub-prefix before its init:; a bad one refuses the mount with its usage (in the feed for a mounts: entry). - net.origin: the origins a mount holds are kept on its slot (MountState::net_origins), in the form SH11's ScopePrincipal::net_origins takes, ready to hand over once #1576 is on master. - ari test --mounted runs a document as a shell's application, granted what it holds alone, with its tests in its scope (MountResult/MountState::tests, Runtime::run_program_in_mount). - The .ari schema learns grants:, deny:, argv: on load: and mounts:, and requires: origins:. Tests: ariadne_grants_test (the arithmetic; the loader's grants, warnings, origins and argv; a refused mount, keys to the focused granted application only and none while the shell's field has the keyboard, the parent's binding keeping its key, focus following the focused window, SIGTERM to every granted application and SIGINT to the focused one, a signal list, app-signal, argv and a bad one's usage in the feed, has? per mount, origins, a static load: taking keys, the tray gate, one document's tests alone and mounted, two apps side by side); ari_grants_alone and ari_grants_mounted (src/ari/tests/grants_component.ari, Linux CI with FTXUI). * SH7: origins read as the network policy reads them; a remote principal's own left out From SH11's review of the hand-off (#1576): - policy_origin is cvc::net::parse_origin_spec(spec)->str(), the parse SH11's net host reads net_origins with. An origin it refuses (a path after it, not http(s)) is refused at grant time with its reason, in the requires: warning, the grants: warning and the mount's refusal: the net host would otherwise fail every request of the mount without a word. - The origins a mount holds are worked out with its principal before the wrapper moves, so SH11's set_scope_principal block can take them before any program is built, and a remote: principal's own origin is left out (it reaches it anyway; listing it only costs a cache key). Tests: AriadneGrants.PolicyOriginsAndSignalNames (a path refused, with its reason), AriadneGrantsRuntime.AMountHoldsTheOriginsItsSlotGrants (a mount asking for an origin with a path is refused, naming why). * SH7: the terminal backends report focus, hover and the keyboard as ImGui does Joe's policy is that the shell works in ari on FTXUI and tvision, not only in arigl, so grants and input routing must behave the same there. FtxuiBackend now answers Backend::reports_focus, window_focused, window_hovered and item_has_keyboard: the focus is in the window holding the focused widget, else the one last clicked or raised; the pointer is over the window at its cell; a focused text field has the keyboard. Hosted, tvision says which (FtxuiBackend::set_window_focus): the desktop's current window and the frontmost under the pointer. What the UI used now goes to the Runtime marked InputEvent::ui (FtxuiBackend::post_taken), as arigl posts what ImGui takes, so a focused application gets the keys its own field takes and the shell's handlers still never see them. Tests: AriadneFtxuiShell, a shell with two applications on FTXUI (click to focus, keys and clicks to the one whose window has them, its own field's keys too, none while the shell's field has the focus) and hosted (the host sets the focus and the pointer). * mount_scene.h: clang-format the include comment the SH3 merge realigned
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase SH11 of the Ariadne shell (docs/roadmap/ARIADNE_SHELL.md 4.12): the network, its credentials, the end-to-end keys and the OIDC sign-ins per principal, so a document mounted beside nicotina cannot post as the reader or reach the origins nicotina may. It gates SH12-SH15.
Built on SH1 (#1566, merged): each
mounts:entry runs as the principal SH1'smount_principalgives it.What it builds
inc/cvc/ariadne/principal.h): a table per app of scope to principal (local,file:<dir>,remote:<origin>). A scope under several recorded ones runs as the innermost. Alocalone inside a sandboxed one runs as the sandboxed one. A host can check a principal as it is recorded: the net host refuses a local application whose own policy does not load.open_mountrecords each mount's principal under its scope before any of its programs is built. It reads the entry'sshell.apps.<as>.net_policy,.credential_storeand.e2ee_store, and refuses the mount if a check fails or a sandboxed mount names one.close_mountand the Runtime's teardown clear it once the mount's processes are gone.shell.aritakes those three from a catalog entry (paths relative to the catalog) and opens such an entry under its slug with them written first.CredentialStore): one store, one file and one lock, seen through one view per principal (for_principal). Each view has its own entries, bindings and renewers. A lookup by name finds only the caller's principal's. File lines are<principal> <name> <origin> <token>, with the principal percent-encoded. A three-word line from an older file loads aslocal.enable_net): each program's verbs are bound tonet_host_access(app, scope), where the scope isintrinsics_context::root_path. That covers the http verbs,fetch,http-upload,ws-*,net-*,open-urlandoidc-*.localgets the launcher's allowlist, as before.remote:<origin>gets its own origin plusScopePrincipal::net_origins.file:<dir>gets onlynet_origins.net_originsis the input from SH7'snet.origingrants. Nothing writes it yet.bin/nicotinapasses--net-policy fleet.policy --credential-store .... A policy with no store of its own gets an in-memory store, so itscredentiallines don't rebind the launcher's names.oidc#NAMEchannel, which any program can read.auth:are fetched as the principal of the widget that names them (ImageRequest::scope,PlayerSource::scope,MediaSave::scope, each the struct's last member, so existing positional initializers are unchanged). Each is checked against that principal's allowlist and uses its credential, and the image cache keeps one principal's pictures apart from another's.mount_principal: a mount whose name has no directory (a loader that gives no canonical path, and no base) isfile:.rather thanfile:. A principal names a directory, and the store refuses an empty one..aridocument key. The new settings are state keys under the shell'sshell.apps.<as>.Tests
ariadne_net_principal_test(new):local,remote:with a grant,file:with and without one), andfetchkeeps to it too;ariadne_runtime_test, throughmounts::AriadneMountsNet.AMountReachesTheNetworkAsItsPrincipal: a catalog mount aslocaland another file asfile:<dir>, with credentials and allowlist apart;AriadneMountsNet.AnEntryGivesALocalApplicationItsOwnNetwork: an entry's own policy and store, and the refusals;AriadneComponents.ShellGivesACatalogEntryItsOwnNetwork:shell.ariopening a catalog entry with its own network.net_policy_test: the store's views per principal, its bindings and renewers, principal spellings, the file's new lines, old lines loading aslocal, and malformed principals refused without quoting the line.ariadne_runtime_testcases (SH1's mount, shell and budget ones and the existing net, OIDC, WebSocket and media ones among them),ariadne_deep_nesting_test19,ariadne_media_test62,ariadne_files_test23,multi_app_integration_test5,net_policy_test31 (1 skip),ariadne_net_principal_test10 (the e2ee case skips: no libsodium), and the otherariadne_*,net_*and OIDC suites. Theari_*and e2ee suites skip on that box (no FTXUI, no libsodium); CI runs them.Compatibility
local's. The first capture, forget or clear after that rewrites the file with a principal on every line, and an older libcvc then refuses to load it ("is not ' '"). Going back to an older host means signing in again, or deleting the leadinglocalfrom each line.enable_oidc's signature changed: it now takes the baseNetAccessand a resolver from scope to access. It is called only fromenable_net.Not verified
stub_txwtf.py: checked instead with the nicotina-shaped stand-in above, at the libcvc level.EndToEndKeysAreAPrincipalsOwn) skips on the Windows box (no libsodium); CI runs it.Not in this PR
data:entries still read over the launcher's allowlist, into the one store all documents share. Splitting them goes with SH12/SH13's fetching.#channels is SH12's.requires: net.originask and its sheet) is SH7's; it fillsScopePrincipal::net_origins.