Skip to content

fix: extract API_KEY_PREFIX constant and validate prefix in OtlpAuthGuard#748

Merged
brunobuddy merged 1 commit intomainfrom
key_mnfst
Feb 20, 2026
Merged

fix: extract API_KEY_PREFIX constant and validate prefix in OtlpAuthGuard#748
brunobuddy merged 1 commit intomainfrom
key_mnfst

Conversation

@brunobuddy
Copy link
Copy Markdown
Member

Summary

  • Extracts API_KEY_PREFIX = 'mnfst_' as a shared constant in both the backend (api-key.constants.ts) and plugin (constants.ts), replacing hardcoded string literals
  • Adds fast-fail prefix validation in OtlpAuthGuard — tokens without the mnfst_ prefix are rejected immediately without a DB round-trip
  • Fixes TEST_OTLP_KEY in e2e test helpers to use the correct mnfst_ prefix
  • Adds regression tests in both packages to catch accidental prefix reverts (e.g. back to osk_)
  • Adds npm run check:api-prefix script that verifies both packages declare the same prefix value (for CI)

Test plan

  • Plugin tests pass (112 tests, 7 suites)
  • Backend unit tests pass (378 tests, 38 suites)
  • Frontend tests pass (82 tests, 7 suites)
  • TypeScript compiles cleanly in both backend and plugin
  • npm run check:api-prefix outputs OK: API_KEY_PREFIX="mnfst_"

…pAuthGuard

Prevent regressions from the osk_ → mnfst_ prefix migration by:

- Extracting API_KEY_PREFIX as a shared constant in both backend and plugin
- Adding fast-fail prefix validation in OtlpAuthGuard (avoids DB round-trip
  for malformed tokens)
- Fixing TEST_OTLP_KEY to use the mnfst_ prefix convention
- Adding regression tests for prefix consistency in both packages
- Adding cross-package check:api-prefix script for CI
@brunobuddy brunobuddy merged commit 877be0f into main Feb 20, 2026
5 checks passed
@brunobuddy brunobuddy deleted the key_mnfst branch February 23, 2026 01:03
Sign up for free to 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.

1 participant