Harden config/security + wire Alembic#3
Merged
Conversation
Audit found no architectural rework needed; these close the real findings: - Refuse prod boot (APP_ENV=prod) when JWT_SECRET/ADMIN_PASSWORD are defaults; warn in dev. Log a change-password reminder after seeding the first admin. - Make CORS origins configurable (CORS_ORIGINS); default unchanged. - Move the audit-log DB write off the event loop via run_in_threadpool. - Add validation floors: user password min_length, non-empty names, session rate>0. - Wire Alembic for schema changes (baseline builds from metadata, Postgres+SQLite portable); create_all stays the zero-config boot path. Smoke test extended for the new validation; passwords bumped to satisfy it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Follow-up to a full-stack audit. The audit found no architectural rework needed — this PR closes the real findings (config/security hygiene) and adds migration tooling. No async/TypeScript rewrite.
APP_ENV=prod, the app refuses to boot whileJWT_SECRET/ADMIN_PASSWORDare still the dev defaults; dev just warns (zero-.envlocal dev unchanged). Logs a change-password reminder after seeding the first admin.CORS_ORIGINSenv var; default*unchanged.run_in_threadpool.min_length, non-empty names, sessionrate > 0.create_allstays the zero-config boot path.Verification
alembic upgrade headbuilds the full schema on a fresh DB..env.exampleupdated.🤖 Generated with Claude Code