feat(admin): add authenticated settings API endpoints - #690
Conversation
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
Signed-off-by: ABHAY PANDEY <pandeyabhay967@gmail.com>
🦋 Changeset detectedLatest commit: 733b79f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reconcile merged UI-DASH and Settings PRs with the settings API branch: keep authenticated settings endpoints, adopt upstream dashboard, Grafana port 7777, fail-closed rate limiting, and Settings review refactors.
There was a problem hiding this comment.
Pull request overview
Adds authenticated admin API endpoints to read, validate, and update relay settings using the shared settings-config utilities (introduced in #672), including redaction of sensitive fields for safe UI consumption.
Changes:
- Add
/admin/settingsread endpoint and/admin/settings/schemaguided schema endpoint for the admin console. - Add
/admin/settings/validateand/admin/settings(PATCH) endpoints to validate and persist settings updates. - Introduce settings redaction utilities and unit tests covering redaction and the new admin settings routes.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils/settings-redaction.spec.ts | Adds unit coverage for sensitive-path detection and secret redaction behavior. |
| test/unit/routes/admin-settings.spec.ts | Adds integration-style unit tests for admin settings endpoints (auth, get/schema/validate/patch). |
| test/unit/app/maintenance-worker.spec.ts | Updates existing test to stub new metrics telemetry shutdown dependency. |
| src/utils/settings-redaction.ts | Implements redaction helpers for settings payloads and per-path values. |
| src/schemas/admin-settings-schema.ts | Adds request-body schema for admin settings PATCH validation. |
| src/routes/admin/index.ts | Registers new authenticated admin settings routes under the admin router. |
| src/factories/controllers/post-admin-settings-validate-controller-factory.ts | Wires up the settings validate controller. |
| src/factories/controllers/patch-admin-settings-controller-factory.ts | Wires up the settings patch controller. |
| src/factories/controllers/get-admin-settings-schema-controller-factory.ts | Wires up the guided settings schema controller. |
| src/factories/controllers/get-admin-settings-controller-factory.ts | Wires up the get settings controller. |
| src/controllers/admin/post-settings-validate-controller.ts | Implements merged-settings validation endpoint. |
| src/controllers/admin/patch-settings-controller.ts | Implements validated dot-path PATCH with persistence and response redaction. |
| src/controllers/admin/get-settings-schema-controller.ts | Exposes guided setting categories for the admin UI. |
| src/controllers/admin/get-settings-controller.ts | Exposes merged settings with secret redaction. |
| .changeset/admin-settings-api.md | Declares a minor release for the new admin settings API feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Implement atomic writes and timestamped backups in saveSettings - Fix array path validation for empty default schemas - Filter unknown keys from merged settings in GET /admin/settings to prevent secret leaks
Description
Adds backend-only admin settings endpoints that reuse the shared settings-config module from #672, so the admin console can read and update relay settings without duplicating CLI logic.
Why
The admin settings editor needs the same get/set/validate behavior as the CLI. This PR exposes that through authenticated admin routes ahead of the UI work in #594.
Related Issue
Fixes- Part of #665
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: