feat: 서버사이드 세션 인증 전환 (JWT 제거)#180
Merged
Merged
Conversation
added 5 commits
February 23, 2026 00:03
JWT 웹 세션을 서버사이드 세션(angple_sid)으로 전환하고 보안 강화: - 서버사이드 세션: angple_sessions 테이블 + httpOnly 쿠키(angple_sid) - Refresh Token 로테이션: SHA-256 해시 DB 저장, 패밀리 기반 재사용 탐지 - CSRF Double-submit Cookie: angple_csrf 쿠키 + X-CSRF-Token 헤더 검증 - Rate Limiting: 로그인/OAuth/로그아웃 IP 기반 요청 제한 - SvelteKit 로그인 프록시: /api/auth/login에서 세션 생성 - 무중단 마이그레이션: angple_sid → refresh_token → damoang_jwt 순서 fallback
- /api/auth/logout를 CSRF 면제 경로에 추가 (로그아웃 POST 차단 방지) - 로그인 URL을 /login으로 변경 (레거시 PHP → SvelteKit) - 로그아웃 시 모든 도메인 쿠키 강제 삭제 (도메인 불일치 대비)
- hooks.server.ts: JWT fallback(2~4순위) 제거, 세션 인증만 유지 - hooks.server.ts: 세션 없을 때 잔여 JWT 쿠키 자동 정리 - auth.svelte.ts: tryRefreshToken() 호출 제거 - client.ts: 레거시 SSO 쿠키 읽기, 토큰 자동 갱신, 401 재시도 제거 - 웹 브라우저에 JWT 노출 완전 차단 (Go 백엔드용 내부 JWT만 SSR에서 생성)
SSR에서 세션 없음 = 비로그인 확정 클라이언트 initAuth()에서 Go 백엔드 직접 호출 제거 (남은 JWT 쿠키로 다시 로그인되는 근본 원인)
Contributor
Staging 배포 완료URL: https://dev.damoang.net
|
sdk-kr
added a commit
that referenced
this pull request
Mar 7, 2026
## Summary - JWT 기반 웹 인증을 서버사이드 세션(angple_sid)으로 전환 - hooks.server.ts에서 JWT fallback 완전 제거, 세션 only 인증 - CSRF double-submit cookie 보호 추가 - Refresh token 로테이션 + DB 폐기 테이블 - Rate limiting (로그인/OAuth/로그아웃) - 로그아웃 후 재로그인 버그 수정 ## 변경 파일 - `hooks.server.ts` — 세션 인증 미들웨어 - `session-store.ts` — 세션 스토어 (신규) - `token-store.ts` — 토큰 로테이션/폐기 (신규) - `api/auth/login/+server.ts` — 로그인 프록시 (신규) - `client.ts` — JWT 관련 코드 제거 - `auth.svelte.ts` — SSR 기반 인증 단순화 - `user-widget.svelte` — 로그인 URL + 로그아웃 수정 ## Test plan - [x] dev.damoang.net 로그아웃 테스트 완료 - [x] 빌드 성공 확인 - [ ] web.damoang.net 배포 후 로그인/로그아웃 동작 확인 --------- Co-authored-by: Deploy Bot <deploy@damoang.net>
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
변경 파일
hooks.server.ts— 세션 인증 미들웨어session-store.ts— 세션 스토어 (신규)token-store.ts— 토큰 로테이션/폐기 (신규)api/auth/login/+server.ts— 로그인 프록시 (신규)client.ts— JWT 관련 코드 제거auth.svelte.ts— SSR 기반 인증 단순화user-widget.svelte— 로그인 URL + 로그아웃 수정Test plan