Skip to content

fix: 비로그인 상태에서 마이페이지·알림 페이지 라우트 가드 설정 - #67

Merged
kim3360 merged 2 commits into
devfrom
feat/ALT-312
Oct 15, 2026
Merged

kim3360 merged 2 commits into
devfrom
feat/ALT-312

Conversation

@kim3360

@kim3360 kim3360 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

ID

  • ALT-312

변경 내용

  • 비로그인 사용자의 마이페이지·알림·채팅 접근 제한
  • 알바찾기 지도 및 스크랩한 알바를 USER 전용으로 제한
  • 로그인 후 이전 접근 경로 대신 역할별 홈으로 이동하도록 변경

구현 사항

  • 공용 AuthRouteGuard를 적용하여 비로그인 접근 시 로그인 화면으로 이동
  • 프로필 수정·탈퇴·스크랩 등 마이페이지 하위 경로에도 가드 적용
  • 알림 목록·알림 설정·채팅 및 기존 소셜 경로에 인증 가드 적용
  • 지도·공고 상세·지원·스크랩 화면에 HomeRouteGuard의 USER 권한 검사 적용

구현 시연 (필요 시)

  • 작업물을 가시적으로 표현한다 (스크린샷, 영상 등)

참고 사항 (필요 시)

  • 추가적으로 검토가 필요한 사항이나 관련 문서, 참조 문서 등을 첨부
    (예: 확인 사항, 참조 링크 등)

Summary by CodeRabbit

  • 기능 개선
    • 프로필, 알림, 계정 관리, 스크랩, 채팅, 구직 지도 페이지에 로그인 확인 절차가 적용됩니다. 로그인하지 않은 경우 로그인 화면으로 이동하며, 로그인 후 원래 요청한 페이지로 돌아올 수 있습니다.
    • 인증 상태를 확인하는 동안 로딩 화면이 표시됩니다.
    • 홈 화면은 사용자 역할에 맞는 경로로 연결됩니다. 기존 사장님 전용 채팅 경로는 공용 채팅 목록으로 이동합니다.

@kim3360
kim3360 requested review from limtjdghks and oohveon October 5, 2026 15:53
@kim3360 kim3360 self-assigned this Oct 5, 2026
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
alter-client Ready Ready Preview Oct 6, 2026 11:23am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: alter-app/alter-client/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebc9d304-c21b-4d2c-b915-14ad654fc0d4
📥 Commits

Reviewing files that changed from the base of the PR and between 67289da and 7532dc1.

📒 Files selected for processing (1)
  • src/shared/ui/common/HomeRouteGuard.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

공통 인증 가드를 추가하고 HomeRouteGuard의 인증 처리를 해당 가드에 위임했습니다. 프로필, 계정 관리, 채팅 및 구직 관련 경로에 인증 또는 사용자 역할 검사를 적용했습니다.

Changes

라우트 보호

Layer / File(s) Summary
인증 가드 동작
src/shared/ui/common/AuthRouteGuard.tsx
인증 상태가 준비되지 않으면 로딩 화면을 표시합니다. 2.5초 후에도 준비되지 않으면 수화 상태를 완료 처리합니다. 준비된 뒤 로그인되지 않았거나 토큰이 없으면 현재 경로를 from 상태로 전달해 로그인 경로로 이동합니다. 그 외에는 자식 요소를 렌더링합니다.
역할별 가드에 인증 연결
src/shared/ui/common/HomeRouteGuard.tsx
인증 및 scope 검사를 분리했습니다. 인증 처리는 AuthRouteGuard에 위임하고, 인증 후에는 ScopeRouteGuard가 기대 scope와 실제 scope를 비교해 경로를 처리합니다.
경로별 가드 적용
src/app/App.tsx
프로필 편집, 알림, 계정 편집, 탈퇴, 채팅, 내 페이지 경로에 인증 가드를 적용했습니다. 사장님 전용 채팅 경로는 인증된 상태에서 공용 채팅 목록으로 이동합니다. 스크랩, 구직 지도, 지도 상세, 지원 경로에는 HomeRouteGuard expected="USER"를 적용했습니다.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7532d

The guarded routes retain a fallback when authentication loading does not complete. No merge-blocking issue is identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 67289

The changes narrow access to protected screens, and no newly introduced authentication bypass was identified. These controls operate in the browser; independent server-side permissions for sensitive data and actions remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The demonstrated change affects browser entrypoints for account information and mutations, notifications, chat, scrap, and job-search/application screens. Cross-account, tenant, service, and data-store exposure cannot be determined from these route wrappers without the corresponding backend policies.

Security Findings and Attack Paths

  • inferred — No introduced browser-route bypass or external redirect path was identified in the changed entrypoints. Routes previously rendered directly, whereas the new wrappers restrict rendering. Their redirect input is the matched browser pathname, not an external URL supplied by these changes. This conclusion does not cover direct API requests.

Trust Boundaries and Controls

  • observed — The browser guard checks mutable local authentication state. The existing HTTP client attaches a bearer token and handles unauthorized-response recovery, but the inspected client source does not establish backend authentication, role, tenant, or resource-owner enforcement. Missing server evidence is an assurance gap, not a verified authorization vulnerability.

Resilience and Maintainability Implications

  • inferred — For the inspected source transitions, initial unauthenticated state, token/login mismatch, and logout deny protected rendering rather than grant access. The readiness timeout cannot independently create credentials. Store and role-guard initialization behavior predates this PR; no changed writer was identified that weakens the authentication tuple.

Hardening Proposals

  • proposed — Complete the authorization assurance with backend policy evidence for the affected data and mutation endpoints, including role and resource ownership checks. Treat persisted browser scope as a presentation hint rather than an authorization authority. This proposes verification, not a finding that those controls are absent.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 마이페이지와 알림 경로에 가드를 적용한다는 핵심 변경을 제목이 설명합니다. 채팅, 지도, 스크랩 경로의 접근 제한은 제목에 포함되지 않았지만, 제목은 변경 내용과 관련이 있습니다.
Description check ✅ Passed ID, 변경 내용, 구현 사항을 작성해 템플릿의 필수 정보를 대부분 충족합니다. 시연과 참고 사항은 필요 시 항목이므로 비어 있어도 문제가 없습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

*/
export function AuthRouteGuard({ children }: AuthRouteGuardProps) {
const location = useLocation()
const authReady = useAuthStore(s => s.hasHydrated || Boolean(s.token))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuthRouteGuard랑 HomeRouteGuard에 인증 상태 확인 리다이렉트 로직이 중복된 걸로 보이는데 이후 한쪽만 수정되면서 동작이 달라질 수 있을 것 같은데 이 부분 확인해주시면 좋겠습니당

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정 완료

@kim3360
kim3360 merged commit 3013caf into dev Oct 15, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7532dc17 Deployed Oct 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants