Skip to content

Socrate v1.15.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 18:53
· 65 commits to main since this release
29989ac

Security release on the v1.x line. It closes the findings of the November 2026 review: account
and session state that a concurrent save could undo, controls that failed open when the database
erred, a locked account that revealed itself, consent and code-exchange gaps, client-IP attribution
behind appending proxies, timing that told which client_ids exist, and app deletion breaking the
audit log's integrity. Several controls are new and ship off (LOCKOUT_SOURCE_MODE,
PRIVILEGED_SCOPE_MODE, SERVICE_USER_SCOPE_MODE, CODE_REPLAY_MODE), and existing modes cover
more routes. Four migrations, no change of default, no change to discovery, claims or error codes.

Upgrade notes

  • Migrations 0033–0036 (AUTO_MIGRATE=false: run them deliberately, after a backup). 0033 adds
    audit_chain_head (the server anchors it on the existing log at startup), 0034 adds
    login_source_failures, 0035 adds two nullable columns and an index to authorization_codes,
    0036 drops the foreign key from security_audit_logs.app_id to apps. None rewrites data; all
    work on a fresh install. Audit rows whose app_id an earlier app deletion nulled keep failing
    the integrity scan: their attribution cannot be restored.
  • Before deploying, check that no client relies on omitting PKCE without a secret — this must
    return nothing, or those clients must send a code_challenge:
    SELECT client_id FROM apps WHERE NOT is_public AND coalesce(client_secret_hash, '') = '';
  • Applications calling the policy decision point about a global admin who is not a member of
    the app must send the admin's token, not a bare user_id (backendkit's pep already does).
  • More than one proxy hop in front of Socrate: list every hop in TRUSTED_PROXIES (the client
    is now the right-most entry not listed). The deploy kit's single Caddy is unaffected.
  • Users re-authenticate once if they had a consent page open during the upgrade, or a browser
    holding the admin console's old refresh cookie.
  • A wrong password on a locked account now gets 401 like any wrong password, not 403.
  • Stored A4 policies (POLICY_MODE shadow/enforce): add the app-admins rule and the new
    step-up actions to destructive-step-up (see docs/EXTENSIBILITY.md); with POLICY_MODE=off,
    the default, nothing changes.
  • New modes are off by default; run each in observe and read its audit events before
    enforce.

