The provided content is a **release notes** entry for **Logto**, detailing changes, improvements, and bug fixes in a specific version (likely **v1.46.0**). It includes updates across multiple areas such as **security**, **SAML**, **OAuth**, **APIs**, **connectors**, **self-hosting**, and **documentation**.

Below is a **structured summary** of the key points, organized by category, to help you quickly understand the most important changes:

---

### 🔐 **Security Hardening**
1. **SAML Assertion Audience**  
   - SAML assertions are now validated against the **SP Entity ID (Audience URI)**.
   - If a SAML sign-in fails with `"SAML assertion audience does not match the SP entity ID"`, update your **Identity Provider (IdP)** to use the correct **Audience URI** from the connector settings.

2. **Account API & Third-Party Apps**  
   - All Account API operations now require a **first-party application**.
   - Third-party apps receive `403 auth.third_party_application_forbidden` when trying to access restricted endpoints.
   - Affected endpoints:
     - Retrieving/refreshing SSO provider tokens (`GET`, `PUT` `/api/my-account/identities/...`)
     - Reading backup codes, sessions, grants, trusted devices
   - **Solution**: Use a first-party app (e.g., Account Center or Console) to access these features.

3. **Connector Request Errors**  
   - Sensitive data (request bodies, headers, query strings) are **no longer logged or exposed** in error responses.
   - Only error name, code, message, and URL method/path are retained.
   - Improves security and reduces log clutter.

4. **Single-Use Codes & Tokens**  
   - Authorization codes, device codes, pushed auth requests, and one-time tokens are now **single-use only**.
   - Reuse results in:
     - `invalid_grant` (authorization code)
     - `invalid_request_uri` (pushed auth request)
     - `one_time_token.token_consumed` (one-time token)
   - **Note**: Refresh tokens still support reuse within their window.

---

### 🧩 **SAML Applications**
- **SAML Request Validation**  
  - Rejects malformed XML (e.g., unescaped `&`, mismatched tags) with `400 application.saml.invalid_saml_request`.
  - Audit logs now include `samlRequestError` for failed requests.
  - Prevents 500 errors for malformed requests when signed auth is not required.

- **Attribute Mapping Fix**  
  - Fixed issue where mapped attributes like `o365role` were sent as literal `{attr...}` instead of actual values.

---

### 🌐 **Logto Tunnel (`@logto/tunnel` v0.3.12)**
- **Static File Serving**  
  - Symlinks are resolved; files outside the `--experience-path` return 404.
  - Symlinks pointing inside the path and symlinked experience paths still work.
- **Range Requests**  
  - `Range` headers with end past file size are clamped to file size.
  - Unsatisfiable ranges return `416 Range Not Satisfiable`.

---

### 📦 **Request Validation**
- `guard.invalid_input` now lists **only the first 100 validation issues**.
- `POST /callback/:connectorId` and `POST /account/callback/social/:connectorId` stop validating after **100 invalid fields** (error response unchanged).

---

### 🖥️ **Sign-in Experience**
- **Safari & iOS Compatibility**  
  - Fixed blank sign-in page on **iOS < 16.4** and **Safari < 16.4**.
  - Now compiled for **iOS 15+ and Safari 15+**.

---

### 🌐 **Social Sign-in**
- **Unreachable Provider**  
  - Returns `502 connector.social_provider_unreachable` instead of generic 500.
  - Includes network error code and connector ID.
  - End users see translated messages.

- **Declined Authorization**  
  - Returns `401 connector.authorization_failed` with provider-specific `error` and `error_description`.
  - Covers cases like `access_denied`, `user_cancelled_authorize`, `user_cancelled_login`.

- **Provider Error Messages**  
  - Now shows actual provider error messages instead of `{}`.

---

### 🔐 **OAuth & OIDC**
- **Space-Padded Scopes**  
  - Fixes issue where clients like OpenAI Codex failed due to leading spaces in `scope` (e.g., `" offline_access"`).
  - Leading/trailing/repeated spaces are now ignored.
  - A scope with only spaces is treated as **omitted**.

---

### 🛠️ **Management API**
- **`customClientMetadata` Validation**  
  - Rejects unknown keys with `400 guard.invalid_input`, listing the invalid key.
  - Prevents silent failures due to typos (e.g., `refreshTokenTtlInDay`).

- **Pagination Links**  
  - Now preserve **all values** of repeated query parameters (e.g., `?types=SPA&types=Traditional`) instead of joining them.

- **One-Time Token Count**  
  - `Total-Number` header now counts **only matching tokens** when filtering by `email` or `status`.

- **Manual Unlock**  
  - Clears **security verification lockouts longer than 60 minutes**.
  - Documentation now mentions **user IDs** and **security verification lockouts**.

---

### 🧩 **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**  
  - No longer shows "Powered by Logto" during loading when branding is hidden.

---

### 📚 **Documentation**
- **Swift Integration Guide**  
  - Fixed `Cannot find 'client' in scope` error by using consistent client name in code examples.
  - Thanks to [@timokoethe](https://github.com/timokoethe).

---

### 🧩 **Connectors**
- **Standard OAuth 2.0 & OIDC**  
  - Supports `expires_in` as string (e.g., Criipto).
  - Supports `scope` as JSON array (e.g., Twitch), normalized to space-delimited string.

- **Patreon**  
  - Migrated from deprecated v1 API to **v2 identity endpoint**.
  - Fixes sign-in failure due to `410 Gone`.

- **Connector Kit**  
  - `jsonGuard` and `jsonObjectGuard` now build schema **once**, improving performance for large JSON payloads.

---

### 🏗️ **Self-Hosting & OSS Notes**
- **Review Before Upgrading**  
  - Pay attention to:
    - OAuth 2.0 & Azure AD email sync
    - SAML assertion audience
    - Third-party Account API changes

- **Node.js 26 Support**  
  - Official Docker image now runs on **Node.js 26**.
  - Minimum versions:
    - Node.js 22: 22.23.4
    - Node.js 24: 24.22.1
    - Node.js 26: 26.12.1

- **Database Migration Required**  
  - Schema changes include:
    - New columns for SAML static attributes
    - New sign-in experience and Account Center settings
  - Run:  
    ```bash
    npm run alteration deploy
    # or
    logto db alteration deploy
    ```

- **Database Connection Retries**  
  - Retries on DNS failures (`ENOTFOUND`, `EAI_AGAIN`) at startup and CLI commands (`db seed`, `db alteration deploy`).

- **Admin Endpoint Warning**  
  - Logs warning if `/console` request reaches default tenant with mismatched origin.
  - Check **Console URL** and `ADMIN_ENDPOINT`.

---

### 🙌 **Contributors**
Special thanks to:
- **@nicolaj0** – Multiple contributions (webhooks, metadata validation, error handling, DNS retries, etc.)
- **@RaphaelFakhri** – First contribution: pagination links
- **@mvanhorn** – `ADMIN_ENDPOINT` mismatch warning
- **@timokoethe** – Swift guide consistency

---

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

---

### ✅ **Action Items for Users**
1. **Upgrade Database**: Run `npm run alteration deploy` after upgrading.
2. **Update Identity Provider**: Set SAML **Audience URI** to match SP Entity ID.
3. **Switch to First-Party Apps**: For Account API access.
4. **Check Node.js Version**: Ensure you're on **Node.js 22+**.
5. **Review Security Settings**: Especially SAML and third-party app access.

---

Let me know if you'd like a **cheat sheet**, **upgrade checklist**, or **summary for developers**!