Skip to content

feat(admin): add authenticated settings API endpoints - #690

Merged
cameri merged 10 commits into
cameri:mainfrom
Ferryx349:settings-api
Jul 27, 2026
Merged

feat(admin): add authenticated settings API endpoints#690
cameri merged 10 commits into
cameri:mainfrom
Ferryx349:settings-api

Conversation

@Ferryx349

Copy link
Copy Markdown
Collaborator

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

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot

changeset-botBot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 733b79f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
nostreamMinor

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

Comment threadsrc/routes/admin/index.ts
Comment threadsrc/routes/admin/index.ts
Comment threadsrc/routes/admin/index.ts
Comment threadsrc/routes/admin/index.ts
@coveralls

coveralls commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 69.623% (+0.9%) from 68.718% — Ferryx349:settings-api into cameri:main

Ferryx349and others added 3 commits July 20, 2026 10:07
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.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/settings read endpoint and /admin/settings/schema guided schema endpoint for the admin console.
  • Add /admin/settings/validate and /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
FileDescription
test/unit/utils/settings-redaction.spec.tsAdds unit coverage for sensitive-path detection and secret redaction behavior.
test/unit/routes/admin-settings.spec.tsAdds integration-style unit tests for admin settings endpoints (auth, get/schema/validate/patch).
test/unit/app/maintenance-worker.spec.tsUpdates existing test to stub new metrics telemetry shutdown dependency.
src/utils/settings-redaction.tsImplements redaction helpers for settings payloads and per-path values.
src/schemas/admin-settings-schema.tsAdds request-body schema for admin settings PATCH validation.
src/routes/admin/index.tsRegisters new authenticated admin settings routes under the admin router.
src/factories/controllers/post-admin-settings-validate-controller-factory.tsWires up the settings validate controller.
src/factories/controllers/patch-admin-settings-controller-factory.tsWires up the settings patch controller.
src/factories/controllers/get-admin-settings-schema-controller-factory.tsWires up the guided settings schema controller.
src/factories/controllers/get-admin-settings-controller-factory.tsWires up the get settings controller.
src/controllers/admin/post-settings-validate-controller.tsImplements merged-settings validation endpoint.
src/controllers/admin/patch-settings-controller.tsImplements validated dot-path PATCH with persistence and response redaction.
src/controllers/admin/get-settings-schema-controller.tsExposes guided setting categories for the admin UI.
src/controllers/admin/get-settings-controller.tsExposes merged settings with secret redaction.
.changeset/admin-settings-api.mdDeclares a minor release for the new admin settings API feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/controllers/admin/patch-settings-controller.ts
Comment threadsrc/controllers/admin/patch-settings-controller.ts
Comment threadsrc/controllers/admin/get-settings-controller.ts
- 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
@cameri
cameri merged commit f70adf2 into cameri:mainJul 27, 2026
17 of 18 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Ferryx349@coveralls@cameri@github-advanced-security