Skip to content

Serenity 10.12.1 Release Notes (2026-12-05)

These release notes detail the changes made in Serenity and StartSharp from version 10.12.0 to 10.12.1. For a complete list of changes, please refer to the Serenity Change Log.

This release is mostly about the files an application serves and the tool that generates its code:

  • Uploaded SVGs can't run scripts. The upload responders serve the images they display inline with a sandbox policy, so a script in an SVG file can't run in the origin of the application when the file is opened directly.
  • A smaller sergen that takes the provider of the database from the project. The tool package no longer bundles the providers of the other databases, which takes it from 28.8 MB to 6.3 MB; a project must reference the provider it uses.
  • A file menu in the multiple upload editors. The files of the multiple file and image upload editors can be replaced in their place, as the file of a single editor.

Uploaded SVG Files Can't Run Scripts

An SVG file is an image, but it is also a document that can have a script in it. Serenity accepts .svg uploads by default, any signed-in user can upload a temporary file by default, and the upload file responders (DefaultUploadFileResponder, and SecureUploadFileResponder of Pro.Extensions) served every image inline with its own content type.

Shown in an img element such a file is harmless, as browsers don't run the scripts of an image. But when the address of the file is opened directly, e.g. through a link that one user sends to another, the browser shows it as a document of the application, and its script could run in the origin of the application, with the session of the user who opened it (stored XSS).

The content security policy of the templates does not help here: it is a meta tag of the layout, so it applies to the pages only, not to a file that is served from /upload.

The responders now send this header with the image and plain text files:

Content-Security-Policy: default-src 'none'; img-src data:; font-src data:; style-src 'unsafe-inline'; sandbox
  • Opened directly. The file is still displayed, but sandbox turns its scripts off and gives it an opaque origin, so it can't reach the cookies, the storage or the services of the application.
  • In an img element. Nothing changes: the content type is still image/svg+xml, so the thumbnails and the images of the upload editors, and the SVG files that pages show, look as before.
  • PDF files. They are served inline without the header, as the PDF viewers of some browsers don't work in a sandboxed document. The other file types are downloaded as attachments, as before.

Both responders create their response with the new UploadResponseHelper.CreateResult, so they can't differ. An application that has its own IUploadFileResponder should call it too, instead of creating the result itself:

public IActionResult Read(string pathInfo, IHeaderDictionary responseHeaders)
{
    UploadPathHelper.CheckFileNameSecurity(pathInfo);

    if (!uploadStorage.FileExists(pathInfo))
        return new NotFoundResult();

    // ... the access checks of the application

    return UploadResponseHelper.CreateResult(uploadStorage, pathInfo, responseHeaders);
}

Thanks to Phan Thành Danh (@tinhatinh) for reporting it.

Upgrading

Updating the packages is enough, unless the application has its own IUploadFileResponder, which should be changed as shown above.

An application that can't upgrade yet can refuse SVG uploads in its appsettings.json:

"UploadSettings": {
  "ExtensionWhitelistExclude": ".svg"
}

This only refuses new uploads. The SVG files that are already uploaded are still served as they were.

A Smaller sergen That Uses the Database Provider of the Project

The sergen tool package had the providers of all the databases that Serenity supports, with their native binaries, so it was 28.8 MB, while a project uses it with one database. Installing it, and restoring it on a build server, took longer than it should.

The package is 6.3 MB now. It has only the SQL Server provider (Microsoft.Data.SqlClient), and sergen generate loads the provider of another database from the project it runs for:

Provider name of the connection Package
Microsoft.Data.Sqlite Microsoft.Data.Sqlite
Npgsql Npgsql
MySqlConnector MySqlConnector
MySql.Data.MySqlClient MySqlConnector, or MySql.Data
FirebirdSql.Data.FirebirdClient FirebirdSql.Data.FirebirdClient
Oracle.ManagedDataAccess.Client Oracle.ManagedDataAccess.Core
  • From the build output, or the packages. It looks for the provider in the build output of the project, and then in its packages, so a project that is not built, or a class library, works too. A project that is not built gets a warning that the foreign keys to its existing rows use table names instead of row types.
  • Restored when needed. If the provider is in neither, sergen restores the packages of the project and tries again.
  • A clear failure. If it is still not found, or can't be loaded, the command tells what to do and fails with exit code 15 (DbProviderNotFound), which a script can tell apart from the other failures.
  • MySQL. MySqlConnector can be the provider name of a connection, next to MySql.Data.MySqlClient, and the MySql.Data package can be used instead of MySqlConnector.

See Database Providers for the details.

Upgrading

A project that uses SQL Server needs no change. For another database, the project that sergen generate runs for must reference the package of its provider. An application that connects to the database does that already; a class library that only has the generated code may need the reference added.

A File Menu in the Multiple Upload Editors

A single file or image upload editor without its toolbar has a menu on the corner of its file, which replaces or removes it. The multiple file and image upload editors had only a delete link there, so replacing a file meant deleting it and adding the new one, which went to the end of the list.

The files of the multiple editors have the same menu now, in place of the delete link, and a file that is replaced stays in its place:

A multiple file upload editor with the menu of a file open, which replaces or removes it

  • Only without the toolbar. The editors that show their toolbar still have the delete link.
  • Safe to cancel. Replacing uses a file input of its own, so a file chooser that is cancelled doesn't replace the file that is added next, and the file is kept if it can't be replaced, e.g. the new one is not valid or the editor is read-only.
  • In code. MultipleFileUploadEditor has replaceFile(index), removeFile(index) and renderFileMenu(index) that a subclass can override.

Upgrading

Custom styles or tests that use the a.delete link of these editors should use .file-remove, the item of the menu, except for the editors with their toolbar.

Smaller Fixes

  • Required multiple upload editors are validated. The hidden input that validates a multiple file or image upload editor was not added to the page, so a required one was not checked. A form that could be saved without files in such a field can't be saved anymore.
  • The delete link of the multiple file upload editor. It was not visible in the editors with their toolbar, as only the one of the image editor had styles (Serenity.Extensions, Pro themes).
  • File names in the upload tiles. The name of a file had only right padding in the tiles of the upload editors without their toolbar, so it touched the other edges of its tile. It has padding on every side now (Serenity.Extensions, Pro themes).
  • The MySQL registration of the templates. The commented DbProviderFactories.RegisterFactory line of Startup.cs in the Serene and StartSharp templates registered the factory of MySqlConnector under the MySql.Data.MySqlClient name, which DbProviderFactories lookups and the provider name of a connection string did not match. The line registers the factory as MySqlConnector now, which sergen also accepts as the provider name (Serene, StartSharp).