Skip to content

Wire admin authentication middleware into admin routes #856

@hman38705

Description

@hman38705

Summary

Admin routes are declared as protected but the ApiKeyAuth middleware is never actually mounted on them. Any request to an admin endpoint succeeds regardless of whether a valid x-api-key header is present.

Affected Files

  • services/api/src/main.rs
  • services/api/src/security.rs

Problem

ApiKeyAuth is initialized and the key is read from config, but the middleware layer is never attached to the admin route group. Admin routes are reachable without any authentication at runtime.

Acceptance Criteria

  • x-api-key header is required on all /admin/* endpoints.
  • Missing or invalid key returns 401 Unauthorized.
  • Integration tests cover both authorized and unauthorized requests.
  • Behavior is documented in the OpenAPI spec under the AdminApiKey security scheme.

Impact

Critical — any caller can invoke admin operations (e.g., market resolution, user management) without credentials.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend service issuesbugSomething isn't workingpriority:high

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions