Skip to content

v0.37.0

Choose a tag to compare

@github-actions github-actions released this 11 Nov 19:37
· 28 commits to main since this release
Immutable release. Only release title and notes can be modified.
b6e4909

What changes in 0.37.0

0.37.0 gives every app a person's language the same way: the account's language from the sign-in, one resolver for "else the browser's", and the app's language named to the issuer. It also closes a path spelling that reached a route past webauth's path rules, and removes one unused parameter. Three changes are Breaking; every host changes its wiring once.

Per app

  • Every host:
    • pass ui_language= to install_sign_in_routes: a callable that answers resolve_language(...) for the request, or lambda request: None to send no language;
    • build one AppLanguages(offered, default) and call resolve_language(languages, account_tag=account_language_of_session(...), accept_language=request.headers.get("accept-language")) where the page's language is decided; write only its answer into <html lang>.
  • songmaker, presentator (own session store): add a nullable column of at least 35 characters to the session table, take account_language in create and return it on the record.
  • hopin, skat (single_process_stores): no store change.
  • songmaker: backchannel_dependencies is gone; songmaker already stopped passing it.
  • A host test that sends a path with a control character and expects a route's answer or a 404 now gets 400.

New

  • webauth.languages (#718, PR #723; docs/host-contract.md, LANGUAGE-01 to LANGUAGE-12).
    • AppLanguages(offered, default) is validated once: each tag in shape, default one of offered as spelled, no two offered tags equal ignoring case.
    • resolve_language(languages, *, account_tag, accept_language) -> str answers the first match of the account's tag, then the Accept-Language ranges by descending weight, then the default.
    • Matching is RFC 4647 Lookup: de-AT finds an offered de; de never finds an offered de-CH. The answer is the app's own spelling.
    • A tag that is None, not in shape or unmatched counts as absent. Weight 0 and * are skipped; a malformed header element is dropped alone.
    • is_language_tag is the one owner of a tag's shape; LogoutPageText uses it.
  • webauth.dependencies.account_language_of_session(connection, *, sessions, config) -> str | None (#720, PR #727; LANGUAGE-17 to LANGUAGE-20).
    • It answers the account's language of the session a request carries, or None without a live session.
    • It only loads. It never renews a session, refuses a request or sets a cookie, so a public page may call it.

Breaking

  • The session row carries the account's language (#720, PR #727; LANGUAGE-13 to LANGUAGE-16).
    • SessionRecordStore.create requires the keyword account_language: str | None; SessionRecord requires the property account_language; OidcIdentity gains the required field account_language.
    • The callback writes the ID token's locale claim when it is a non-empty, printable string of at most 35 characters (MAX_ACCOUNT_LANGUAGE_CHARS), else None. A locale claim never refuses a sign-in, and webauth does not judge the tag.
    • Written at sign-in only. Renewal and refresh-token rotation leave it: a person who changes the account's language sees it after the next sign-in. Sessions from before this release read None.
    • Migration: a host with its own session store adds the nullable column, takes the keyword and returns it. A host on single_process_stores changes nothing. No host builds an OidcIdentity itself.
  • The start route names the app's language to the issuer (#726, PR #728; LANGUAGE-21 to LANGUAGE-27).
    • install_sign_in_routes requires ui_language: Callable[[Request], str | None]; OidcRelyingParty.begin_login requires the keyword ui_locales: str | None.
    • A tag sends ui_locales=<tag> (OpenID Connect Core, section 3.1.2.1); None sends none; a string not in shape raises ValueError and nothing goes to the issuer.
    • Migration: every host passes ui_language. A host that calls begin_login itself passes ui_locales=None or a tag.
  • install_sign_in_routes no longer accepts backchannel_dependencies (#717, PR #725).
    • The back-channel logout route is open to anyone who can reach it, and the signed token is its only control; reachability stays the deployment's duty.
    • SIGNIN-45, SIGNIN-46 and SIGNIN-48 left the host contract and the later ids of that section moved up by up to three; PR #725 holds the map.
    • Migration: a host that passes the argument removes it.

Security

  • A path with a control character is refused (#722, PR #724; STACK-08 to STACK-13).
    • The standard stack answers an HTTP request whose path carries U+0000 to U+001F or U+007F with 400 {"detail": "Malformed request path"}, ahead of every rule and route.
    • Before, a path ending in an encoded line feed matched a route while webauth's exact path rules did not know it. Start, callback and logout then spent the default rate budget instead of the sign-in budget and answered without no-store; the back-channel path lost its exemptions and its body rule. It gave no way to end a session without a signed token.
    • A refused request spends no rate budget and opens no session lookup. WebSocket handshakes pass untouched.
    • No migration.

Not visible to a host

  • The gate and release workflows pin quality v0.11.0 (#719, PR #721).

Full Changelog: v0.36.0...v0.37.0