Skip to content

Migration 0.33x

Use when upgrading from a version older than these releases: 0.336.0, 0.335.0, 0.332.0, 0.331.0 and 0.330.0.

Part of the Migration guide.

0.336.0 — security fixes (real time)

Where What changes What to do
SSEBroker with Redis With the default channel_prefix "sse", construction logs a WARNING: Redis pub/sub ignores the DB index, and another service on the same instance with the same prefix exchanges events with this one Pass a service-specific channel_prefix ("orders-api:sse") on every worker at once — workers with different prefixes do not see each other
Web Push subscription (WebPushSubscriptionService.subscribe, make_web_push_router, web registration on make_push_router) An endpoint that is or resolves to a non-public address answers 422 PUSH_ENDPOINT_NOT_PUBLIC and is not stored; send_many returns for pruning a previously stored endpoint that is not https or whose host is a non-public IP literal Nothing, if the push service is public. Self-hosted push service on the internal network: allow_private_networks=True on the WebPushDispatcher opens subscription and delivery together

0.336.0 — password-change returns a fresh pair, set-password deletes passkeys

Where What changes What to do
POST /auth/password-change Answers 200 with LoginResponseSchema instead of 204 with no body, and the body takes an optional code. Account without MFA: a fresh pair, issued after every session is revoked (in cookies for a caller that authenticated with the access cookie). Account with MFA and no code: the password changes and the response is the login challenge (mfa_required: true, mfa_token), with no pair. With a valid code: a pair with an MFA amr; a wrong code: 401 and nothing changes Bearer client: store the response's pair and drop the old one; on an MFA account, send the code along or handle mfa_required as at login. A client that treated any 2xx as success does not break, but still gets signed out when the access token's TTL ends unless it stores the pair
tempest user set-password Deletes the user's WebAuthn passkeys in the same transaction when it finds the table (--webauthn-credential-model, default src.db.models:UserWebAuthnCredentialModel) --keep-passkeys keeps the old behaviour; tell the user they register their passkey again
signup(fields=...) and signup_schema totp_secret, totp_enabled_at, totp_last_step and every __secret_columns__ column of the user model are refused (ValueError in the service, dropped by the route) Nothing for the MFA columns, which only the enrollment flow writes. If your signup writes a __secret_columns__ column of your own, move that write to on_signup
IntrospectionAuth New audiences=; without it, one WARNING per instance at construction Pass audiences= with the service's client id at the provider. See Bind the token to this service

0.336.0 — CORS, storage, text search and Stripe

