The provided content is a **release notes document** for **Logto**, a developer-focused identity platform. It details changes, improvements, bug fixes, and security updates in a specific version (likely **v1.46.0**, based on the changelog link). Below is a **structured summary** of the key points, organized by category for clarity and ease of understanding.

---

## 📢 **Overview**
This release focuses on:
- **Security hardening** (especially around SAML, OAuth, and third-party apps)
- **Improved error handling and logging**
- **Better user experience** (sign-in, social login, branding)
- **Stability and performance improvements**
- **Enhanced developer tooling and documentation**

---

## 🔐 **Security Hardening**

### 1. **SAML Assertion Audience**
- **Change**: A SAML assertion is now accepted **only if its `Audience` matches the connector’s `Audience URI (SP Entity ID)`**.
- **Impact**: After upgrading, if SAML sign-in fails with `"SAML assertion audience does not match the SP entity ID"`, you must:
  - Set the **Audience** at your **Identity Provider (IdP)** to match the **SP Entity ID** in Logto’s connector settings.
- **Why?** Prevents spoofing and ensures assertions are intended for the correct service.

### 2. **Account API & Third-Party Apps**
- **New Requirement**: All Account API operations now require a **first-party application**.
- **Affected Endpoints**:
  - `GET /api/my-account/identities/:target/access-token`
  - `GET /api/my-account/sso-identities/:connectorId/access-token`
  - `PUT /api/my-account/identities/:target/access-token`
  - Reading backup codes, sessions, grants, trusted devices
- **Result for Third-Party Apps**: They now receive:
  ```json
  403 auth.third_party_application_forbidden
  ```
- **First-Party Apps (e.g., Account Center, Console)**: Unaffected.
- **Action Required**: If your integration uses stored provider tokens, switch to a **first-party app**.

### 3. **Connector Request Errors**
- **Privacy Improvement**: When a connector request fails (e.g., timeout), **request bodies, headers, and query strings are no longer logged or exposed**.
- **Only the error name, code, and message are retained**.
- **Exception**: The server log still includes:
  - Request method
  - Origin and pathname of the URL
- **Purpose**: Reduces exposure of sensitive data in logs and telemetry.

### 4. **Single-Use Codes and Tokens**
- **Change**: Authorization codes, device codes, pushed auth requests, and one-time tokens are now **accepted only once**.
- **Reused Token Behavior**:
  - `invalid_grant` → for authorization codes
  - `invalid_request_uri` → for pushed authorization requests
  - `one_time_token.token_consumed` → for one-time tokens
- **Note**: Refresh tokens still allow reuse within their window.

### 5. **SAML Applications**
- **Validation**: `GET` and `POST /api/saml/:id/authn` now reject malformed XML (e.g., unescaped `&`, mismatched tags) with:
  ```json
  400 application.saml.invalid_saml_request
  ```
- **Audit Log**: Includes the format error under `samlRequestError`.
- **Error Handling**: Requests that can’t be decoded or parsed now return **400** instead of **500** (if signed auth is not required).

---

## 🛠️ **Improvements & New Features**

### 1. **Connector Branding Before Email Match**
- **New Setting**: `Show SSO connector names and logos before email match`
- **Location**: `Console > Sign-in experience > Sign-up and sign-in > Advanced options`
- **Default**: On (keeps current behavior)
- **Use Case**: Turn off to show SSO connectors **only after** email domain matches.

### 2. **Request Validation**
- **Limit**: `guard.invalid_input` now lists **only the first 100 validation issues**.
- **Performance**: `POST /callback/:connectorId` and `POST /account/callback/social/:connectorId` stop validating after **100 invalid fields**.
- **Note**: The error response remains unchanged.

### 3. **Logto Tunnel (v0.3.12)**
- **Security**:
  - Symlinks are resolved before serving static files.
  - Files outside the `--experience-path` return **404**.
  - Symlinks pointing inside the path and the path itself as a symlink still work.
- **Range Header**:
  - If `Range` end exceeds file size → **clamped to file size**.
  - If `Range` cannot be satisfied → **416 Range Not Satisfiable**.

### 4. **OAuth & OIDC**
- **Space-Padded Scopes**: Leading/trailing/repeated spaces in `scope` are now ignored.
  - Example: `" offline_access"` → treated as `offline_access`.
  - A scope with only spaces is treated as **omitted**.
- **Benefit**: Fixes refresh token issues (e.g., OpenAI Codex).

### 5. **Management API**
- **`customClientMetadata`**: Unknown keys now return `400 guard.invalid_input` with the key listed.
  - Prevents typos from being silently ignored.