Security

  • Deleting an app no longer rewrites its audit rows. The audit log's app_id had a foreign key
    to apps, so deleting an app first set app_id to null on every audit row naming it: the rows
    lost their attribution and, app_id being covered by each row's hash, the integrity scan reported
    them as tampered. The client_deleted event, written after the delete, was refused by the same
    key and lost. The foreign key is dropped (migration 0036; the model no longer declares it): an
    app's audit rows keep naming it, still verify, and its deletion is recorded. Deploy note:
    migration 0036 drops one constraint and rewrites no data (#260).

  • Client authentication takes the same time whether the client exists or not. The token
    endpoint (every grant, and the token exchange), introspection and revocation answered an unknown
    client_id without checking any secret, a public client against no hash, and an inactive client
    before its secret, while a known confidential client paid a bcrypt check (cost 12, about 250
    ms): the response time told which client_ids exist. Those cases now pay a check of the same cost
    against a fixed placeholder hash (computed at startup, before the server serves), and so does a
    client whose secret is still a legacy SHA-256 hash. The token exchange already authenticated the
    client before examining the subject token. Deploy note: none (#366).

  • A client without a stored secret must use PKCE, and one rule decides who is confidential.
    The token endpoint required a secret from any client with a stored hash and none from the
    others, but PKCE was required only of clients flagged public: a client not flagged public and
    stored without a secret (legacy data) could redeem a code with neither. App.IsConfidential,
    which had no caller, is now that one rule (a stored secret, always required) and is used by the
    token endpoint and the token exchange; PKCERequired also holds for every client that is not
    confidential. Unused helpers that could drift from it are removed (App.HasRedirectURI,
    ValidateRedirectURILoose/Strict, CodeStore.GetCode). Deploy note: before deploying, check
    that no such client relies on omitting PKCE — SELECT client_id FROM apps WHERE NOT is_public AND coalesce(client_secret_hash, '') = ''; should return nothing, or those clients must send a
    code_challenge (#366).

  • The consent step acts only on the request it was shown for, and honours prompt=login. The
    consent POST took the authorization parameters from the submitted form, so a form edited after
    the consent page was rendered could change the scope, the PKCE challenge, the nonce or drop
    max_age, and prompt=login was checked only when the page was shown. The consent token now
    carries a digest of the request it was issued for (client, response type, redirect_uri,
    scope, state, nonce, PKCE challenge, max_age, prompt=login); a form that differs, or a token
    without one, is refused. prompt=login is carried through the login and consent forms, and the
    consent step answers login_required unless the sign-in happened on the login form. Deploy
    note: a consent page open during the upgrade asks to sign in again (#366).

  • The client IP is the right-most untrusted X-Forwarded-For entry. Behind a trusted proxy,
    the left-most entry was taken as the client, but a proxy that appends to the header (nginx's
    $proxy_add_x_forwarded_for, Caddy with trusted_proxies) keeps whatever the client sent
    there, so a client could choose the address that rate limiting, IP blocks, auto-defense and the
    audit log saw. The header is now read from the right: the client is the last entry that is not
    in TRUSTED_PROXIES (an entry with a port counts as its address), and an empty or malformed
    entry ends the walk. The deploy kit's Caddy replaces the
    header, so its attribution does not change. Deploy note: a deployment with more than one proxy
    hop must list them all in TRUSTED_PROXIES (#366).

  • A replayed authorization code can revoke the tokens it was redeemed for (CODE_REPLAY_MODE,
    default off). A code presented again after its redemption was refused, but the tokens issued
    for it stayed valid, although the replay means someone else holds the code (RFC 6749 §4.1.2).
    The code now records, with its redemption, the refresh-token family and the access-token jti
    it was redeemed for (migration 0035). observe audits a replay as auth_code_failed with
    reason: code_replayed; enforce also revokes that family (every refresh token rotated from
    it) and that access token, as seen by introspection, userinfo and the admin API (a resource
    server that only verifies the JWT accepts it until it expires) — when the replay authenticates
    as the code's client (its secret, or for a public client the code's PKCE verifier), so that
    whoever merely saw a used code cannot end the sign-in (revoked: none_unauthenticated), nor
    erase the code before its client replays it. A used code is recognised as a replay even after
    it has expired, or when it loses a race with its own redemption, and while a replay mode is on a
    redeemed code is kept as long as its refresh-token family can be refreshed (the refresh-token
    TTL, extended at each rotation), so the expiry sweep does not erase it; under enforce a
    refresh whose code cannot be kept is refused (server_error, the old refresh token stays good
    to retry with), under observe it is only logged. An authenticated replay
    signals once, unless the revocation could not be recorded (revoked: failed): the code is then
    kept, so the next replay tries again; codes redeemed before the migration are audited only. Deploy note: migration 0035
    (two nullable columns and an index); new variable CODE_REPLAY_MODE, default off; with it
    on, authorization_codes keeps one row per active sign-in, and each refresh updates it (#366).

  • A sign-in records its time without saving the whole user. Hosted login, admin login,
    invite acceptance and magic-link sign-in loaded the user, checked the password (and MFA), then
    saved the whole row with UserRepository.Update only to record the last-login time, writing
    back every column Update does not guard (the password, token-version and lockout columns
    are guarded) from the copy loaded before the checks. A change made to the account in between was undone: an MFA enrolment confirmed while
    a sign-in was in flight was switched off again (or an MFA reset restored the old secret), and a
    rename or email change was reverted. These paths now use the new UserRepository.RecordLogin,
    which writes only last_login (and last_login_attempt where the path set it) and
    updated_at; a failure to record it stays non-fatal, as before. Deploy note: no migration, no
    environment variable, no contract change.

  • The decide endpoint no longer reveals who the global admins are. By a bare user_id, a
    subject who is not a member of the calling application got 404 unknown subject unless they
    were a global admin, whose decision was evaluated (200), so any application could test user
    ids for admin rights. A global admin's implicit access now needs the admin's own token (which
    backendkit's pep always sends); by id they are a 404 like any non-member. The admin
    namespace reservation also matched only an upper-case method: get /api/admin/… and other
    spellings an admin rule's glob matches are now refused too (400). Deploy note: an
    application that asks about a global admin by user_id must send the admin's token instead
    (#366).

  • The right password on a locked account is audited. Since #404 a wrong password on a locked
    account is audited as login_failed with account_locked: true, but the right one was refused
    without any event, although whoever typed it knows the credential while the lock may be there
    because of an attack. Both are now audited, with password_verified (true or false); under
    a per-source lock the event also carries the source it was refused for (the IPv6 /64, as the
    counting path records it). Deploy note: none.

  • Only a superadmin acts on a superadmin's account. Deleting and blocking a superadmin were
    refused, but any admin (or the monitoring console, with monitoring:write) could revoke a
    superadmin's sessions or unlock one. One rule now covers every per-user admin action: on a
    superadmin's account, revoke-tokens, unlock and attributes need a superadmin (403
    otherwise), and delete and block stay on /api/admin/superadmins/{id}. Deploy note: none (#366).

  • A password-reset link no longer outlives a password change. Reset links were single-use but
    stayed valid until they expired, even after the password had been changed or reset another
    way, so an old link left in a mailbox could undo a newer password. A link issued before the
    account's last password change is now refused (invalid or expired token), compared at the
    link's one-second precision, and the reset writes only if the password has not changed since it
    was checked, so a change that lands meanwhile is not overwritten. An admin's password reset and
    the activation of an invited account now record the change too, as a reset and a change already
    did. Deploy note: none (#366).

  • Introspection reports a locked or deleted user's token as inactive. /oauth/introspect
    answered active: true for a locked user's token, and for a deleted user's (or when the user
    could not be read), while Socrate's own API refused them. A user's token is now active only
    while the user exists, is readable, has not revoked its tokens and is not locked; a token whose
    revocation status cannot be read is inactive too. A service-account token (sub: app:{id}) is
    active only while its app exists and is active, as on the service-account API. Deploy note:
    none (#366).

  • Two token checks no longer pass when the database errors. If the list of revoked tokens
    could not be read, a bearer token was accepted; it is now refused with 503 and Retry-After
    (no invalid_token challenge, so a client retries instead of discarding its token), on the
    user API, the service-account API and the optional-auth routes (/oauth/logout,
    /oauth/revoke, which must not report a revocation they could not tie to the caller). If a
    refreshed token could not be marked as used, the refresh succeeded and the old token stayed
    redeemable; the refresh is now refused with 500 server_error, and the client retries with
    the old token. Deploy note: none (#366).

  • A failed-sign-in lock no longer has to lock the owner out. New LOCKOUT_SOURCE_MODE (off
    default, observe, enforce). The lockout counted wrong passwords and codes per account, so
    anyone who knew an email could keep the account locked, admins and superadmins included. Under
    enforce, failures are counted per account and source (client IPv4 address, or IPv6 /64):
    reaching MAX_FAILED_ATTEMPTS locks that source out of that account for
    LOCKOUT_DURATION_SECONDS, audited account_locked with lock_scope: source, and the owner
    signing in from elsewhere is unaffected. An account-wide lock (an admin block, or one set before
    enforce) still applies. If the per-source count cannot be written, the attempt counts on the
    account, as in off (source_store_error in the audit details). observe keeps the account-wide lock and adds source,
    source_failed_attempts and source_would_lock to the audit details. Deploy note: migration
    0034 (new table login_source_failures, swept with the used tokens); run observe first. An
    attacker using many addresses gets MAX_FAILED_ATTEMPTS tries from each, so keep the per-IP
    rate limits and automatic IP blocking on.

  • The policy enforcement point also covers the app-management routes. Under POLICY_MODE
    (shadow / enforce), /api/apps/{app_id}/users… and /api/apps/{app_id}/logs are now
    decided like the admin API, recorded with source app_pep, before RequireAppAccess and
    RequireAppAdmin. The input carries app.id and the caller's role in that app
    (principal.app_role, read server-side). A new baseline rule, app-admins, mirrors the two
    gates, so shadow mode agrees with the code from the first request. The policy catalogue gains
    app_actions. /api/apps/{app_id}/service/* is unchanged. Deploy note: no migration. A
    policy stored before this release has no app-admins rule: add it before shadow or
    enforce (see docs/EXTENSIBILITY.md), or every app-route request is a divergence, and in
    enforce a 403. With POLICY_MODE=off (the default) nothing changes.

  • REFRESH_REUSE_MODE=enforce revokes only the reused token's family. Under enforce, a
    rotated refresh token presented again raised the user's token version (every session, the
    consoles included) before the client was authenticated, on every replay, and also for a token
    a logout had revoked; a concurrent replay was neither audited nor revoked. Now:

    • each refresh token carries a family id (fam, kept across rotations; refresh tokens are
      opaque to clients), and enforce revokes that family only: that sign-in's tokens at that
      client;
    • reuse is checked after client authentication and the token-version check;
    • a token revoked by /oauth/revoke or a logout is rejected without a reuse signal;
    • each token signals once;
    • the concurrent replay is audited (concurrent: true) and handled like any other reuse.

    A refresh token issued before this release has no family; under enforce, its reuse still
    revokes all the user's tokens. Audit details gain revoked (family or all_user_tokens).
    Deploy note: no migration; the records live in used_tokens. off (the default) is
    unchanged, except that a replayed token is now rejected after client authentication.

  • The audit chain detects removed or blanked newest rows. The newest rows could be deleted, or
    have their hash blanked, without breaking the chain: what remained still linked up, the next
    row linked to the newest row still carrying a hash, and the scanner skipped rows without one.
    The chain head (id and hash of the newest row, with an HMAC keyed by SECRET_KEY_BASE) is now
    kept outside the audit table, in audit_chain_head (migration 0033), and moved in the
    transaction of every append. The next row links to the head, so a gap stays visible. The
    integrity scanner reports a head that is missing, invalid or no longer matches the row it
    names, and a row without a hash after the chain started. It now reads rows in id order and
    checks the link between pages. It also logs the head it saw, outside the database. The first
    anchoring is recorded in the chain (audit_chain_anchored), so a head deleted while the
    server is stopped is reported at the next start instead of being silently recreated. Retention
    keeps the newest row, which the head names. New violation details: unstamped_row_id,
    chain_head (kind stays chain). Deploy note: migration 0033 (new table); the server
    anchors the head on the existing log at startup. A database-only attacker who saved an earlier
    head can still roll the log back to it; the scan log line is the evidence for that case.

  • ADMIN_SCOPE_MODE is read like the other modes. The value is now trimmed and
    case-insensitive, so Enforce or enforce turns the scope gate on instead of silently leaving
    it off. Anything other than enforce still means off. The startup log's effective
    configuration now includes admin_scope_mode, so the mode in force is visible. Deploy note:
    none, unless the variable was set with different case or spacing, in which case the gate turns
    on at the next restart.

  • The privileged scopes can be kept to the clients meant to hold them. New
    PRIVILEGED_SCOPE_MODE (off default, observe, enforce). admin, monitoring:read and
    monitoring:write were requestable by any client at authorize, and with client_credentials,
    unless SCOPE_POLICY_MODE=enforce and the client had a non-empty allowed_scopes. Under
    enforce, a client gets one only if it lists it in allowed_scopes or is an operator console
    (OPERATOR_CONSOLE_CLIENT_IDS, ADMIN_CONSOLE_CLIENT_ID), on every grant (authorize, code,
    refresh, client_credentials, token exchange), whatever SCOPE_POLICY_MODE says; others get
    invalid_scope. observe audits scope_denied with reason: privileged_scope. The admin API
    still checks the user's role; this stops a client from obtaining the scope by asking. Deploy
    note: no migration; run observe and check scope_denied events before enforce, and list
    the scope in the allowed_scopes of any non-console client that needs it.

  • The admin-console refresh cookie is usable only by the console. When
    ADMIN_CONSOLE_CLIENT_ID enables the refresh-cookie channel, /oauth/token read the cookie
    for any refresh request without a token in the body. SameSite=Strict lets a page on another
    origin of the same site send it, and ALLOWED_ORIGINS may grant that origin credentialed
    CORS, so a script there could refresh as the console and read the tokens. The cookie is now
    read only for the console's own client_id, with an X-Requested-By header (the CSRF defence
    the router comment described but no code checked), and from the origins of
    ADMIN_CONSOLE_REDIRECT_URIS (or without an Origin header). In production the cookie is
    __Host-refresh_token on Path=/, which a sibling subdomain cannot set or overwrite; the old
    cookie is expired when the new one is set, and logout clears both. Deploy note: no migration,
    no new variable; a browser still holding the old cookie signs in once more. The consoles use
    their backend-for-frontend and do not use this channel.

  • A locked account no longer reveals that it exists. The password check answered "account
    locked" to any password, before the hash comparison: the answer and its speed told apart an
    existing account from an unknown email. A locked account's password is now checked as any
    other, and only the right password gets ErrAccountLocked (403), so the owner still learns
    why they cannot sign in. A wrong one gets ErrInvalidCredentials (401), as an unknown email
    does; it is audited as login_failed with account_locked: true and does not move the counter.
    This applies to every password check: /api/auth/login, the hosted login, admin login,
    /elevate and change-password. Deploy note: no migration, no environment variable; a client that
    sends a wrong password to a locked account now gets 401, not 403.

  • An app's service account can be kept away from accounts it did not create. New
    SERVICE_USER_SCOPE_MODE (off default, observe, enforce). Under enforce, the service
    API (/api/apps/{app_id}/service/users) no longer enrols an existing account in the app unless
    it was created for this app or is already a member (409 account_exists; an admin adds it, or
    the person signs in), and edits the global profile only of an account created for the app
    (403 profile_not_owned). observe allows both and audits service_user_scope. The look-up
    (GET) is unchanged: token_version is how an app detects revoked user tokens. Deploy note:
    no migration; run observe and check service_user_scope events, which show the apps relying
    on either, before enforce.

  • IP blocks and alert-rule changes are audited. A manual block, an unblock, and creating,
    changing or deleting an alert rule now record a security event naming the admin:
    ip_blocked and ip_unblocked (the block's address, reason, author and dates, read before
    the row is deleted), alert_rule_created, alert_rule_updated (values before and after)
    and alert_rule_deleted. Lifting a block and changing or deleting a rule are warning. A
    webhook URL is recorded as its host only. Unblocking or deleting an unknown id now answers
    404 (it answered 204). Deploy note: no migration, no environment variable.

  • Loopback, the server's own addresses and trusted proxies can no longer be blocked.
    POST /api/admin/security/blocked-ips now refuses (400) a loopback or unspecified address,
    one of the server's network addresses or any address in TRUSTED_PROXIES, and anything that
    is not an IP address; it stores an IPv4-mapped address as IPv4, the form the block list is
    matched against. The automatic defence (failed sign-ins, brute force) skips the same addresses
    and logs it, and a block already stored for one of them is not enforced. Blocking one of them cut off the consoles, which reach the admin API through a
    local proxy, and with them the route that lifts the block; behind a proxy missing from
    TRUSTED_PROXIES, every request appears to come from it, so one burst of failed sign-ins
    locked everyone out. Deploy note: no migration, no environment variable.

  • A DPoP-bound token presented to Socrate's own APIs needs its proof. Under DPOP_MODE
    observe or enforce, a token carrying cnf.jkt sent to /oauth/userinfo, /api/*, the
    app routes, the service-account routes or the admin API must come with a fresh DPoP proof of the bound key for that request,
    carrying ath (RFC 9449 §7.1; new dpop.VerifyForResource, middleware.DPoPBinding). The
    DPoP authorization scheme is accepted next to Bearer. enforce answers 401 with a
    WWW-Authenticate: DPoP challenge; observe logs and audits dpop_validation_failed and lets
    the request through. Before, a bound token was accepted as a plain bearer token there. Unbound
    tokens, and DPOP_MODE=off, are unchanged. CORS now allows the DPoP request header and
    exposes WWW-Authenticate, so a browser client on an allowed origin can send its proof and
    read the challenge. Deploy note: no migration, no new variable; run observe first and check
    dpop_validation_failed events before enforce.

  • A revoked service-account token is refused. The service-account routes
    (/api/apps/{app_id}/service/*) now check a client_credentials token's jti against the
    revoked list that POST /oauth/revoke writes, as AuthMiddleware does for user tokens, and
    answer 401 for a revoked token (and for one without a jti, which could never be revoked).
    Before, a revoked service token stayed usable until it expired. Deploy note: no migration, no
    environment variable.

  • Saving a user can no longer clear an invite claim. UserRepository.Update now also leaves
    out invite_app_id, which only account creation and ClaimInviteApp set. A save of a pending
    account loaded before another app claimed it (an admin edit racing the claim) used to write the
    empty value back, so a third app could claim the account and its invite set the password.
    Deploy note: no migration, no environment variable.

  • The admin-API audience check covers the app-management routes. Under
    ADMIN_API_AUDIENCE_MODE observe or enforce, /api/apps/{app_id}/* (app users and app
    logs) now accepts a token issued to an operator console, to Socrate's admin portal, or to that
    same app (its backend forwards its app admins' tokens), and reports or refuses
    (403 invalid_audience) a token issued to another application. Before, a global admin's token
    held by any application's backend managed every app's users there, whatever the mode. The
    service-account routes /api/apps/{app_id}/service/* are unchanged. A mismatch is audited as
    admin_api_audience, as on the admin API. Deploy note: no migration, no new variable or
    default; with the mode in observe, check the audit for admin_api_audience events on
    /api/apps/ paths before enforce.

  • Saving a user can no longer restore an old password. UserRepository.Update now also leaves
    out hashed_password, password_changed_at and must_change_password: a path that loaded a
    user before a password change (a sign-in saving its last-login time racing a change or a
    reset) used to write the old hash back, so the old password worked again. The password is
    written only by SetPassword, which ends the existing sessions in the same statement, and by
    UpdateProfile. Accepting an invite for a pending account now sets the password and the
    verification with SetPassword (new PasswordChange.ConfirmedAt). Deploy note: no
    migration, no environment variable.

  • Saving a user no longer brings back a user deleted in the meantime. UserRepository.Update
    used GORM's Save, which retries an update that matches no row as an insert that clears
    deleted_at: a path that loaded a user before an admin deleted it (a sign-in saving its
    last-login time, an MFA change) restored the account. Update is now a plain update of the
    live row and reports a deleted or missing user as not found. Deploy note: no migration, no
    environment variable.

  • The operator-console clients are protected objects. Changing, deleting or rotating the
    secret of a client listed in OPERATOR_CONSOLE_CLIENT_IDS or ADMIN_CONSOLE_CLIENT_ID
    (PUT, DELETE, POST …/rotate-secret on /api/admin/apps/{id}) needs a superadmin
    (403 otherwise), on top of the step-up these routes already require. Every change to one,
    and every refused attempt, is audited with console_client: true at critical severity
    (new SecurityEvent.MinSeverity, which raises an event's severity and never lowers it). Other
    clients are unchanged. Deploy note: no migration; set OPERATOR_CONSOLE_CLIENT_IDS (and
    ADMIN_CONSOLE_CLIENT_ID) to the consoles' client_ids, without them no client is protected;
    under POLICY_MODE shadow, an admin's refused attempt is recorded as a divergence (the
    decision point does not know which clients are consoles).

  • Saving a user can no longer undo a session revocation or a lockout change.
    UserRepository.Update (a full-row save) now leaves out token_version,
    failed_login_attempts and locked_until, which only their targeted statements write. A path
    that loaded a user before a concurrent logout, password change, failed sign-in, lock or reset
    (for example a sign-in saving its last-login time) used to write the old values back: revoked
    sessions became valid again, a lock was lifted, or a successful sign-in's counter reset was
    undone. Password changes (ResetPassword, ChangePassword, the admin UpdatePassword) now
    store the new hash and increment the token version in one statement (new
    UserRepository.SetPassword), so the password and the revocation are saved together or not at
    all. Unlocking a user uses the targeted reset, and cmd/seed -force increments the token
    version in the database. Deploy note: no migration, no environment variable, no change of
    default.

  • User attributes that policy rules read are protected. PUT /api/admin/users/{id}/attributes
    now requires fresh step-up (it joins policy.StepUpActions); an admin cannot change their own
    attributes (400), and only a superadmin changes a superadmin's (403). The audit entry
    keeps recording names, never values, and now also says which attributes were added,
    changed and removed. Deploy note: no migration, no environment variable; under
    POLICY_MODE shadow or enforce, add the action to the stored destructive-step-up rule,
    and expect shadow mode to record an admin editing a superadmin's attributes as a divergence
    (the decision point does not see the target's role).

  • Updating a superadmin requires step-up and revokes their sessions on a credential change.
    PUT /api/admin/superadmins/{id} now requires a recent authentication (it joins
    policy.StepUpActions). Changing a superadmin's email or password there bumps their token
    version in the same transaction as the new credentials, so their existing sessions end, and sets
    password_changed_at for a password. The update writes only the edited columns, so it cannot
    undo a concurrent revocation or failed sign-in (new UserRepository.UpdateProfile). An
    admin can no longer set their own password through it (400): they use
    POST /api/admin/change-password, which asks for the current password and applies the
    lockout. The audit entry lists which fields were set (name, email, password), never their
    values. Deploy note: no migration, no environment variable; a stored A4 policy needs the action
    added to its destructive-step-up rule under POLICY_MODE shadow or enforce, as for the
    previous step-up additions.

  • Creating or changing an OAuth client and deleting a user require step-up.
    POST /api/admin/apps, PUT /api/admin/apps/{id} (redirect URIs, allow_impersonation,
    allow_token_exchange, claim mappings, allowed scopes…) and DELETE /api/admin/users/{id}
    now require a recent authentication like the other destructive admin routes
    (403 elevation_required, then POST /api/admin/elevate); they join policy.StepUpActions,
    so the A4 baseline expresses the same obligation. A new test makes every state-changing admin
    route either a step-up action or listed with a reason, so a new one cannot skip step-up
    unnoticed. Deploy note: no migration, no environment variable; the admin console already
    prompts for step-up on any elevation_required, and the installer's client registration
    runs right after its sign-in, within the window. A policy already stored (A4) keeps its own
    destructive-step-up rule: with POLICY_MODE shadow or enforce, add the three actions to
    it in the policy editor, or the decision point will report them as divergences (the router's
    own step-up check applies either way).

  • Every password check counts failures and honours the lockout; /elevate and
    /change-password are rate-limited.
    POST /api/admin/elevate (re-authentication) and
    POST /api/admin/change-password used to check the password without counting a wrong one or
    refusing a locked account; they now go through the same check as sign-in, which also replaces
    POST /api/admin/login's own copy of the lockout. A locked account gets 403 account is locked on both; a successful re-authentication or password change resets the counter. Both
    routes are rate-limited with the login limiter, keyed per admin (the consoles reach them
    through their BFF, from one address), falling back to the client IP. Deploy note: no
    migration, no environment variable, no change of default.

  • Magic-link sign-in applies the checks of the other sign-in paths.
    POST /api/auth/magic-link/verify now refuses (403) an account with MFA enabled — a link
    proves one factor, so such a user signs in with the password and code — and a deactivated
    client, and applies ADMIN_MFA_POLICY to a Socrate admin, as password sign-in does (a magic
    link always requires a membership in the app, so ADMIN_APP_SIGNIN_POLICY, which covers admins
    without one, does not apply). Before, a magic link signed in an MFA-enrolled user with one factor
    and ignored both the client's deactivation and the admin MFA policy. Tokens issued for a magic link carry no amr
    that would suggest a second factor. Deploy note: no migration, no environment variable, no
    change of default; MFA-enrolled users of an app that offers magic links sign in with their
    password instead.