fix(api): reject a placeholder or too-short encryption key in production#356
fix(api): reject a placeholder or too-short encryption key in production#356cavidelizade wants to merge 1 commit into
Conversation
The production guard only checked that INSTANCE_ENCRYPTION_KEY was set, and .env.example ships it as "change-me-generate-a-random-key". Copying the example to a real host and setting ENV=production passed the guard while encrypting all instance secrets (SMTP password, OAuth client secrets, GitHub App private key) under a publicly known key. Reject a set-but-weak key too: the shipped placeholder and anything shorter than 16 characters now fail startup outside development. Closes Devlaner#330 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The production guard only checked that
INSTANCE_ENCRYPTION_KEYwas set, and.env.exampleships it aschange-me-generate-a-random-key. Copying the example to a real host and settingENV=productionpassed the guard while encrypting all instance secrets (SMTP password, OAuth client secrets, GitHub App private key) under a publicly known key.Linked issues
Closes #330
Type of change
fix:)Surface
apps/api/)What changed
Added
isWeakSecret, and the production startup guard now rejects a set-but-weakINSTANCE_ENCRYPTION_KEY: the shipped placeholder values and anything shorter than 16 characters fail startup outside development, alongside the existing empty check.Test plan
go build,go vet,go test ./...green, including the newTestIsWeakSecretNotes
The issue also mentions
ENVdefaulting todevelopmentand the key being read viaos.Getenvinstead of theConfigstruct. I kept this PR to the concrete "placeholder passes the guard" hole. Happy to follow up on the default and the config threading if you want them in scope.AI assistance
Claude Code (Opus 4.8), commits carry aCo-Authored-By:trailer