Files
DodoSSH/docs/platform-flags.md
T
jaap-jan 94f66be5e8 Add the OIDC client: PKCE loopback sign-in and the key binding flow
Authorization Code with PKCE on a loopback redirect, per RFC 6749, RFC 7636
and RFC 8252. Zero package references: the flow is fully specified, and the
one thing a library would own for us -- nonce generation and validation -- is
exactly what the key binding needs to control. Duende's OidcClient generates
and validates its own nonce as an internal detail, and the binding requires
the nonce be a specific value: the hash of the key statement being enrolled.
Fighting that is worse than owning the flow.

AuthorizeKeyBindingAsync is the client half of the primary trust anchor. It
runs a second authorization with nonce set to the statement hash and
prompt=login, so the ID token that returns is the provider's signature over
exactly those public keys, attesting to a user present now rather than to a
session opened at some unknown earlier time. It requests only openid -- a
second refresh token would be one more long-lived credential for no benefit
-- and rejects a token whose nonce is not the one it asked for, because
enrolling that would store evidence verifying against keys we are not
publishing.

The nonce is read without validating the ID token's signature. Sanctioned by
OIDC Core 3.1.3.7: for a token received by direct communication with the
token endpoint, TLS server authentication may stand in for signature
checking. That reasoning does not extend to another user's binding, which
arrives via the DodoSSH server and must be verified against JWKS fetched
directly -- the directory work in M3.

Raw TcpListener rather than HttpListener for the redirect: an ephemeral port
can be bound and read atomically instead of picking one and hoping it is
still free, there is no HTTP.SYS URL-ACL question on Windows, and the whole
surface is one request line. It answers 404 on other paths and keeps
waiting, because a browser asks for /favicon.ico first and treating that as
the callback would abort every sign-in. 127.0.0.1 rather than localhost: RFC
8252 permits either, but the name resolves through the hosts file.

20 tests, driving the real listener over TCP with a fake browser that
actually fetches the redirect -- injecting a fabricated callback would skip
the parsing, path filtering and response writing that can break. Mostly
negative, because the loopback port is reachable by every local process: a
response with the wrong state is rejected *and* never reaches the token
endpoint, metadata declaring an issuer other than its own authority is
rejected (RFC 8414 3.3, without which a mix-up attack works), a provider
offering only 'plain' is fatal rather than a silent downgrade, and the
verifier sent is checked against the challenge advertised so PKCE is not
theatre that only fails in production.

Two bugs caught by writing the tests: the authorize URL builder dropped
client_id entirely after a refactor, and CancellationTokenSource.CancelAfter
has no TimeProvider overload -- so the browser timeout is now constructed
with the clock and a test can advance it instead of waiting five minutes.
2026-07-28 21:13:35 +02:00

7.5 KiB

Platform flags

Things known or suspected to behave differently outside Windows, plus deployment gotchas that have already cost time once. Development and testing are currently Windows-only, so anything here marked unverified has not run on the platform in question and must not be assumed to work.

Each entry says what the risk is, why it matters, and what to do about it. Delete an entry when it has been verified or made moot — not when it merely stops being convenient.

Cryptography

ChaCha20Poly1305.IsSupported is false on macOS, and on Windows builds before 10.0.20142. This is why the client uses NSec (libsodium) rather than the BCL for content encryption; see docs/crypto.md §1. Already mitigated — but if a BCL AEAD path is ever added as a fallback it must gate on IsSupported rather than assuming availability, or the client will fail to open any vault on macOS.

Argon2id timings are measured on one Windows machine only. 256 MiB with t=4 took 323 ms here. The floor and ceiling in EnrollmentLimits were chosen against that number. Unverified elsewhere: recalibrate on the slowest target platform before recommending a default profile, because a cost that is comfortable on a desktop can make unlock unusable on a low-power laptop — and the parameters are stored per user at enrollment, so a bad default is a per-user migration.

libsodium ships native binaries per RID. This complicates single-file and AOT publishing, and on macOS every native library (libsodium, libSkiaSharp, libHarfBuzzSharp, libe_sqlite3) must be signed individually with --options runtime --timestamp before the bundle is signed, or notarization fails with an error that does not name the offending file.

Desktop client

The Avalonia WebView on Linux is unproven, and is the single largest risk in the plan. The official control uses WPE WebKit (libwpewebkit-2.0); the community NativeWebView uses WebKitGTK (libwebkit2gtk-4.1), which is far more widely installed. Avalonia's own documentation contradicts itself on whether offscreen rendering works there. Unverified: the spike must cover Ubuntu on both Wayland and X11, Fedora KDE, and macOS 15. This is why the terminal sits behind ITerminalHost — that abstraction is what preserves the option to swap backends, and it should not be collapsed away for convenience.

