Upgrading to v0.10.0
v0.10.0 changes the foundations that would be hard to change after 1.0, and tightens security after a review against OWASP ASVS level 2. Most of it applies without a decision; read Decide first before you deploy. There are no database migrations and no new required settings.
Start from v0.9.0. At your app's root:
./upgrade-patch.sh 0.10.0
git apply -3 upgrade.patchDecide first
These change what your users see. Each has a setting, if the new default doesn't suit you.
- HSTS now covers subdomains, for a year. Once a browser has visited the app over HTTPS, it will refuse plain HTTP on every subdomain of the app's host for a year. If any subdomain is still served over HTTP, move it to HTTPS first, or keep the previous behaviour in
Program.cs(AddHsts:IncludeSubDomains = false). - Sessions end 30 days after signing in (with accounts), however often they're used; before, a session used at least every 14 days never ended. Set
Jwt:SessionLifetimeDaysto0to keep that, or to the number of days you want. Sessions already older than that end shortly after the upgrade, so some users sign in again once. Mobile apps should be ready for a refresh to answer 401 and show the sign-in screen. - New password rules (with accounts): 8 characters of any kind, where Identity asked for 6 with upper case, a digit and a symbol, and not one of the 10,000 most common or made from the email or the app's name. Existing passwords keep working. Add your product and company names to
Accounts:PasswordBlockedWords. If your client shows the old rules anywhere, update the text.
Nothing to do, but good to know
- The new cookie names sign nobody out. The refresh token's cookie is now
__Secure-refresh_token(and the known-device cookie__Secure-known_device) over HTTPS. The old names are read until v0.11.0 and replaced at the next refresh. - Existing recovery codes keep working. New ones are longer (
ABCDE-FGHJK-LMNPQ-RSTUV-WXYZ2) and stored only as hashes; people get them when they next ask for new codes. - An authenticator code works once. Someone who signs in twice within 30 seconds waits for the next code.
- The demo user (
demo@example.com/Demo123!, Development only) is created without the password rules, so it keeps its password.
Code changes
Handlers of the same message run separately
Each handler of a message now has its own chain, transaction and retries (MultipleHandlerBehavior.Separated, in Program.cs), as Wolverine 7 will require. If you added a handler for AccountDeleted or OrganisationDeleted (or any message with several handlers):
- It no longer shares a transaction with the template's handlers: if it fails, theirs are still committed, and it's retried on its own. That's usually what you want.
- With Marten, its session can save only once. A handler that saves several times (directly, or through a store that saves) needs a session of its own: see
LeaveOrganisationsOfDeletedAccountHandlerfor how.
The tests: xUnit v3 and Alba 9
The patch moves the test project to xUnit v3 and Alba 9. In tests of your own:
- Fixtures'
InitializeAsyncandDisposeAsyncreturnValueTask(IAsyncLifetime). - Pass
TestContext.Current.CancellationTokenwhere a call takes a cancellation token (the analyzer, xUnit1051, offers the fix). dotnet testruns on Microsoft.Testing.Platform, through the newglobal.json. Its options come after--, for exampledotnet test -- --filter-method "*Contacts*".
Program.cs now sets opts.ApplicationAssembly = typeof(Program).Assembly; keep it, or Wolverine looks for endpoints in the test project.
Smaller changes
- API responses are
Cache-Control: no-storeunless the endpoint sets its own. An endpoint of yours that should be cached must setCache-Controlitself. - A query value that doesn't parse answers 400 (
RejectUnparseableQueryValues). A client that sent, say,?page=with nothing gets a 400 rather than the first page. - Pages answer GET and HEAD only. A form that POSTs to a page's path (rather than to
/api) now gets 405. base-uri 'none'in the Content-Security-Policy: remove any<base>element.- Two-factor code fields accept 40 characters (recovery codes are 29).
- Styling: links in text are underlined, avatar initials use the text colour, and the light theme's
--destructiveis darker (Tailwind's red-700), for contrast. The layout has a "Skip to content" link, and<main id="main">. - New:
ITenantResolver,ISitemapSource,PlanFeatures.AddandPlanLimits.Add(with organisations), for libraries; seedocs/extending.md.
New docs and tests
docs/asvs.mdmaps the app to OWASP ASVS level 2. Read its Yours rows: they're what's left to your deployment and organisation.docs/security.mdhas a new section on the security events in the logs.tests/e2e/specs/accessibility.spec.tschecks every page with axe, in light and dark. Runnpm installintests/e2efor@axe-core/playwright. Pages you add are checked once you add their paths to the spec.