v0.6.0
File storage for every app, file attachments on Todos, profile pictures and organisation logos, an optional Aspire AppHost, and staying signed in across reloads and tabs, with the refresh token in an HttpOnly cookie.
Changes to know about
- New packages in every app:
AWSSDK.S3(Apache-2.0) andAzure.Storage.Blobs(MIT), for the S3 and Azure storage providers. Local disk stays the default and needs neither service. deploy/docker-compose.ymlkeeps uploaded files in anapp-filesvolume, with a one-shotapp-files-ownerservice that hands the volume to the app's non-root user. Back the volume up with the database (deploy/README.md).- The Content-Security-Policy is built from
ContentSources(Security/SecurityHeaders.cs), which adds the storage provider's address and, with accounts, Gravatar's. Code that calledSecurityHeaders.ContentSecurityPolicyAllowingnow callsContentSecurityPolicy(sources, hashes). - New fields in responses (with accounts):
pictureUrlon/api/auth/me, organisation members and admin users;logoUrlon organisations (saas);gravataron/api/auth/options. - EF Core: new migrations add a
TodoAttachmentstable (every app),AspNetUsers.PictureKey(accounts) andOrganisations.LogoKey(saas). - Todos have
attachmentsinGET /api/todos(Marten keeps them in the Todo's events and snapshot). - Signed downloads are always attachments:
IFileStorage.CreateDownloadUrlAsynctakes the name to save the file as, and every provider sendsContent-Disposition: attachment(signed into S3 and Azure URLs), so an uploaded HTML or SVG file never opens as a page. .gitignoreignores onlysrc/ApiHost/data/files/(uploads while developing), notsrc/ApiHost/data/: where git ignores case (macOS, Windows), that also matchedData/and left new EF Core migrations out of commits.deploy/docker-compose.yml'sapp-files-owneronly hands the volume over when it isn't the app's yet, instead of going through every file on each start.- Picture, logo and attachment uploads are rate limited per user (
Pictures__UploadsPerMinute, 10 a minute by default). - Deleting an account or organisation deletes its files through a
DeleteStoredFilesmessage of its own, so a storage outage can't stop the rest of the deletion. Features that keep files should do the same (docs/file-storage.md#deleting-an-owners-files). - Token responses'
refreshTokenis null for browsers (with accounts): a request with theX-Refresh-Token-Cookie: trueheader gets it in a cookie instead.refreshTokenin the bodies of/api/auth/refresh,/api/auth/logoutand/api/organisations/switchis now optional (the cookie is used without it), and/api/auth/refreshtakes an optionalorganisationId(saas). Clients without the header, such as mobile apps, see no change. vite.config.tsreads the API's address from Aspire'sservices__api__http__0when it's set, and otherwise useshttp://localhost:5133as before.
Projects created from earlier versions don't change: a template update only affects new projects.
New
- File storage (every app): one
IFileStorageinterface with local disk (the default), any S3-compatible store (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, Hetzner, Google Cloud Storage, self-hosted SeaweedFS, Garage, Ceph or RustFS) and Azure Blob Storage, chosen withStorage__Provider. Browsers upload and download with short-lived signed URLs; local downloads are sandboxed so an uploaded page or SVG can't run as the app. One test suite runs against all three providers, anddocker compose --profile storage up -dstarts SeaweedFS and Azurite to try them. See the generated app'sdocs/file-storage.md. - File attachments on Todos (every app), the worked example of large uploads: the browser uploads straight to storage with a signed URL, then the API checks the file and attaches it. Encrypted upload tokens, size and count limits (
Attachments__MaxBytes, 25 MB;Attachments__MaxPerTodo, 10), abandoned uploads deleted, downloads saved under the file's name. - Profile pictures (accounts): upload one in Settings, cropped and resized in the browser and checked by the server without an image library, and served at
/media/...so a CDN can cache it. Without one, their initials are shown, or their Gravatar if you setPictures__Gravatar=true(off by default: it shares a hash of their email with Gravatar). Shown in the header, member lists and the admin page. - Organisation logos (
saas): owners and admins set one on the organisation page; the switcher shows it. --Aspire true: an Aspire AppHost that starts PostgreSQL, Mailpit, the API and the Vite dev server with one command, with the Aspire dashboard. Development only; Docker Compose stays the default, and production doesn't change. See the generated app'sdocs/how-to/run-with-aspire.md.- Stay signed in across reloads and tabs (accounts): the browser's refresh token moves to an HttpOnly,
SameSite=Strictcookie that page scripts can't read. Reloading, new tabs and duplicated tabs stay signed in; tabs take turns to refresh (Web Locks) and sign in and out together (BroadcastChannel); each tab keeps its own organisation (saas). Before, a reload signed you out. - Mobile and desktop apps use the same API: without the
X-Refresh-Token-Cookieheader, the refresh token still comes back in the response body. New guide:docs/how-to/sign-in-from-a-mobile-app.md. - A grace period for refresh token reuse: a replaced refresh token is accepted for 30 seconds (
Jwt:RefreshTokenReuseGraceSeconds), so tabs refreshing at once and apps retrying a lost response aren't taken for theft.