SSH.NET's window-change is verified working as of 2025.1.0 — resolved, not a flag. ShellStream.ChangeWindowSize(columns, rows, width, height) exists and the remote genuinely observes it: PtyAndResizeSpikeTests reads stty size back from a real sshd after resizing, and repeated resizes each take effect. The IChannelSession fallback is not needed. That suite stays in place as a regression guard, because an upgrade that silently stopped sending the request would present as wrapped output only after a resize — easy to misattribute to the terminal emulator.

ShellStream does not override ReadAsync. The base Stream implementation therefore runs the blocking Read on a thread-pool thread, so every open session parks one thread for as long as it is idle. Fine for the handful of tabs M1 targets; revisit before advertising many concurrent sessions, since the fix is either an upstream change or driving IChannelSession directly.

SSH.NET cannot share one connection between SshClient and SftpClient. A shell plus SFTP to the same host means two TCP connections, two authentications and — later — two relay sockets. Connect SFTP lazily and reuse the cached decrypted credential so the user is not prompted twice.

Agent forwarding is de-scoped from v1. It needs an upstream SSH.NET change. A vault-backed agent of our own plus ProxyJump covers the real use cases.

The SSH suite pulls linuxserver/openssh-server from Docker Hub, which is rate-limited for unauthenticated pulls. If CI starts failing on image pulls rather than on tests, that is why.

MSIX packaging is ruled out, not merely deprioritised. A packaged app runs WebView2 in an AppContainer where loopback connections are blocked without a CheckNetIsolation exemption. The terminal data plane is a loopback WebSocket, so MSIX would break the product outright. Velopack for Windows/macOS/AppImage; Flatpak and deb/rpm defer updates to the package manager.

Linux ships AppImage and Flatpak first, specifically so the WebKit runtime is bundled rather than assumed present on the user's machine.

Opening the system browser depends on the platform handler. SystemBrowserLauncher uses UseShellExecute, which delegates to ShellExecute on Windows, open on macOS and xdg-open on Linux. Unverified off Windows: xdg-open comes from xdg-utils, which is not guaranteed on a minimal desktop or inside a Flatpak sandbox — where the portal is the correct route instead. If sign-in silently does nothing on Linux, this is the first thing to check. IBrowserLauncher exists so a platform-specific opener can be substituted without touching the flow.

Build and CI

Integration tests need a Docker daemon (Testcontainers). They run on ubuntu-latest in CI. macOS runners have no Docker daemon, and the Windows CI job is deliberately build-only. So anything proved by an integration test is proved on Linux only — which is the right place for server code, and no coverage at all for client platform behaviour.

[CallerFilePath] is rewritten to /_/... under ContinuousIntegrationBuild. Any test that locates a fixture by source path passes locally and fails in CI. Copy fixtures to the output directory and read them via AppContext.BaseDirectory instead; GoldenVectorTests shows the pattern.

dotnet format --verify-no-changes is part of the CI gate and exits non-zero on style warnings, not just whitespace. Run it before pushing; a build with zero warnings can still fail that step.

Deployment

PostgreSQL 18 moved its data directory to /var/lib/postgresql, not /var/lib/postgresql/data as in 17 and earlier. A compose file carried over from an older version silently gets an empty volume — the database appears to work and loses everything on restart. Relevant to any compose file other than deploy/docker-compose.dev.yml, which is already correct.

Keycloak in the dev stack listens on host port 18080, not 8080. On this machine an unrelated Apache Tomcat holds 127.0.0.1:8080, and a loopback-specific bind wins over Docker's 0.0.0.0 publish when resolving localhost — so every realm request returned 404 while the container looked healthy. If discovery fails against a locally-published container, check for another process bound specifically to loopback before suspecting the container.

Sync:CursorSigningKey generates an ephemeral per-process key when unset. Fine for a single node; on a multi-node deployment cursors issued by one node are rejected by another, so clients resync from the beginning repeatedly. Must be configured explicitly before running more than one instance. WarnOnRiskyConfiguration logs this at startup.

Rate limiting is not implemented yet (M2). POST /api/v1/me/enrollment and the sync endpoints are reachable by any authenticated caller at any rate. Enrollment requires a valid access token and is idempotent, so the exposure is resource consumption rather than a credential-guessing surface — but it is still an unmetered write path.

/api/v1/me does not update last_seen_at_utc. Deliberate: a GET that writes on every call is a smell, and nothing depends on the value yet. Revisit when device management lands, since that is the first feature that needs it.