Releases and security

4.1.0 - unreleased

Security

  • login_required trusted 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 writes ip: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 /64 prefix; an IPv4 address seen through an IPv6 socket (::ffff:1.2.3.4) is still counted alone.
  • URL field: only http and https pass: TextField::url accepted any scheme, and relied on the word javascript: being removed from the text, which could be bypassed (java<TAB>script:, read as javascript: by a browser). The URL is now read by the parser browsers follow and must be absolute, in http or https. To check: a URL field that received ftp://, 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.
  • cleaned could 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=text was enough: the victim left the field empty, sent the form to the current address, and cleaned("bio") returned the link's text. cleaned now 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 make makemigrations fail: 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_fn and admin.daemon removed: they came from the former admin (filter functions, code generator) and no longer produced anything. Drop .filter_fn(...) and .daemon(...) from with_log(|l| l.admin(...)) calls. A list's filters now show in the admin.list log.

  • Admin hot_reload removed: AdminConfig.hot_reload and .hot_reload(...) in with_admin had done nothing since the new admin (in development, templates are reloaded on every render, with or without this setting). Drop the call.

  • cleaned no longer reads the URL, Forms::set_url_params replaced by set_path_params: cleaned::<T>("x") returns the value of field x and nothing else. For a value of the URL, use request.get_path("x") / request.get_path_as::<T>("x") or request.get_query("x"); to pre-fill a field from a link, form.add_value("x", value). A search form sent with GET doesn't change (its fields are filled from the query string). Forms::set_url_params(path, query) becomes Forms::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_CONNECTIONS and DB_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 with PoolTimedOut (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 sets DB_MIN_CONNECTIONS=20 and DB_MAX_CONNECTIONS=100 in its .env. The .env written by runique new shows these three variables, commented out, with their defaults.

  • The mailer is no longer declared in the builder: with_mailer() and with_mailer_from_env() removed: the sending configuration lives in .env only (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() from main.rs; a project that gave a MailerConfig to .with_mailer(…) moves its values to .env. An absent mailer no longer stops the boot, except in production when with_password_reset is 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, makemigrations and migration up | down | status read DATABASE_URL first, then the separate keys. What changes: (1) a complete DATABASE_URL whose connection fails no longer blocks right away, Runique warns and tries the keys; (2) an incomplete DATABASE_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 without DB_ENGINE are 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 in DB_PASSWORD; (6) the migration commands connect before running the migration crate and hand it the address that answered. To check: a DB_ENGINE=sqlite left next to a server address becomes the database in use when the server stops answering; a lone DB_NAME, without DB_ENGINE, is no longer taken for SQLite; a password already encoded by hand in DB_PASSWORD would be encoded a second time. See Database.

  • makemigrations needs the database: the command now connects first, to the database of the .env (DATABASE_URL, otherwise the DB_* keys), and stops with an error when it doesn't answer, before anything is read or written. It still writes nothing to the database; only runique migration up applies. The error gives the cause without the password. To check: a script or a CI job that ran makemigrations with no database available must now provide one. In code, runique::cli::makemigration::run is now async.

  • makemigrations refuses 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 in lib.rs (another project's database, or the file of an applied migration deleted). The framework's migrations are always known; their names are exposed in migrations_table::FRAMEWORK_MIGRATION_NAMES. A new database, without seaql_migrations, passes.

  • runique migration up reads the models: after a run that succeeded, it writes the snapshot of the tables its migrations just changed, from src/entities (--entities option), and removes the tag of the pending migrations, as one batch. In code, runique::cli::migrate::up takes the entities folder as its first parameter. To check: don't change a model between makemigrations and migration up.

  • makemigrations no longer writes the snapshots, and run again it replaces: a snapshot is the state of an applied table, written by migration up only. Running makemigrations again 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 of lib.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 after makemigrations must wait for migration up. Existing projects have nothing to do: their migrations carry no tag and their snapshots are already there.

  • makemigrations refuses 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, or none). When two migrations of lib.rs start 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.

  • makemigrations reads every snapshot before computing: a .rs of snapshots/ or snapshots/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 .rs file put by hand in these folders that is not a snapshot must be moved out.

  • The runique command is in its own crate, runique-cli: the binary leaves the runique crate. The reason: installed once for every project, the command decided the primary key type from its own features, while each project's Cargo.toml is what sets it; out of runique, it reads the project's features instead of its own. Installing becomes cargo install runique-cli --locked instead of cargo 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 called runique and its subcommands don't change. Everything the command does followed: runique::cli, runique::new_project, runique::auth::create_superuser and the tooling of runique::migration (reading the models, diff, generation, cli_migration) now live in runique-cli under the same paths (runique_cli::migration::…, runique_cli::new_project, runique_cli::create_superuser). The runique::migration module is gone: the description of the models, schema, moves up to runique::schema (runique::schema::ModelSchema, ColumnDef…); the functions the generated migrations call, runtime, are in runique-cli (runique_cli::migration::runtime), and a project's migration crate depends on runique-cli for them. An application that only uses model!{}, the prelude and its generated migrations has nothing to change. The runique crate no longer depends on clap, syn, quote, proc-macro2, crossterm, dialoguer or rpassword.

  • The site's language is chosen through the .env or the builder, set_lang() is no longer exposed: until now only the runique command read LANG, and an application stayed in English without set_lang(). The application now reads LANG from its .env, and .with_lang("fr") on the builder sets it from the code, with the last word. set_lang() leaves the prelude and runique::utils::trad: in a main.rs, remove the set_lang(Lang::Fr); line and put LANG=fr in the .env, or write .with_lang("fr") on the builder. runique::utils::trad::switch_lang and set_default_lang are no longer re-exported either. A project that already had LANG=fr in its .env for the command sees its application turn to French. The system's LANG is not read by the application.

  • Lang gains a case, Lang::Other: a language of the project's locales/ folder. A match on Lang without a default case must add one. Lang::code() is no longer a const function.

  • The framework's translation keys are renamed and go through constants: every message follows subject.section.key (forms.required becomes forms.error.required, log.csrf.refused becomes csrf.log.refused), and the framework's code asks for them by a constant (runique::utils::trad::keys::forms::error::REQUIRED). A project that called t("…") 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_KEYS becomes 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_404 returns the handler's error: both get_or_404 (Entity::objects and after filters) return AppResult<Model> instead of Result<Model, Response>. In a handler, let article = …get_or_404(…).await?; is enough; the former Err(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_pipeline and aegis return BodyRefusal: 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_from only 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. The mariadb feature, the DatabaseEngine::MariaDB variant and the mariadb values of DB_ENGINE and DATABASE_URL are removed; Runique's tests run on MySQL 8.4. To check: a project that turned the mariadb feature on moves to mysql, with DB_ENGINE=mysql and a mysql:// URL.

Added

  • runique-cli no longer depends on runique: the command has its own copy of what it took from the framework, namely the database connection rule (DATABASE_URL, then the DB_* 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 in runique, so that they don't drift apart silently. The command no longer re-exports schema.

  • The site's time zone, TZ: the .env's TZ key (TZ=Europe/Paris) was read and kept in config.timezone, with nothing using it. The admin now shows at the site's hour the dates that carry their offset (timestamp_tz columns), summer time included; a plain timestamp column, which doesn't say what instant it is, is still shown as stored. Templates get {{ timezone }}, to hand to the date filter (date(format=…, timezone=timezone)). A name that is no time zone stops the start. Without TZ, with TZ= left empty, or with UTC, nothing changes. The .env written by runique new holds TZ=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's LANG. The code may be written fr, fr-FR or fr_FR.UTF-8, or be that of a language of the project's locales/ 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-LU is French and pt-BR Portuguese, 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's locales/ folder, a nl-NL or nl_NL folder is accepted and gives the language nl, a pt-BR folder completes Runique's Portuguese, and two folders for one language stop the start.

  • Two more crates: runique_i18n and runique_atomic: the translation engine with its messages, and the all-or-nothing batch of files with its journal, leave runique for a crate of their own, because the runique-cli command uses them as much as the framework does and they must exist in one place only. Nothing changes for an application: runique::utils::trad re-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-Language header), among Runique's and those of the project's locales/ 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 carries Vary: 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 }}">. A lang value passed by the handler keeps priority. The two admin mails now announce the language they are written in, instead of fr.

  • The project's translations: the locales/ folder: a project keeps its own translations in locales/<language>/<subject>.json, like Runique. Read at start by the application and by the runique command, 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 its lang.json (name, variants, fallback language). Lang::from("nl") then returns that language, Lang::available() lists them, and Lang::name() gives its name. An invalid folder stops the start; a misspelt key or untranslated messages are said in the log. LOCALES_DIR keeps 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; down undoes 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. Once migration up has run, the snapshot is under the new name and the applied renamed_from is 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 column renamed_from applied 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's meta, managed: false makes makemigrations generate 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 a belongs_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's CompressionLevel). 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 example runique-cli 0.1.0. It is the version of the runique-cli crate, distinct from runique's.

  • ExclusiveLogin: the last parameter of login takes ExclusiveLogin::{Off, On, Strict} as well as a bool (false = Off, true = On, unchanged). Strict refuses the sign-in (LoginError::Session) and closes its session when the account's other sessions could not be closed; On logs the failure and signs in.

  • Logs follow .env: with nothing written in with_log, RUNIQUE_ENV=dev turns the useful channels on (INFO) and DEBUG=true turns them all on, chatty ones included, in production too. A channel set by hand keeps its level; .manual() switches this off. To check: with DEBUG=true, the logs hold the value of the fields visitors type in (passwords excepted), and the global filter moves to debug. Production without DEBUG is unchanged.

  • Admin boot log (builder.registry): the configuration kept, each registered model (columns, filters, actions, form fields) and each route declared admin. Three warnings are never silent: an admin sign-in with neither a LoginGuard nor a rate limiter (outside development), list options with no effect (links, search_help, empty_value), and Runique's stylesheets not found (a STATIC_RUNIQUE_PATH that 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 (log section of the language files). They follow the application's language (.with_lang() or LANG); field names stay in English, the value of reason (CSRF refusal) and outcome (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 of set_required(true, Some("…")) is now honoured inside a form.

  • Atomic file writes: runique new, runique makemigrations and the creation of the migration/ 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-journal left 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, down and status refuse to start as long as an interrupted makemigrations isn't repaired. The messages are translated in the 9 languages (atomic section). See Atomic file writes. To check: the names .runique-journal, *.runique-tmp and *.runique-bak belong 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 form model!{} generates; its customize() and its clean then apply in the admin (for instance .replace() on an image). The return type becomes ModelAdmin<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. Without with_form, nothing changes.

  • .replace() on FileField and MediaField: 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 outside MEDIA_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. makemigrations spots 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 migration m…_drop_{table}_table.rs: DROP TABLE IF EXISTS in up, the table created again, empty, in down. 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 by migration up once the drop is applied. The eihwaz_* 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 first makemigrations; 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, the DROP TYPE was written with no check and failed as soon as an enum was shared by two tables.

  • Tag of pending migrations: every migration makemigrations writes starts with the line // runique: waiting migrate up (constant WAIT_MIGRATION). It is a comment: nothing changes in how migrations are applied. runique migration up removes it from every migration of lib.rs once 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 recorded marker of snapshots, which was only read on the first line. It will be used to replace the pending migrations when makemigrations is run again.

Fixed

  • Pk follows the project's feature, not the installed command's: makemigrations, migration up and create-superuser resolved the Pk alias with the features of the installed runique binary. A pk-uuid project served by a command installed without that feature got i32 migrations, without any message. The command now asks cargo which features of runique the project turns on (only when a model writes Pk), and create-superuser creates 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 .rs file is said clearly: an archive.rs/ sub-folder among the entities stopped makemigrations on "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. makemigrations now compares the column to what it was under its former name: the migration renames, then modifies, and the modification goes through the usual guard (--force for a column that becomes required).

  • A removed extend!{} block removes its columns: deleting a whole extend!{} block, or leaving it without a field, produced no migration: the columns stayed in the database and the extension's snapshot on disk. makemigrations now also starts from the extensions' snapshots: the columns of the block that is gone are to be dropped, with --force like any column removal. migration up then deletes the snapshot of an extension that has no field left.

  • makemigrations refuses 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 adding big-pk / pk-uuid to a project whose keys are written Pk) 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.

  • Pk follows the project, no longer the command's install: makemigrations and migration up resolved the Pk alias (primary key and Pk field) with the features of the installed command. A big-pk or pk-uuid project migrated by a command installed without that feature got integer columns, silently. The command now reads, through cargo metadata, the runique feature the project turns on; it only asks cargo when a model writes Pk, and stops with a message when it can't read the answer. create-superuser follows 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 under pk-uuid, the key given by the database otherwise).

  • Schema inspection unavailable outside the workspace: the sqlite, postgres and mysql features didn't enable the matching engine in sea-orm-migration. Built on its own, Runique answered "Operation not supported by backend" to SchemaManager::has_table and its neighbours; a project didn't see it as long as its migration/ 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 (the down of 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 save refused a form without attempting the write (route parameter unreadable for the key type, abc for 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 of save, of delete and 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_to added or removed on an existing table, under SQLite: runique migration up stopped 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 with sqlite:// were recognised, and the in-memory form written that way (sqlite://:memory:) is refused by SeaORM. An address is now read as SQLite from sqlite: on, so DATABASE_URL=sqlite::memory: connects.

  • runique_test: a COMMIT inside a test went unnoticed on SQLite: the detection relied on the final ROLLBACK failing, 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 accepted BEGIN proves 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 a model!{} 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 SeaORM insert in a view. A key that is given is kept.

  • Admin boot check: misleading message for a readonly field: a field needed to create a row, listed in fields but also in readonly, was told "add it to fields" although it was there. The message now points to create_only, which freezes it after creation.

  • Startup message naming the wrong database: it showed DB_NAME, or runique_db when unset, whatever the connection used. With DATABASE_URL alone 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_URL first, then the DB_* 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() and delete() 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: comment id was 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 with request.get_path_as("id"). To check: a route that updated a row through {id} must rename it {<name>_id}, or save() 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 503 and 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: and file: were removed from every text field ("data: 2024" lost "data:"). The text is kept as typed; only HTML tags are removed. sanitize_strict follows the same rule.

  • Case-sensitive allowed hosts: Host: Example.COM or example.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 least WARN): 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.crud and admin.bulk could be set in with_log and 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.list reports each list shown (page, rows, total, filters, search). To check: a blocked redirect is reported under middleware.open_redirect (no longer host_validation), a session purge error under session.cleanup (no longer store).

  • Rollback of a migration plan: "lib.rs restored" was printed even when the restore had failed. The message now follows the real outcome.

  • OG_IMAGE had two defaults: the configuration gave favicon_runique.ico, the rendering runique_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 admin feature. It is now built with all-databases, admin and acme.

  • runique migration with the DB_* keys alone: the migration crate only reads DATABASE_URL. When .env gave only DB_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; a DATABASE_URL that is set is still read as is.

  • Engine of the migration/ crate: when it creates it, makemigrations picks its engine the way the app picks its own, from DATABASE_URL first, then DB_ENGINE.

  • runique_test on 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.


← Newer Older →