fix: enforce settings authority boundaries (#618)

Close generic settings authorization bypasses and enforce per-setting authority, validation, redaction, transactional config import, and route-local write rate limiting.
This commit is contained in:
SnapOtter
2026-07-22 20:15:38 +08:00
committed by GitHub
parent 0467e87bfe
commit 44d8109486
63 changed files with 2287 additions and 731 deletions
+3 -3
View File
@@ -530,7 +530,7 @@ To auto-save a tool result to the library, include `fileId` as a multipart form
## Settings {#settings}
Runtime key-value configuration (read by any authenticated user, write by admin only).
Runtime configuration uses a closed set of recognized keys. Reading requires `settings:read` and writing requires `settings:write`; security and compliance keys additionally require `security:manage` or `compliance:manage`. Secret settings require full-administrator authority, while credentials and state owned by dedicated endpoints are read-only here. Bulk updates are validated before any value is written.
| Method | Path | Description |
|--------|------|-------------|
@@ -538,7 +538,7 @@ Runtime key-value configuration (read by any authenticated user, write by admin
| `PUT` | `/api/v1/settings` | Bulk update settings (JSON body with key-value pairs) |
| `GET` | `/api/v1/settings/:key` | Get a specific setting by key |
Known keys: `disabledTools` (JSON array of tool IDs), `enableExperimentalTools` (bool string), `loginAttemptLimit` (number).
Representative keys: `disabledTools` (JSON array of tool IDs), `enableExperimentalTools` (boolean), `loginAttemptLimit` (security policy), and `auditRetentionDays` (compliance policy). Unknown keys are rejected.
## Preferences {#preferences}
@@ -640,7 +640,7 @@ These routes are license-gated by their related enterprise feature. They still r
| Method | Path | Access | Description |
|--------|------|--------|-------------|
| `GET` | `/api/v1/enterprise/audit/export` | Admin (`audit:read`) | Export audit entries as JSON or CSV with filters |
| `GET` | `/api/v1/enterprise/config/export` | Admin (`system:health`) | Export redacted instance config, custom roles, and teams |
| `GET` | `/api/v1/enterprise/config/export` | Full built-in admin | Export redacted instance config, custom roles, and teams |
| `POST` | `/api/v1/enterprise/config/import` | Full built-in admin | Import config, with optional dry run |
| `GET` | `/api/v1/enterprise/ip-allowlist` | Admin (`security:manage`) | Read configured CIDR allowlist |
| `PUT` | `/api/v1/enterprise/ip-allowlist` | Admin (`security:manage`) | Update CIDR allowlist with self-lockout prevention |