Releases and security
4.1.0 - unreleased
Security
login_requiredtrusted the session alone: it let a request through as soon as an id was in the session. If closing the session of a deactivated account failed (store down), that account still passed the route. It now relies on the account the auth middleware read from the database.X-Forwarded-For: an unreadable entry was skipped: behind a proxy that writesip:port, the address on its left, which the client can forge, was taken for the client's. An entry that is not an address now stops the walk, and the connection's IP is kept.- Rate limit bypass over IPv6: each address had its own allowance, while an IPv6 subscriber holds a whole
/64. An IPv6 address is now counted by its/64prefix; an IPv4 address seen through an IPv6 socket (::ffff:1.2.3.4) is still counted alone. - URL field: only
httpandhttpspass:TextField::urlaccepted any scheme, and relied on the wordjavascript:being removed from the text, which could be bypassed (java<TAB>script:, read asjavascript:by a browser). The URL is now read by the parser browsers follow and must be absolute, inhttporhttps. To check: a URL field that receivedftp://,mailto:or a relative URL now refuses them. - Empty host: an empty
Host(Host: .) no longer matches any entry of the list, even an empty one. cleanedcould return a URL value that was never validated: when a field was empty,cleaned("x")returned the path or query string parameter of the same name instead, with none of the field's rules applied. A link/profile/edit?bio=textwas enough: the victim left the field empty, sent the form to the current address, andcleaned("bio")returned the link's text.cleanednow reads fields only.save()wasn't concerned (it reads fields).
Breaking changes
-
An enum name is declared only once: two models (or a model and an
extend!{}block) declaring a text enum of the same name now makemakemigrationsfail: it names the enum and the models and writes nothing, with or without--force. Until now the command said nothing: under PostgreSQL the type was created once only, and the second model silently got the values of the first. Rename one of the two (OrderStatus,InvoiceStatus). Several fields of one model on its enum, and integer enums, are not concerned. -
Log channels
admin.filter_fnandadmin.daemonremoved: they came from the former admin (filter functions, code generator) and no longer produced anything. Drop.filter_fn(...)and.daemon(...)fromwith_log(|l| l.admin(...))calls. A list's filters now show in theadmin.listlog. -
Admin
hot_reloadremoved:AdminConfig.hot_reloadand.hot_reload(...)inwith_adminhad done nothing since the new admin (in development, templates are reloaded on every render, with or without this setting). Drop the call. -
cleanedno longer reads the URL,Forms::set_url_paramsreplaced byset_path_params:cleaned::<T>("x")returns the value of fieldxand nothing else. For a value of the URL, userequest.get_path("x")/request.get_path_as::<T>("x")orrequest.get_query("x"); to pre-fill a field from a link,form.add_value("x", value). A search form sent withGETdoesn't change (its fields are filled from the query string).Forms::set_url_params(path, query)becomesForms::set_path_params(path): the query string is no longer given to the form. -
Smaller connection pool by default: without
DB_MIN_CONNECTIONS,DB_MAX_CONNECTIONSandDB_ACQUIRE_TIMEOUT, Runique kept 20 connections open, opened up to 100 and waited 500 ms to obtain one. A new project on PostgreSQL could fail at its first start withPoolTimedOut(in a debug build, the first connections take longer than that), and a single site could hold every connection of the server (100 by default on PostgreSQL). The defaults are now 2, 10 and 5000 ms. To check: a busy site that relied on the former defaults setsDB_MIN_CONNECTIONS=20andDB_MAX_CONNECTIONS=100in its.env. The.envwritten byrunique newshows these three variables, commented out, with their defaults. -
The mailer is no longer declared in the builder:
with_mailer()andwith_mailer_from_env()removed: the sending configuration lives in.envonly (EMAIL_BACKEND,SMTP_HOST,SMTP_USER,SMTP_PASS…), read at the first send. It must be complete: if a required variable is missing, there is no mailer. To do: drop.with_mailer_from_env()frommain.rs; a project that gave aMailerConfigto.with_mailer(…)moves its values to.env. An absent mailer no longer stops the boot, except in production whenwith_password_resetis declared. -
The admin creates no account without a mailer: creating an account and resending a password link from the admin are refused before anything is written when the mailer is not complete, with a message. Before, the account was created with no link sent: nobody could open it.
-
One connection rule, and a fallback on the
DB_*keys: the app,makemigrationsandmigration up | down | statusreadDATABASE_URLfirst, then the separate keys. What changes: (1) a completeDATABASE_URLwhose connection fails no longer blocks right away, Runique warns and tries the keys; (2) an incompleteDATABASE_URL(a start naming no known engine, unreadable, a server without a database name, SQLite without a file) gives way to the keys when they are enough, otherwise the start is refused, never falling back on SQLite; (3) keys withoutDB_ENGINEare an error, where they used to be ignored in favour of SQLite; (4) a key with no value (DB_USER=) counts as absent; (5) the user and the password given by the keys are encoded by Runique, a password with@,/,:or#is written as it is inDB_PASSWORD; (6) the migration commands connect before running themigrationcrate and hand it the address that answered. To check: aDB_ENGINE=sqliteleft next to a server address becomes the database in use when the server stops answering; a loneDB_NAME, withoutDB_ENGINE, is no longer taken for SQLite; a password already encoded by hand inDB_PASSWORDwould be encoded a second time. See Database. -
makemigrationsneeds the database: the command now connects first, to the database of the.env(DATABASE_URL, otherwise theDB_*keys), and stops with an error when it doesn't answer, before anything is read or written. It still writes nothing to the database; onlyrunique migration upapplies. The error gives the cause without the password. To check: a script or a CI job that ranmakemigrationswith no database available must now provide one. In code,runique::cli::makemigration::runis nowasync. -
makemigrationsrefuses a database that doesn't match the project: the command reads the applied migrations (seaql_migrations) and stops, writing nothing, when one of them is not inlib.rs(another project's database, or the file of an applied migration deleted). The framework's migrations are always known; their names are exposed inmigrations_table::FRAMEWORK_MIGRATION_NAMES. A new database, withoutseaql_migrations, passes. -
runique migration upreads the models: after a run that succeeded, it writes the snapshot of the tables its migrations just changed, fromsrc/entities(--entitiesoption), and removes the tag of the pending migrations, as one batch. In code,runique::cli::migrate::uptakes the entities folder as its first parameter. To check: don't change a model betweenmakemigrationsandmigration up. -
makemigrationsno longer writes the snapshots, and run again it replaces: a snapshot is the state of an applied table, written bymigration uponly. Runningmakemigrationsagain before applying therefore starts from the same snapshots: the pending migrations are computed again and replaced instead of being followed by one more (a table created then changed before being applied gives a single creation). With no change, no file is rewritten; when the change was taken back, the pending migrations are removed with their line oflib.rs; a refused run writes nothing. An applied migration is never replaced. To check: a pending migration edited by hand is overwritten by the next run; a tool that read the snapshot right aftermakemigrationsmust wait formigration up. Existing projects have nothing to do: their migrations carry no tag and their snapshots are already there. -
makemigrationsrefuses two migrations written in parallel: every generated migration carries, under its tag, the line// runique: from <migration>(the last migration in place for its table, ornone). When two migrations oflib.rsstart from the same point for the same table, the command stops before anything is computed, names the table and both migrations, and writes nothing. Migrations from before 4.1, without that line, are not concerned. -
makemigrationsreads every snapshot before computing: a.rsofsnapshots/orsnapshots/runique/that can't be read, or named otherwise than the table it describes, stops the command, writing nothing. Before, only the snapshot of a table a model still describes was opened. To check: a.rsfile put by hand in these folders that is not a snapshot must be moved out. -
The
runiquecommand is in its own crate,runique-cli: the binary leaves theruniquecrate. The reason: installed once for every project, the command decided the primary key type from its own features, while each project'sCargo.tomlis what sets it; out ofrunique, it reads the project's features instead of its own. Installing becomescargo install runique-cli --lockedinstead ofcargo install runique --features <engine> --locked: the command ships the three engines by default, one install serves every project (--no-default-features --features <engine>to compile a single one); the command is still calledruniqueand its subcommands don't change. Everything the command does followed:runique::cli,runique::new_project,runique::auth::create_superuserand the tooling ofrunique::migration(reading the models, diff, generation,cli_migration) now live inrunique-cliunder the same paths (runique_cli::migration::…,runique_cli::new_project,runique_cli::create_superuser). Therunique::migrationmodule is gone: the description of the models,schema, moves up torunique::schema(runique::schema::ModelSchema,ColumnDef…); the functions the generated migrations call,runtime, are inrunique-cli(runique_cli::migration::runtime), and a project'smigrationcrate depends onrunique-clifor them. An application that only usesmodel!{}, the prelude and its generated migrations has nothing to change. Theruniquecrate no longer depends onclap,syn,quote,proc-macro2,crossterm,dialoguerorrpassword. -
The site's language is chosen through the
.envor the builder,set_lang()is no longer exposed: until now only theruniquecommand readLANG, and an application stayed in English withoutset_lang(). The application now readsLANGfrom its.env, and.with_lang("fr")on the builder sets it from the code, with the last word.set_lang()leaves the prelude andrunique::utils::trad: in amain.rs, remove theset_lang(Lang::Fr);line and putLANG=frin the.env, or write.with_lang("fr")on the builder.runique::utils::trad::switch_langandset_default_langare no longer re-exported either. A project that already hadLANG=frin its.envfor the command sees its application turn to French. The system'sLANGis not read by the application. -
Langgains a case,Lang::Other: a language of the project'slocales/folder. AmatchonLangwithout a default case must add one.Lang::code()is no longer aconstfunction. -
The framework's translation keys are renamed and go through constants: every message follows
subject.section.key(forms.requiredbecomesforms.error.required,log.csrf.refusedbecomescsrf.log.refused), and the framework's code asks for them by a constant (runique::utils::trad::keys::forms::error::REQUIRED). A project that calledt("…")with one of Runique's keys must use the constant; a wrong key no longer compiles instead of being shown as it is. The translation files are laid out as one folder per language and one file per subject.ADMIN_MESSAGE_KEYSbecomes a list of pairs (template variable, key): the variables of the admin templates don't change. 45 messages that nothing called are removed. -
get_or_404returns the handler's error: bothget_or_404(Entity::objectsand after filters) returnAppResult<Model>instead ofResult<Model, Response>. In a handler,let article = …get_or_404(…).await?;is enough; the formerErr(response) => return Ok(response)no longer compiles and is replaced by?. The page sent is the same (404 if the row is missing, 500 if the query fails), and the error is now logged like the other handler errors. -
prisme_pipelineandaegisreturnBodyRefusal: a refused request body (runique::forms::prisme::BodyRefusal) only becomes a response when it is sent. Only concerns code calling these two functions directly;.into_response()gives back the former response, unchanged. -
renamed_fromonly takes a plain name: the value of[renamed_from: "…"]must be an identifier (letters, digits,_, 63 characters at most), otherwise the model doesn't compile. It is now used to find a snapshot file. A value that wasn't an identifier already matched no column and did nothing.
Removed
- MariaDB: SeaORM only knows PostgreSQL, MySQL and SQLite, and refuses a
mariadb://URL; MariaDB was therefore never really supported. Themariadbfeature, theDatabaseEngine::MariaDBvariant and themariadbvalues ofDB_ENGINEandDATABASE_URLare removed; Runique's tests run on MySQL 8.4. To check: a project that turned themariadbfeature on moves tomysql, withDB_ENGINE=mysqland amysql://URL.
Added
-
runique-clino longer depends onrunique: the command has its own copy of what it took from the framework, namely the database connection rule (DATABASE_URL, then theDB_*keys), the hashing algorithms of the superuser's password, the accounts table and the names of the framework's migrations. Installing it no longer builds the web server, the templates or the sessions: 614 dependencies instead of 704. Tests compare each copy with the original inrunique, so that they don't drift apart silently. The command no longer re-exportsschema. -
The site's time zone,
TZ: the.env'sTZkey (TZ=Europe/Paris) was read and kept inconfig.timezone, with nothing using it. The admin now shows at the site's hour the dates that carry their offset (timestamp_tzcolumns), summer time included; a plaintimestampcolumn, which doesn't say what instant it is, is still shown as stored. Templates get{{ timezone }}, to hand to thedatefilter (date(format=…, timezone=timezone)). A name that is no time zone stops the start. WithoutTZ, withTZ=left empty, or withUTC, nothing changes. The.envwritten byrunique newholdsTZ=UTC, to replace with the site's time zone. -
.with_lang("fr")on the builder: sets the language of the site from the code, before the.env'sLANG. The code may be writtenfr,fr-FRorfr_FR.UTF-8, or be that of a language of the project'slocales/folder. A code no loaded language answers to stops the start, with the list of the loaded languages.Lang::find(code)gives the language of a code, or nothing. -
One code, one language: only the first part of a language code counts, everywhere.
fr-LUis French andpt-BRPortuguese, in the.env, in.with_lang()and for the visitor's browser; before, a variant missing from its language's list gave English without a word in the.env. The language descriptions no longer list their regional variants. In a project'slocales/folder, anl-NLornl_NLfolder is accepted and gives the languagenl, apt-BRfolder completes Runique's Portuguese, and two folders for one language stop the start. -
Two more crates:
runique_i18nandrunique_atomic: the translation engine with its messages, and the all-or-nothing batch of files with its journal, leaveruniquefor a crate of their own, because therunique-clicommand uses them as much as the framework does and they must exist in one place only. Nothing changes for an application:runique::utils::tradre-exports the first, and the second stays internal. Publication order:runique_i18n,runique_atomic,runique_dsl,derive_form,runique,runique-cli. -
Each visitor's language:
.with_lang():.middleware(|m| m.with_lang())serves each visitor in the language of their browser (Accept-Languageheader), among Runique's and those of the project'slocales/folder; without a known language, the site's stays.t(),tf(), form errors, error pages and the admin follow with no code change. Every answer carriesVary: Accept-Language. The header only picks among the loaded languages and is never written back. Outside a request,with_lang(language, task)does the same for a task. See i18n. -
{{ lang }}in every template: the code of the language served, for<html lang="{{ lang }}">. Alangvalue passed by the handler keeps priority. The two admin mails now announce the language they are written in, instead offr. -
The project's translations: the
locales/folder: a project keeps its own translations inlocales/<language>/<subject>.json, like Runique. Read at start by the application and by theruniquecommand, with no code to write. A file of a new subject gives its keys (t("shop.title")); a file named after one of Runique's subjects rewrites its messages; a folder of another name is a language Runique doesn't ship, described by itslang.json(name, variants, fallback language).Lang::from("nl")then returns that language,Lang::available()lists them, andLang::name()gives its name. An invalid folder stops the start; a misspelt key or untranslated messages are said in the log.LOCALES_DIRkeeps the folder elsewhere. See i18n. -
Renaming a table or a list field:
renamed_from:table: "bakery", renamed_from: "shop"renames the table without losing its rows and without--force, instead of dropping it and creating another one. The migration renames the table, then gives their new name to the indexes and foreign keys that held the former one, including the keys of the tables pointing to it;downundoes it all. The table of a list field follows the rename of its model, and the field itself is renamed with[renamed_from: "old"], like a column. Under SQLite the rename goes through even when the table has keys. Oncemigration uphas run, the snapshot is under the new name and the appliedrenamed_fromis removed from the model file, in the same batch of files as the snapshots: only the directive goes, with its comma. This also holds for a columnrenamed_fromapplied long ago: it is removed the first time a migration touches its table. See Renaming a table. -
Pausing a table:
managed: false: in a model'smeta,managed: falsemakesmakemigrationsgenerate and drop nothing for its table, nor for the tables of its list fields, with or without--force. The model stays usable in the code and can be the target of abelongs_to. Every run recalls the paused tables; removing the key resumes the migration where the snapshot had stopped. See Pausing a table. -
Tunable response compression:
.middleware(|m| m.with_compression(|c| ...))turns it off (enabled(false), when a proxy already compresses), sets the smallest response that gets compressed (min_size(bytes)) and picks the level (level(...), tower-http'sCompressionLevel). Without this call nothing changes: compression on, from 32 bytes, default level. Images, SSE and gRPC are never compressed. -
The admin opens its accounts without
with_password_reset: an enabled admin serves the page its links lead to itself (/reset-password/{token}), with Runique's template and the default rate limit.with_password_reset(…)keeps its role for the site: opening the "forgot password" form to visitors and setting routes, templates and rate limit. Without it, that form is not served. -
Built-in reset pages: a complete stylesheet (
css/auth.css): fields, messages, errors and a dark theme, with colors as--auth-*variables to redefine. -
runique --version: the command shows its name and its version (also-V), for examplerunique-cli 0.1.0. It is the version of therunique-clicrate, distinct fromrunique's. -
ExclusiveLogin: the last parameter oflogintakesExclusiveLogin::{Off, On, Strict}as well as abool(false=Off,true=On, unchanged).Strictrefuses the sign-in (LoginError::Session) and closes its session when the account's other sessions could not be closed;Onlogs the failure and signs in. -
Logs follow
.env: with nothing written inwith_log,RUNIQUE_ENV=devturns the useful channels on (INFO) andDEBUG=trueturns them all on, chatty ones included, in production too. A channel set by hand keeps its level;.manual()switches this off. To check: withDEBUG=true, the logs hold the value of the fields visitors type in (passwords excepted), and the global filter moves todebug. Production withoutDEBUGis unchanged. -
Admin boot log (
builder.registry): the configuration kept, each registered model (columns, filters, actions, form fields) and each route declaredadmin. Three warnings are never silent: an admin sign-in with neither aLoginGuardnor a rate limiter (outside development), list options with no effect (links,search_help,empty_value), and Runique's stylesheets not found (aSTATIC_RUNIQUE_PATHthat doesn't hold them). -
Translated logs: the log messages added in this version (CSRF, admin, sessions, startup, traced errors) go through i18n, in the 9 languages (
logsection of the language files). They follow the application's language (.with_lang()orLANG); field names stay in English, the value ofreason(CSRF refusal) andoutcome(admin write) is translated. In English, the default language, the text doesn't change. To check: a filter or an alert set on a log's text only holds while the language stays the same. -
A "required" message per field: a required choice, number or file field left empty shows its own message (
forms.select_required,forms.number_required,forms.file_required) instead of the generic one, and the custom message ofset_required(true, Some("…"))is now honoured inside a form. -
Atomic file writes:
runique new,runique makemigrationsand the creation of themigration/crate write their files as one batch, all of them or none. An error undoes everything; a hard stop (power cut,kill -9) is repaired the next time the same command runs, from a.runique-journalleft in the folder. If a file was edited by hand since the cut, the repair touches nothing and lists the files involved.runique migration up,downandstatusrefuse to start as long as an interruptedmakemigrationsisn't repaired. The messages are translated in the 9 languages (atomicsection). See Atomic file writes. To check: the names.runique-journal,*.runique-tmpand*.runique-bakbelong to Runique. -
ModelAdmin::with_form::<F>(): a model's create and edit pages can be built from a#[form(schema = …)]form of the project instead of the formmodel!{}generates; itscustomize()and itscleanthen apply in the admin (for instance.replace()on an image). The return type becomesModelAdmin<Entity, MyForm>. Checked at startup: every field is a column or a list field of the model, none is secret or a rank flag, each can hold its column's type, and no column needed to create a row is missing. Rights are still decided by the gate. Withoutwith_form, nothing changes. -
.replace()onFileFieldandMediaField: when a new upload replaces a row's file, the old one is deleted once the write is committed. No effect on a field taking several files; an old file that is missing or can't be deleted never fails the request; nothing is deleted outsideMEDIA_ROOT. Only a column really written loses its old file: a locked field, or a column outside the account's rights, keeps it. Without.replace(), nothing changes: the old file stays. -
Dropping a table: removing a model drops its table.
makemigrationsspots a table it migrated (it has its snapshot) that no model produces any more, announces it (menus: DROP TABLE (data loss)) and writes nothing without--force. With--force, it writes a migrationm…_drop_{table}_table.rs:DROP TABLE IF EXISTSinup, the table created again, empty, indown. The drops close the run, the table pointing to another first; the table of a list field follows its model; a cycle of keys loses its closing key before (off SQLite). The snapshot is removed bymigration uponce the drop is applied. Theeihwaz_*tables are never dropped. To check before upgrading: a project that removed a model without dropping its table will see that table proposed for dropping at the firstmakemigrations; a model commented out or moved to a sub-folder counts as removed. See Dropping a table. -
PostgreSQL enum type only dropped once unused: every type drop the generator writes (undoing a creation, an added column, a column leaving an enum, a dropped table) goes through
runique_cli::migration::runtime::drop_enum_type, which asks the database whether a column of the current schema still uses it, and leaves it if so. Before, theDROP TYPEwas written with no check and failed as soon as an enum was shared by two tables. -
Tag of pending migrations: every migration
makemigrationswrites starts with the line// runique: waiting migrate up(constantWAIT_MIGRATION). It is a comment: nothing changes in how migrations are applied.runique migration upremoves it from every migration oflib.rsonce the run succeeded, as one batch of files. It is recognised wherever it is in the file, alone on its line; so is the// runique: column lengths recordedmarker of snapshots, which was only read on the first line. It will be used to replace the pending migrations whenmakemigrationsis run again.
Fixed
-
Pkfollows the project's feature, not the installed command's:makemigrations,migration upandcreate-superuserresolved thePkalias with the features of the installedruniquebinary. Apk-uuidproject served by a command installed without that feature goti32migrations, without any message. The command now asks cargo which features ofruniquethe project turns on (only when a model writesPk), andcreate-superusercreates the account with the project's key type. -
The files of a folder are read in the same order everywhere:
extend!{}blocks were read in the order the system returned the files. Two files each adding columns to the same table could give a migration with its columns in a different order from one machine to another. They are now read by file name, like the models. -
A folder named like a
.rsfile is said clearly: anarchive.rs/sub-folder among the entities stoppedmakemigrationson "Cannot read file", and the same among the snapshots was skipped without a word. Both now stop with the same message, naming the folder and saying to rename or move it. -
A column renamed and modified in the same run keeps its modification: with
title: text [required, renamed_from: "job_title"]on a column optional until then, only the rename was migrated. The column stayed optional in the database while the snapshot recorded it as required, and the gap was never seen again.makemigrationsnow compares the column to what it was under its former name: the migration renames, then modifies, and the modification goes through the usual guard (--forcefor a column that becomes required). -
A removed
extend!{}block removes its columns: deleting a wholeextend!{}block, or leaving it without a field, produced no migration: the columns stayed in the database and the extension's snapshot on disk.makemigrationsnow also starts from the extensions' snapshots: the columns of the block that is gone are to be dropped, with--forcelike any column removal.migration upthen deletes the snapshot of an extension that has no field left. -
makemigrationsrefuses a primary key that changed: the name or the type of the key of a table already applied could change (in the model, or by addingbig-pk/pk-uuidto a project whose keys are writtenPk) without the command saying anything or generating a migration: the database kept the former key. The command now stops, lists every table concerned with its former and new key, and writes nothing, with or without--force. Migrating a primary key is not supported yet. -
Two admin messages showed their key: the message after logging out (
admin.logout_success) and the label of the password field of the login form (admin.password) asked for keys that existed in no language. The first now points to the existing message, the second has its text in the 9 languages. -
Pkfollows the project, no longer the command's install:makemigrationsandmigration upresolved thePkalias (primary key andPkfield) with the features of the installed command. Abig-pkorpk-uuidproject migrated by a command installed without that feature gotintegercolumns, silently. The command now reads, throughcargo metadata, theruniquefeature the project turns on; it only asks cargo when a model writesPk, and stops with a message when it can't read the answer.create-superuserfollows the same rule: it no longer inserts the account through the entity compiled with the command, but column by column, with the project's key (a UUID generated by the command underpk-uuid, the key given by the database otherwise). -
Schema inspection unavailable outside the workspace: the
sqlite,postgresandmysqlfeatures didn't enable the matching engine insea-orm-migration. Built on its own, Runique answered "Operation not supported by backend" toSchemaManager::has_tableand its neighbours; a project didn't see it as long as itsmigration/crate enabled these features itself. Each engine feature now enables it. -
Columns of a snapshot read back in reverse: the reader of snapshots and creation files (
parse_seaorm_source) returned the columns in the reverse order of the file. Harmless as long as a snapshot was only compared, by name; a table created again from its snapshot (thedownof a table drop) came back with its columns reversed. They are now returned in the order of the file, the one of the model. -
Form refused before the write: the file field kept the destination path: when
saverefused a form without attempting the write (route parameter unreadable for the key type,abcfor an integer or a number for a UUID; refused column), the returned form kept in its file field the path the upload would have gone to, while the file had never left the staging folder. The upload is now rolled back on every refusal ofsave, ofdeleteand of the gate's write: the field takes its former value back. Nothing was written to the database or moved on disk; only the field's value was wrong. -
belongs_toadded or removed on an existing table, under SQLite:runique migration upstopped on a panic of the SQL library ("Sqlite does not support modification of foreign key constraints to existing tables"), after already applying the statements placed before it in the migration. The migration is now refused at its first statement, with a message from Runique naming the table; nothing of that migration is applied. The key change goes through Runique (runique_cli::migration::runtime), which reads the engine on the connection: it applies under PostgreSQL and MySQL, and the table rebuild for SQLite will land there without the migrations being generated again. Migrations written before keep their former text. -
SQLite in memory refused by
DatabaseConfig: only addresses starting withsqlite://were recognised, and the in-memory form written that way (sqlite://:memory:) is refused by SeaORM. An address is now read as SQLite fromsqlite:on, soDATABASE_URL=sqlite::memory:connects. -
runique_test: aCOMMITinside a test went unnoticed on SQLite: the detection relied on the finalROLLBACKfailing, which sqlx 0.9.1 no longer reports when no transaction is open. The test passed while its writes stayed in the database. SQLite now has its own check, like Postgres and MySQL: an acceptedBEGINproves the test's transaction had been ended. -
List fields (
checkbox,multichoice) ignored by the admin: since the typed admin of 4.0, the ticked values were not saved, with no error, and the field did not show on the edit page. The admin now writes them with their row, in the same transaction, on create and on update; the edit page shows the field, pre-filled. A list field follows the rights of its name, like a column: read, created or updated only when the account may, shown locked when it may read it without updating it. The history traces a changed list like a column, with its values before and after. An admin's rights grid offers the list fields after the columns. Limit of this version: a model whose admin declares.form(|f| f.fields([...]))cannot name a list field there, so it is not shown. -
Admin could not create a row with a UUID key (
pk-uuid): since the typed admin of 4.0, the admin inserted amodel!{}row without its key, which the database only assigns to an integer key; the create was refused ("Action not allowed"). A model with a UUID key now gets its key (UUID v7) on insert when it is missing, whatever the path: admin, form, a SeaORMinsertin a view. A key that is given is kept. -
Admin boot check: misleading message for a
readonlyfield: a field needed to create a row, listed infieldsbut also inreadonly, was told "add it tofields" although it was there. The message now points tocreate_only, which freezes it after creation. -
Startup message naming the wrong database: it showed
DB_NAME, orrunique_dbwhen unset, whatever the connection used. WithDATABASE_URLalone it named a database that didn't exist; with both, the one that wasn't used. It now shows the name the connection reads (DATABASE_URLfirst, then theDB_*keys, then SQLite's default file), and the engine alone when no name can be read. The user and the password of the URL are never shown. -
save()took any{id}for the form's row: outside the admin,save()anddelete()read the key under{<name>_<key>}, then under a plain{<key>}. On/articles/{id}/comment, the article's number was taken for the comment's: commentidwas updated, or "not found", where the handler meant to add one. Only{<name>_<key>}is read now ({article_id}for the form"article"); a plain{id}is read withrequest.get_path_as("id"). To check: a route that updated a row through{id}must rename it{<name>_id}, orsave()creates a row. -
A database error signed the user out: when reading the account failed (database down, pool exhausted), the session was closed as for a deleted account. The request now gets a
503and the session stays open. -
Server shutdown: only Ctrl+C triggered the graceful shutdown.
SIGTERM(systemctl stop,docker stop) is now listened to, and the HTTPS (ACME) server, which had none, gives requests in flight 30 seconds. -
Typed text damaged: the words
javascript:,vbscript:,data:andfile:were removed from every text field ("data: 2024" lost "data:"). The text is kept as typed; only HTML tags are removed.sanitize_strictfollows the same rule. -
Case-sensitive allowed hosts:
Host: Example.COMorexample.com.(trailing dot) were refused. The comparison now ignores case and the trailing dot. -
Errors dropped without a trace: about fifteen errors were silently ignored (
.ok(),let _ =): reading a session, the CSRF token, the flash messages, a reset token during a database outage, a hashing failure at reset, a form's validation error. They now go through their domain's log (session.store,middleware.csrf,db.query,auth.reset,forms.validate…). Four failures are never silent any more (at leastWARN): closing the session of a deactivated account, saving a session to the database, pruning rights at boot, and the port 80 server stopping in ACME mode. -
Silent log channels:
middleware.csrf,middleware.anti_bot,middleware.https,admin.crudandadmin.bulkcould be set inwith_logand produced nothing. They now report the whole of CSRF (each refusal with its reason, whether it comes from the middleware, a form, the admin or a file upload, each new token and each rotation), a filled honeypot, a redirect to HTTPS, an admin write and an admin bulk action.admin.listreports each list shown (page, rows, total, filters, search). To check: a blocked redirect is reported undermiddleware.open_redirect(no longerhost_validation), a session purge error undersession.cleanup(no longerstore). -
Rollback of a migration plan: "lib.rs restored" was printed even when the restore had failed. The message now follows the real outcome.
-
OG_IMAGEhad two defaults: the configuration gavefavicon_runique.ico, the renderingrunique_320.avif. There is now one read and one value:/runique/static/runique_320.avif. -
docs.rs without the admin: the published documentation was built without the
adminfeature. It is now built withall-databases,adminandacme. -
runique migrationwith theDB_*keys alone: the migration crate only readsDATABASE_URL. When.envgave onlyDB_ENGINE,DB_USER…, the app connected but the migrations couldn't find the database. The command now passes on the URL built from the keys; aDATABASE_URLthat is set is still read as is. -
Engine of the
migration/crate: when it creates it,makemigrationspicks its engine the way the app picks its own, fromDATABASE_URLfirst, thenDB_ENGINE. -
runique_teston MySQL: DDL inside a test was no longer caught: the check read a variable only MariaDB has. It now sets and releases a savepoint, which the server refuses to release once the test's transaction was committed along the way.