Replace shared admin cookie with DB sessions#27
Merged
Conversation
Replace the shared cookie secret with per-login session rows and audit trails so EC2 operators can inspect auth activity without exposing raw tokens. Constraint: Next middleware remains Edge-safe, so it only checks cookie presence while Node.js pages and API routes verify sessions with Prisma. Rejected: JWT or external auth provider | outside current MVP scope and not requested. Confidence: high Scope-risk: moderate Directive: Do not reintroduce ADMIN_SESSION_TOKEN or env-password fallback; AdminUser.passwordHash remains the password authority. Tested: npx prisma validate && npx prisma generate && npm test && npm run lint && npm run build Not-tested: prisma migrate status against local PostgreSQL; local DB denied access and no shadow database URL is configured. Co-authored-by: OmX <omx@oh-my-codex.dev>
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.
CLEVER PR review completion
EVNSolution/tomotono-route-consoletomotono-route-consolemainfix/db-backed-admin-sessions변경 내용
ADMIN_SESSION_TOKENcookie auth를 제거하고 로그인마다 랜덤 세션 토큰을 발급하도록 변경AdminSession,AdminLoginLogPrisma 모델 및 migration 추가tokenHash만 저장revokedAt저장 및 cookie clearADMIN_PASSWORD,ADMIN_SESSION_TOKEN제거PR Scope Grouping Gate
single-prnpx prisma validate && npx prisma generate && npm test && npm run lint && npm run build검증
npx prisma validate통과npx prisma generate통과npm test통과: 3 files / 18 testsnpm run lint통과npm run build통과npx prisma migrate status는 로컬 PostgreSQL 접근 거부로 미검증; EC2 deploy migration에서 확인 필요Concurrent Work Gate
donePR 검토 에이전트 종료 조건
Context/wiki completion
docs/admin-auth-operations.mddocs/ec2-deployment.mdREADME.mdnot-neededLinked issue close evidence
PR 기준
devPR과mainPR은 검토 에이전트 종료 조건을 채운다.mainPR은 deploy merge 단위로 보고 wiki/service context 업데이트 여부를 다시 확인한다.devPR은 integration merge 단위로 보고 issue close 전에 wiki/service context 업데이트 여부를 확인한다.