Where What changes What to do
CORSSettings with ENV=production With CORS_ALLOW_CREDENTIALS=true, "null" in CORS_ORIGINS or a CORS_ORIGIN_REGEX that matches a .invalid origin (.*, https://.*) stop the boot, as "*" already did List the frontend origins in CORS_ORIGINS, or anchor the regex to your domain
accel_redirect_response, serve_object(accel_redirect=True) A media_type outside type/subtype (parameter, comma, CR/LF) raises ValueError, as in presigned_get_url; text/plain; charset=utf-8 is no longer accepted on this path Pass the type without parameters (text/plain)
Text search (search, search_condition, full_text_search) hashed_password and the __secret_columns__ answer 422; the message becomes ... has no searchable column ..., and details["allowed"] only appears when the repository declares searchable_columns If the search takes the field from the request, declare searchable_columns on the repository
StripeClient create, retrieve, update and delete raise StripeObjectMismatchError when the response's object is not the resource's Handle it where you handle StripeError today (it is a subclass)
ps_single_quote (hostbridge) Also doubles the typographic quotes U+2018–U+201B Nothing

0.335.0 — BaseUserModel gains the email_verified_at column

BaseUserModel now maps email_verified_at (timezone-aware timestamp, nullable): when the account holder proved they read the current address. Since the column is mapped on the base, migrate the database before upgrading the package: without it, every query on the user model fails (no such column: users.email_verified_at, measured with SQLite).

The behaviour change: social login's link by email (AUTH_OAUTH_LINK_BY_VERIFIED_EMAIL=true) now requires the column to be set. An existing account has NULL, so it stops being linked by email (409 OAUTH_EMAIL_TAKEN) until it proves the address — through POST /auth/email-verify/request and the link that arrives in the mailbox. A service with the knob off (the default) changes nothing beyond the migration. What sets and what clears the column is in What counts as a verified email.

What to do

  1. Generate the migration (uv run tempest db revision -m "email verified at", or alembic revision --autogenerate) or write it by hand:

    import sqlalchemy as sa
    from alembic import op
    
    revision: str = "email_verified_at"
    down_revision: str | None = "<the previous revision>"
    
    
    def upgrade() -> None:
        """Add the proof of email ownership."""
        op.add_column(
            "users",
            sa.Column("email_verified_at", sa.TIMESTAMP(timezone=True), nullable=True),
        )
    
    
    def downgrade() -> None:
        """Drop the proof of email ownership."""
        op.drop_column("users", "email_verified_at")
    
  2. Run uv run tempest db upgrade (or alembic upgrade head) and only then deploy the new version.

Backfilling existing accounts — your decision

The SDK fills nothing for you: it does not know how each existing account became active. Backfill only if you know the active accounts in the database were activated through the mailed link — that is, the service always ran with AUTH_AUTO_ACTIVATE=false, AUTH_RETURN_TOKEN_IN_RESPONSE=false and EmailUtils wired, and nobody activated an account from the admin site or through tempest user activate. If any of that failed for part of the database, narrow the WHERE to the rest (by created_at, for instance) or do not backfill.

There is no column holding the activation time; created_at is the lower bound the database knows, and it is the value the step below writes. Add to the migration's upgrade():

import sqlalchemy as sa
from alembic import op


def upgrade() -> None:
    """Mark the active accounts, activated by email, as verified."""
    users = sa.table(
        "users",
        sa.column("is_active", sa.Boolean()),
        sa.column("created_at", sa.TIMESTAMP(timezone=True)),
        sa.column("email_verified_at", sa.TIMESTAMP(timezone=True)),
    )
    op.execute(
        users.update()
        .where(users.c.is_active.is_(True), users.c.email_verified_at.is_(None))
        .values(email_verified_at=users.c.created_at)
    )

Without this step, an account that wants to link social login by email verifies its address once, and linking works again.

0.335.0 — security fixes that change behaviour

This release closes vulnerabilities, and several fixes swap an unsafe default for a safe one. The table says what changes for existing users of the SDK and what to do. Each item is detailed in the CHANGELOG and in the recipe named.

Where What changes What to do
ENV=production AUTH_AUTO_ACTIVATE=true or AUTH_RETURN_TOKEN_IN_RESPONSE=true stop the boot; without EmailUtils on UserAuthService (with an auth_settings that composes EnvironmentSettings), the flows that send a link answer 503 INTEGRATION_DISABLED Turn both flags off in production and pass email= to the service
key_by_header is_known= is required; without it, TypeError Pass a synchronous check that says whether the header value is a key you issued
IdempotencyMiddleware Requests without a credential are not deduplicated; entries written by an older version answer 422 IDEMPOTENCY_KEY_REUSED until they expire Pass allow_anonymous=True only if you need to deduplicate anonymous POSTs; wait out the TTL of old entries
WebhookSignatureVerifier, make_stripe_webhook_dependency An empty secret raises ValueError at construction Configure the webhook secret before booting
POST /auth/webauthn/register/begin Requires a WebAuthnRegisterBeginSchema body (current_password and, with MFA, code); without it, 422 Update the client to ask for the password before registering a passkey
Password reset and mfa_reset Delete the user's passkeys revoke_passkeys=False keeps the old behaviour; tell users they register their passkey again
make_admin_router with access_policy The SQL console, tasks and logs are denied to everyone Pass surface_policy= granting whoever should see them
Admin The SDK's credential columns (totp_secret, push keys, token digests) disappear from the screens, list_display included; cookies issued before the upgrade are refused once Nothing; operators log in again
Custom SessionStore The protocol gained touch; a store without it works with a DeprecationWarning Implement touch, which updates only a session that still exists
TaskQueue (results) Results are stored as JSON; pickled results from before the upgrade are unreadable until their TTL result_serializer="pickle" only for a Redis nobody else writes
WebPushDispatcher Endpoints resolving to an internal network are not delivered; sending has a 10 s timeout allow_private_networks=True only in test environments; behind a proxy with no external DNS, pass resolver=
describe_image_tool, transcribe_audio_tool The path argument exists only with path_root= Pass path_root= with the folder the model may read
ChatMemory.delete_for_chat Requires user_id Pass the chat's owner
HoneypotMiddleware patterns= matches the path only; the query has query_patterns= Move query patterns to query_patterns=
STT, diarization, voiceprint Audio longer than 1 h once decoded is refused (422) max_audio_seconds=None for trusted long files
WebSocket login Use make_jwt_bearer_resolver, which checks the token type Replace the hand-written resolver

0.332.0 — the DLQ pins the consumer's ack policy

On a QueueSpec with a dead-letter, MessageBroker.on / register and subscribe / Consumer pin REJECT_ON_ERROR on the subscriber itself when ack_policy is None (#642). Passing ACK, ACK_FIRST or NACK_ON_ERROR on a dead-lettered spec now raises ValueError at registration: none of the three sends the failure to the DLQ. A consumer without a dead-letter is unchanged.

What to do

  1. Drop ack_policy=AckPolicy.REJECT_ON_ERROR from dead-lettered consumers if you like: it is now the default. Keeping it still works.
  2. A dead-lettered consumer that passed ACK, ACK_FIRST or NACK_ON_ERROR fails at boot: switch to REJECT_ON_ERROR (or omit it), or drop the dead-letter from the spec if failures should not go to the DLQ.

0.331.0 — new admin look, capped storage uploads

admin.css was rewritten on tokens and AdminTheme changed two defaults: header_bg goes from "#0f172a" to "#ffffff" and radius from "6px" to "8px". The tempest-admin-* classes stay.

The SubjectStorageClient protocol gained presigned_post_policy, and presigned_get_url gained filename, media_type and as_attachment.

The admin list search (?q=) now matches a substring in any of the search_fields; it used to compare by equality in all of them.

What to do

  1. If you pass custom_css_url overriding fixed colors of the dark header: review the sheet against the light header.
  2. To keep a dark header, pass AdminTheme(header_bg="#0f172a"): the chrome text turns light on its own from the luminance. If the guess is wrong, pin it with header_fg=.
  3. Behind a proxy that terminates TLS, use the upgrade to declare SERVER_PUBLIC_SCHEME=https and register the PublicSchemeMiddleware (Security): without it the admin login shows as not secure.
  4. A storage client of yours implementing SubjectStorageClient needs presigned_post_policy and the three new presigned_get_url parameters to keep passing the type-checker. AsyncMinIOClient, LocalObjectStorageClient and FakeObjectStorageClient already comply.
  5. A service that generates a client from the OpenAPI and uses image_media_type_field: call prune_orphan_enum_schemas(app) in create_app to drop the orphan ImageMediaType (Uploads).

0.330.0 — a push subscription no longer changes owner

POST /subscribe (Web Push) and POST /register (mobile push) no longer transfer to the caller an endpoint/token already registered by another account (#632): the row stays with its owner and the route answers as for a new subscription. Before, another account signing in on the same browser or device moved the subscription on its own.

What to do

  1. In the client, call POST /unsubscribe (Web Push) or POST /unregister (mobile) on sign-out, before another account uses the same device.
  2. If moving devices between accounts is a real case for your service, turn it on explicitly: make_web_push_router(..., transfer_ownership=True) / make_push_router(..., transfer_ownership=True), or subscribe(..., transfer_ownership=True) / register(..., transfer_ownership=True) on the service.
  3. A subscribe/register override does not need to change: the router passes transfer_ownership only when the option is on.