- **Pagination Links**: Repeated query parameters (e.g., `?types=SPA&types=Traditional`) are preserved instead of being joined into a comma-separated string.
- **One-Time Token Count**: `Total-Number` header now counts **only matching tokens** when filtered by `email` or `status`.
- **Manual Unlock**: Clears active security verification lockouts **longer than 60 minutes**.

### 6. **SAML Applications**
- **Attribute Placeholders**: Mapped attributes like `o365role` now return the **actual user value** instead of the literal `{attr...}` placeholder.

### 7. **Console & Account Center**
- **Application Access Control**: Organization selector now filters results during search.
- **Role Permissions**: Full API resource names shown; truncated names have tooltips.
- **Account Center Branding**: "Powered by Logto" is no longer shown during loading when branding is hidden.

### 8. **Documentation**
- **Swift Integration Guide**: Fixed code examples to use consistent client name, resolving `Cannot find 'client' in scope` in Xcode.

---

## 🔄 **Connectors**

### 1. **Standard OAuth 2.0 & OIDC**
- **String `expires_in`**: Now accepted (e.g., from Criipto).
- **JSON Array `scope`**: Now accepted (e.g., from Twitch), normalized to space-delimited string.

### 2. **Patreon**
- **Fix**: Patreon v1 API removed → now uses **v2 identity endpoint**.
- **Result**: Patreon sign-in works again.

### 3. **Connector Kit**
- **Performance**: `jsonGuard` and `jsonObjectGuard` now build recursive schema **once**, not per nested value.
- **Benefit**: Faster validation of large JSON payloads.

---

## 🖥️ **Self-Hosting & OSS Notes**

### 1. **Review Before Upgrading**
- Check:
  - OAuth 2.0 and Azure AD email sync
  - SAML assertion audience
  - Third-party Account API changes

### 2. **Node.js 26**
- **Docker Image**: Now runs on **Node.js 26**.
- **Supported Versions**: 22, 24, 26
- **Minimum Versions**:
  - 22.23.4
  - 24.22.1
  - 26.12.1
- **Note**: Includes **October 2026 security fixes**.

### 3. **Database Migration Required**
- **Schema Changes**:
  - New columns for SAML static attributes
  - New sign-in experience and Account Center settings
- **Action**: Run:
  ```bash
  npm run alteration deploy
  ```
  or
  ```bash
  logto db alteration deploy
  ```
- **Before starting the new version**.

### 4. **Database Connection Retries**
- **Improved Resilience**:
  - Core now retries DB connection on `ENOTFOUND`/`EAI_AGAIN` (DNS failure).
  - CLI commands (`db seed`, `db alteration deploy`) now retry transient errors (including DNS).

### 5. **Admin Endpoint Warning**
- **New Log**: Warns once if a `/console` request reaches the default tenant due to **mismatched admin endpoint**.
- **Action**: Check Console URL and `ADMIN_ENDPOINT`.

---

## 👏 **Contributors**
Huge thanks to the community for their contributions:

| Contributor | Contributions |
|-----------|---------------|
| [@nicolaj0](https://github.com/nicolaj0) | Webhook `deliveryId`, `hasPassword`, organization filter, `customClientMetadata` validation, unreachable social errors, declined authorization errors, DNS retries, connector request errors |
| [@RaphaelFakhri](https://github.com/RaphaelFakhri) | Repeated query parameters in pagination links (first contribution) |
| [@mvanhorn](https://github.com/mvanhorn) | `ADMIN_ENDPOINT` mismatch warning |
| [@timokoethe](https://github.com/timokoethe) | Consistent client name in Swift guide |

---

## 🔗 **Full Changelog**
- [Compare v1.45.0 → v1.46.0](https://github.com/logto-io/logto/compare/v1.45.0...v1.46.0)

---

## ✅ **Summary of Actions for Users**
| Scenario | Action |
|--------|--------|
| **SAML Sign-In Failing** | Update IdP audience to match SP Entity ID |
| **Third-Party App Accessing Account API** | Use a **first-party app** |
| **Upgrading Self-Hosted Instance** | Run `logto db alteration deploy` before starting |
| **Using Logto Tunnel** | Ensure `--experience-path` is secure and symlinks are resolved |
| **Debugging Connection Issues** | Check `ADMIN_ENDPOINT` and DNS resolution |

---

This release strengthens **security**, improves **developer experience**, and enhances **stability** — making it a significant update for both self-hosted and cloud users.