Skip to content

feat: add SkipAuthHandler for local dev authentication bypass#2181

Merged
alinarublea merged 2 commits intomainfrom
feat/local-dev-skip-auth
Apr 15, 2026
Merged

feat: add SkipAuthHandler for local dev authentication bypass#2181
alinarublea merged 2 commits intomainfrom
feat/local-dev-skip-auth

Conversation

@alinarublea
Copy link
Copy Markdown
Contributor

Summary

  • Adds SkipAuthHandler as the first handler in the auth middleware chain
  • When SKIP_AUTH=true (local dev .env), injects a mock admin identity and short-circuits auth
  • When SKIP_AUTH is absent or not 'true' (all deployed environments), returns null and the chain falls through to the real handlers — zero production impact
  • Fixes 401 errors when running the API service locally via make run-api in the mysticat-workspace local dev environment

Context

The local dev environment sets SKIP_AUTH=true in .env, but previously no auth handler recognized this variable. All four real handlers (JWT, IMS, ScopedApiKey, LegacyApiKey) would fail and return 401 because the UI sends no credentials in local dev mode.

Test plan

  • Unit tests pass (7791 passing, 1 pre-existing flaky timeout)
  • make run-api in mysticat-workspace local dev → API responds 200 without auth headers
  • Deployed environments unaffected (SKIP_AUTH is never set)

🤖 Generated with Claude Code

The auth middleware chain rejected all requests in local dev because
no handler recognized SKIP_AUTH=true. Add SkipAuthHandler as the first
auth handler so it can inject a mock admin identity before the real
handlers run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Defense-in-depth: SkipAuthHandler now refuses to bypass auth when
  running inside Lambda (checks context.func.name and
  AWS_LAMBDA_FUNCTION_NAME). Even if SKIP_AUTH=true were accidentally
  set in a deployed environment, the handler would log a warning and
  fall through to real auth handlers.

- Remove the duplicate inline SKIP_AUTH block from run(). It was dead
  code — authWrapper rejects unauthenticated requests before run()
  executes, so the block was unreachable. The SkipAuthHandler is now
  the single source of truth for local dev auth bypass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

This PR will trigger a minor release when merged.

@alinarublea alinarublea requested a review from solaris007 April 13, 2026 07:06
@alinarublea alinarublea merged commit 8b7e3c6 into main Apr 15, 2026
18 checks passed
@alinarublea alinarublea deleted the feat/local-dev-skip-auth branch April 15, 2026 11:17
solaris007 pushed a commit that referenced this pull request Apr 15, 2026
# [1.440.0](v1.439.0...v1.440.0) (2026-04-15)

### Features

* add SkipAuthHandler for local dev authentication bypass ([#2181](#2181)) ([8b7e3c6](8b7e3c6))
@solaris007
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.440.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants