TickerNet docs Sponsored by Omniscient AI

ADR 0013 · Code and packages

Secure dashboard defaults within 1.x, sign-in required in 2.0

From 1.2.0 the dashboard warns at startup when it has no sign-in, accepts only same-origin requests unless you set a CORS policy, forgets a stored sign-in when its session timeout runs out, and compares credentials in constant time. TickerNet 2.0 will make a sign-in choice mandatory.

Status
Accepted
Decided
2026-11-24
Affects
src/TickerNet.Dashboard/
01

Context

The dashboard came from TickerQ with open defaults. With no sign-in method it was public: anyone who could reach its URL could view, add, run and delete jobs. Its default CORS policy allowed any origin with credentials, which let any website a signed-in user visited call the dashboard API as that user when the app's own cookie sign-in was used (WithHostAuthentication). WithSessionTimeout was documented as the session length but nothing enforced it: the browser kept credentials in localStorage until someone signed out. Credentials were compared with ordinary string equality. The docs warned about the first two, but a security review before promoting the project treated warnings in docs as not enough.

ADR 0006 makes SemVer binding from 1.0.0, so making sign-in mandatory has to wait for 2.0.

02

Decision

  • Warn when open. At startup, the dashboard logs a warning (category TickerNet.Dashboard) when it has no sign-in method and the app didn't call WithNoAuth(). WithNoAuth() now means "public on purpose".
  • Same-origin CORS by default. Without SetCorsPolicy, the dashboard's CORS policy allows no other origins. Its own web app is same-origin and unaffected. When SetBackendDomain is used and no policy is set, the old permissive policy stays, with a startup warning, so a separately hosted front end keeps working.
  • Session timeout enforced in the browser. Sign-in has no server-side session: the front end sends the stored credentials with every request. So the front end stores the expiry time next to the credentials (tickernet_sign_in_expires_at) and removes both when it passes, including from an open tab, which then reloads to the sign-in page. A stored sign-in with no expiry, such as one from an older version, counts as expired. WithSessionTimeout rejects values below 1 minute.
  • Constant-time comparison for Basic credentials and API keys (CryptographicOperations.FixedTimeEquals).
  • In 2.0: starting the dashboard with no sign-in method and no WithNoAuth() will fail instead of warning.
03

Alternatives considered

  • Require a sign-in choice now. Safest, but it breaks every 1.x app that relies on the open default, which ADR 0006 rules out within a major version.
  • Keep the permissive CORS default and only warn. Rejected: the default combined with cookie sign-in is exploitable from any website, and a dashboard served by the app itself never needs cross-origin access. Only a caller using the dashboard API from another website without setting a policy is affected, and it can restore access with SetCorsPolicy.
  • Server-side sessions with expiring tokens. A larger change to every sign-in method and the SignalR connection. Not needed to make the documented timeout true; it can come with 2.0 if wanted.
04

Consequences

  • Apps with an open dashboard see a warning until they choose a sign-in method or call WithNoAuth().
  • Cross-origin callers of the dashboard API without SetCorsPolicy or SetBackendDomain stop working in 1.2.0. The release notes must say so.
  • Users signed in from an older version, or after a TickerQ sign-in carried over, sign in once more.
  • New dashboard options must default to the safer behaviour, or warn when they don't.
05

Where it lives

  • src/TickerNet.Dashboard/DashboardOptionsBuilder.cs (WithNoAuth, SetCorsPolicy, WithSessionTimeout)
  • src/TickerNet.Dashboard/DependencyInjection/ServiceExtensions.cs (default CORS policy)
  • src/TickerNet.Dashboard/DependencyInjection/ServiceCollectionExtensions.cs (WarnAboutOpenAccess)
  • src/TickerNet.Dashboard/Authentication/AuthService.cs (constant-time comparison)
  • src/TickerNet.Dashboard/wwwroot/src/utilities/signInExpiry.ts and services/auth.ts
  • tests/TickerNet.Tests/DashboardSecureDefaultsTests.cs, wwwroot/src/__tests__/signInExpiry.test.ts
06

Sources