Repository navigation
Ariadne: sign in with any OpenID Connect provider (oidc-sign-in, open-url; nicotina L7, L9) - #916
Merged
Merged
Conversation
added 7 commits
October 30, 2026 17:24
…-url) Items L7 and L9 of nicotina's roadmap (cy-pca/nicotina docs/ROADMAP.md): a generic OAuth 2.0 / OpenID Connect client for every Ariadne host, so a document signs in through a provider (Keycloak, Authentik, Google, a txwtf instance, ...) from its issuer URL and a public client's id, and then names the credential on its requests with auth:. Nothing in libcvc is specific to a provider. cvc::net (no Ariadne): - oidc.h: discovery (fails closed: the issuer must match exactly, endpoints https, or http for a loopback issuer, at the issuer's origin or one the policy lists for it, PKCE S256 not ruled out), PKCE S256 from a CSPRNG, the authorization request and its reply (state, RFC 9207 iss, errors), token and device-authorization replies (RFC 6749 5.1/5.2, RFC 8628), ID token checks (iss, aud and azp, exp, iat, nonce; a refresh keeps sub; alg none refused). Signatures are not checked against the JWKS: ID tokens come only from the token endpoint over TLS (OIDC Core 3.1.3.7 (6)), and RSA/EC verification is not in every libcvc build. A small private JSON reader (json_lite). - loopback_redirect.h: RFC 8252's listener, 127.0.0.1 only, an ephemeral port, one redirect, a 404 for anything else, a "you can close this tab" page. Native only. - browser.h: open_url ($BROWSER, xdg-open, open, ShellExecute, quiet; window.open in a page; no browser over SSH, without a display or with --no-browser) and the page a browser build runs in (its URL, sessionStorage, location.assign, history.replaceState), with test hooks. - net_policy: oidc ISSUER [ORIGIN...] and oidc-client ISSUER ID lines; naming an issuer pins sign-in to the issuers named and allows their origins. - credentials: a CredentialRenewer per credential. A request with auth: renews an expiring token first, and once more after a 401, then sends again. Ariadne (oidc_host.h): - (oidc-sign-in OPTS), (oidc-cancel NAME), (oidc-sign-out NAME [OPTS]), (oidc-status NAME) and (open-url URL). Runtime::drain advances the flows (pump_oidc); their requests run on the app's background pool, inline in a browser build without threads. - flow auto|loopback|redirect|device: loopback with a browser natively, device with a code over SSH or with no browser, redirect in a browser page (the PKCE verifier, state and nonce wait in sessionStorage; on return the code is exchanged and code/state leave the address bar). - Progress and the non-secret claims (sub, iss, name, email, preferred_username, exp) go to the state tree under oidc.<credential> (or a path the document picks), the end of a sign-in to the channel oidc#<credential>. Tokens stay in the credential store: NAME (bound to the issuer's origin and any the policy binds NAME to), NAME.refresh (the token endpoint's), NAME.id. - Refresh before expiry (while idle, and before a request) and after a 401; a kept sign-in (--credential-store) resumes with "interactive" #f; sign-out revokes (RFC 7009) and can end the provider's session (RP-initiated logout). - Host flags --oidc-issuer, --oidc-client ISSUER=ID, --oidc-redirect-uri and --no-browser, in ari and arigl alike and in the pages' config flags; ari/arigl info show them. Capability tokens oidc, oidc.loopback, oidc.device, oidc.redirect and browser. - open-url opens only an http(s) URL whose origin the host allows, one a second; where there is no browser the host prints it, except while a full-screen terminal UI owns the screen. - AppRuntime::idle counts a sign-in's request in flight, and a browser it opened, so a snapshot shows the end of a sign-in. Tests: net_oidc_test (10: issuers, discovery, PKCE's RFC 7636 vector, the authorization request and reply, token and device replies, ID token checks, policy lines, the loopback listener, open_url); ariadne_runtime_test AriadneOidc.* (12) against a stub provider (stub_oidc_provider.h): loopback with a fake browser, device (slow_down, a denial), a redirect from a browser page and back, a forged state and a replayed nonce, the policy's pins and endpoint origins, a provider without the device flow, refresh before expiry and after a 401, sign-out with revocation and logout, a kept session resumed and ended by the provider, the launcher's client id, open-url and the policy; no token the provider issued reaches the state tree. ariadne_host_test: the flags.
… and the wasm check - ari_net_test AriOidc.* (4): the built ari signs in through a browser (tests/fake_browser.py as $BROWSER) with FTXUI and tvision, shows a device code without one, resumes a kept sign-in in the next run (0600 store), and refuses bad sign-in flags; no output carries a token. - ari_oidc_hosts (tests/oidc_hosts_test.sh): ari run (FTXUI, tvision) and arigl run --terminal in tmux, each with a device code approved through the stub and through the loopback redirect, and arigl's window snapshot; every screen, stdout and stderr is checked for the provider's tokens, codes and device codes. Skipped without tmux or python3. - tests/stub_oidc_provider.py: a standard-library stub provider (discovery, authorize, token, device, approve, revoke, logout, an API; CORS) for those tests, the wasm check and trying a document by hand. tests/oidc_probe.ari signs in, waits on oidc#me and calls the API. - ci.yml, "ari terminal backend (wasm, node)": tests/oidc_wasm_node_test.sh runs the wasm ari under node with page-shim.cjs standing in for the page: the redirect flow there and back (code exchanged, address bar cleaned, the API called) and the device code; no token in the output. - examples/ariadne/documents/oidc_sign_in.ari: sign in to a provider named on the command line and show the claims. - docs/ARIADNE.md: 10.4 (sign-in: the verbs and options, the state keys, the flows per host, the tokens, the issuer policy, what a provider must allow) and 10.5 (open-url); the 10.3 flag table; a caveat in 11.
…s clang-format wants
# Conflicts: # docs/ARIADNE.md
# Conflicts: # src/cvc/CMakeLists.txt # src/cvc/tests/CMakeLists.txt # src/cvc/tests/ariadne_runtime_test.cpp
# Conflicts: # src/ari/CMakeLists.txt # src/ari/ari_net_test.cpp # src/cvc/ariadne/host_cli.cpp
This was referenced Oct 31, 2026
# Conflicts: # .github/workflows/ci.yml # src/ari/CMakeLists.txt # src/cvc/ariadne/app_runtime.cpp # src/cvc/ariadne/net_intrinsics.cpp
# Conflicts: # src/ari/main.cpp # src/cvc/ariadne/host_cli.cpp # src/cvc/tests/ariadne_runtime_test.cpp
transfix
enabled auto-merge (squash)
October 31, 2026 17:48
# Conflicts: # src/cvc/ariadne/ariadne.cpp
transfix
pushed a commit
to cy-pca/nicotina
that referenced
this pull request
Oct 31, 2026
transfix/libcvc#916 (merged 19:31 UTC) gives ari open-url, so the documents show their In browser button: on each feed card after Open, and on the post window in place of its URL. run.sh's expectations were written for a host without it and failed six steps on libcvc master: the card's counts row, the post's URL, and Load more, which Tab now reaches ten stops later. run.sh asks the host (`ari check`, as for image.url and media.player) and expects either layout.
transfix
added a commit
to cy-pca/nicotina
that referenced
this pull request
Oct 31, 2026
) * Sign-in windows fit what they show; no status row without a message transfix/libcvc#930 (merged 6d84dc7d) makes the tvision host refit a window that closes and opens again, so the workaround for it goes: the sign-in, two-step and starting windows lose their fixed 496 px width, and the status line takes a row only when the controller has a message. The profile keeps its 76 columns, which is its layout, not the workaround. tests/run.sh's tvision sign-out step ("Signed out." in the reopened sign-in form) is the check that the refit works without the workaround. * tests: a host with open-url adds In browser to each card and the post transfix/libcvc#916 (merged 19:31 UTC) gives ari open-url, so the documents show their In browser button: on each feed card after Open, and on the post window in place of its URL. run.sh's expectations were written for a host without it and failed six steps on libcvc master: the card's counts row, the post's URL, and Load more, which Tab now reaches ten stops later. run.sh asks the host (`ari check`, as for image.url and media.player) and expects either layout. --------- Co-authored-by: tfx <[email protected]>
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.
Items L7 (OIDC sign-in) and L9 (
open-url) of nicotina's roadmap (cy-pca/nicotina docs/ROADMAP.md), built generic. Any Ariadne document can sign in with any standards-compliant OpenID Connect provider (Keycloak, Authentik, Google, a txwtf instance, ...) from the provider's issuer URL and a public client's id. It then names the credential on its requests withauth:, as with #888's credentials. Nothing in libcvc is specific to nicotina or txwtf.Builds on #888 and #895 (net policy, credential store) and #887 (rebased onto it).
What a document does
The other verbs are
oidc-cancel,oidc-sign-out(revocation per RFC 7009, optional RP-initiated logout),oidc-statusandopen-url. Gate a document on them withrequires:/has?, using the tokensoidc,oidc.loopback,oidc.device,oidc.redirectandbrowser.Per host (
flow: auto)ari(FTXUI, tvision),arigl --terminal,ariglin a window, with a desktop--no-browserinterval,slow_down,access_deniedandexpired_tokenari.htmlpagesessionStorage, the code is exchanged on return, andhistory.replaceStatetakescode/stateout of the address barThe authorization code flows always use PKCE S256,
stateandnonce, and check RFC 9207isswhen the provider sends it. A flow the provider or the host cannot run fails clearly; for example, a provider withoutdevice_authorization_endpointgetsunsupported_flow.Policy and tokens
Discovery fails closed:
oidc ISSUER ORIGIN...policy line lists another origin;Launchers pin issuers and supply client ids with
--oidc-issuer,--oidc-client ISSUER=ID,oidc/oidc-clientpolicy lines, and the pages'ariadne.config.jsonflags.Where the tokens live (none in the state tree, which state_transport_ws replicates, nor in logs or errors):
NAMEcredentialline bindsNAMEtoNAME.refreshNAME.idRefresh happens before expiry (also while idle) and once after a 401; the request is then re-sent. This uses the new generic
CredentialRenewerhook inCredentialStore, consulted byauth:requests.A sign-in kept in a
--credential-storefile is picked up again byoidc-sign-inwith"interactive" #f.ID tokens:
iss,aud/azp,exp,iatandnonceare checked, andalg: noneis refused. Signatures are not checked against the JWKS. ID tokens come only from the token endpoint over TLS (OIDC Core 3.1.3.7 (6)), and libcvc has RSA/EC crypto only optionally (OpenSSL, absent from the browser builds). Documented in ARIADNE.md 10.5 and 11.open-urlopens only http(s) URLs whose origin the host allows, so it cannot bypass the allowlist. It uses$BROWSER, xdg-open, open or ShellExecute natively andwindow.openin a page, at most one URL a second. With no browser the host prints the URL, except under a full-screen TUI, where the document shows it.What a provider must allow (generic; for the txwtf provider session too)
client_secretoption exists for providers that hand installed apps a non-confidential secret (Google desktop clients).http://127.0.0.1/callback, accepting any port (RFC 8252 7.3).src_param: false);connect-srcmust include the provider's origin.offline_access).Tests
All pass locally on Linux (native Release with tvision; wasm single-threaded, emsdk 5.0.7):
net_oidc_test(10): the protocol pieces, the loopback listener andopen_url.ariadne_runtime_testAriadneOidc.*(12), against a stub OP:slow_down, deny); a browser-page redirect there and back (via the newcvc::net::pagetest hooks);state, replayednonce, issuer pins and policy, a provider with no device endpoint;open-urlagainst the policy;ari_net_testAriOidc.*(4): the builtari(FTXUI and tvision) through a$BROWSERfake browser, a device code without one, resume across runs (0600 store), and bad flags.ari_oidc_hosts(tmux,src/ari/tests/oidc_hosts_test.sh):ari run(FTXUI, tvision) andarigl run --terminal, each through the device and loopback flows, plusarigl's window snapshot. Every screen, stdout and stderr is checked against all 28 tokens, codes and device codes the stub issued. It skips without tmux (ci: tmux from cvcpkg on the Linux lanes, so the ari tmux tests run #901 adds tmux to CI).wasm
ariunder node (new CI step,src/ari/tests/oidc_wasm_node_test.sh): withpage-shim.cjsstanding in for location, sessionStorage and history, the redirect flow goes there and back (code exchanged, address bar cleaned, API called with the credential), and the device code is shown. The existing net probe still passes.Real browser, arigl-web + ari page: stock browser hosts that run .ari documents by URL; arigl and arigl-web packages #887's
ari.html: built from this branch and served on 127.0.0.1 under arigl-web + ari page: stock browser hosts that run .ari documents by URL; arigl and arigl-web packages #887's strict CSP, withconnect-srclisting the stub provider. The page config carried--oidc-issuerand the probe's args. Opened in the desktop app's Chromium-based browser pane, the document:phase: signed_in,flow: redirect, the claims andapi: 200;?src=oidc_probe.ariand sessionStorage empty;arigl-web (the GL page) was not built locally; its sign-in code is the same libcvc.
Regression: ctest
-R "Ariadne|ari|Ari|Net|net_|ImGui|arigl"706/706 before the rebase onto arigl-web + ari page: stock browser hosts that run .ari documents by URL; arigl and arigl-web packages #887. After it, the OIDC, net, host-CLI and arigl-web + ari page: stock browser hosts that run .ari documents by URL; arigl and arigl-web packages #887 docset suites pass (69/69), as does the wasm check.Not in this PR (follow-ups)
StartedRequestthat renews without blocking (the newCredentialRenewer::renew_async): first if the token is about to expire, then once after a 401, before starting the request again. The blockingperform()does the same withrenew().cvc::net::startwhere the transport starts requests asynchronously, so a no-pthread page never blocks a frame.AriadneNetL4.AnOidcSessionRenewsWithoutBlockingAFrame, on Ariadne L4: requests in single-threaded wasm don't stall the frame loop #914's deferred transport. It resumes a stored session; a 401 is cured by a started refresh and the request is retried, with zero blocking sends.verification_uri_complete: not cheap (a QR encoder), so not done.Example
examples/ariadne/documents/oidc_sign_in.ari:ari run --oidc-issuer https://id.example/realms/demo examples/ariadne/documents/oidc_sign_in.ari \ --issuer https://id.example/realms/demo --client my-app --api https://api.example/v1/mesrc/ari/tests/stub_oidc_provider.pyis a stdlib stub provider for trying a document by hand.Docs: ARIADNE.md 10.5 (sign-in) and 10.6 (
open-url), after #883's 10.4 (JSON replies); the 10.3 flag table, and a caveat in 11.