Repository navigation
Feature/bearer token authentication - #11
Merged
Merged
Conversation
- Implement authentication middleware in Lambda handler - Add AUTH_TOKEN environment variable requirement - Create automated deployment script with token generation - Add configuration display helper script - Update SAM template with AuthToken parameter - Remove old manual token generation script - Add comprehensive authentication documentation - Update README with new automated workflow - Add deployment guide and setup documentation Security: - 256-bit cryptographic token generation - Automatic token management in samconfig.toml - Request validation middleware - Health check endpoint bypass Developer Experience: - One-command deployment with auto-token generation - Pretty formatted MCP config output - Helper script to display config anytime - No manual token handling required Cost: $0 - stays within AWS Free Tier
Implement production-grade authentication for Strava MCP Lambda function with fully automated deployment workflow. Security Features: - Bearer token authentication middleware in Lambda handler - 256-bit cryptographically secure token generation - Automatic token validation on all requests - Health check endpoint bypass for monitoring - Secure token storage in environment variables Automation Features: - One-command deployment with auto-token generation - Automatic saving of tokens to samconfig.toml - Pretty formatted MCP configuration output - Helper script to display config anytime - No manual token handling required Files Modified: - src/lambda.ts: Added authentication middleware - src/config/env.ts: Added AUTH_TOKEN requirement - template.yaml: Added AuthToken parameter - package.json: Updated deployment scripts - .env.example: Added AUTH_TOKEN documentation - .gitignore: Added samconfig.toml - README.md: Updated deployment - README.md: Updated deployment - README.md: Updated deployment - README.md: - scripts/show-config.ts: Configuration display helper - docs/authenticatio- docs/authenticatio- docs/authentica Remov- docs/authenticap-config.js: Replaced by automated deployment Developer Experience: - Before: Manual token generation, manual config formatting - After: bun run deploy - eve- After: bun run deploy - eve- Afte/month - stays within AWS Free Tier Breaking Change: Existing deployments require re-configuration with Authorization header in Claude settings
Code reviewCritical Bug Found: Missing AUTH_TOKEN in config schema (src/lambda.ts:105)The code accesses Current schema in const envSchema = z.object({
STRAVA_CLIENT_ID: z.string().min(1, 'STRAVA_CLIENT_ID is required'),
STRAVA_CLIENT_SECRET: z.string().min(1, 'STRAVA_CLIENT_SECRET is required'),
STRAVA_REFRESH_TOKEN: z.string().min(1, 'STRAVA_REFRESH_TOKEN is required'),
PORT: z.string().default('3000').transform(Number),
});Impact:
Fix: const envSchema = z.object({
STRAVA_CLIENT_ID: z.string().min(1, 'STRAVA_CLIENT_ID is required'),
STRAVA_CLIENT_SECRET: z.string().min(1, 'STRAVA_CLIENT_SECRET is required'),
STRAVA_REFRESH_TOKEN: z.string().min(1, 'STRAVA_REFRESH_TOKEN is required'),
AUTH_TOKEN: z.string().min(32, 'AUTH_TOKEN must be at least 32 characters'),
PORT: z.string().default('3000').transform(Number),
});Reference: Note: While |
Critical Bug Fix: - Add AUTH_TOKEN to envSchema in src/config/env.ts - Add AUTH_TOKEN to safeParse call - Without this, config.AUTH_TOKEN is undefined at runtime - Authentication middleware would fail all token checks Documentation Cleanup: - Remove DEPLOYMENT.md from root - Remove AUTHENTICATION_SETUP.md from root - Keep only README.md and AGENTS.md in root per project guidelines - All other docs should reference docs/ directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.