Skip to content

fix(web): localhost에서 로그인 미들웨어 가드 스킵#504

Merged
manNomi merged 1 commit intomainfrom
codex/skip-localhost-middleware-auth-check
Apr 29, 2026
Merged

fix(web): localhost에서 로그인 미들웨어 가드 스킵#504
manNomi merged 1 commit intomainfrom
codex/skip-localhost-middleware-auth-check

Conversation

@manNomi
Copy link
Copy Markdown
Contributor

@manNomi manNomi commented Apr 29, 2026

배경

  • 로컬(localhost)에서는 stage 도메인 refresh 쿠키를 미들웨어에서 읽을 수 없어, /mentor, /my, /community 진입 시 즉시 /login으로 리다이렉트되는 문제가 있었습니다.

변경 사항

  • apps/web/src/middleware.ts
  • localhost, 127.0.0.1 호스트에서는 로그인 미들웨어 가드를 스킵하도록 처리했습니다.
  • 로컬에서 의미 없는 refresh 토큰 만료 검사 분기를 제거했습니다.

기대 효과

  • 로컬 개발 환경에서 인증 가드로 인한 선행 리다이렉트가 사라져, 클라이언트 재발급/페이지 플로우 검증이 가능해집니다.
  • stage/prod 호스트의 미들웨어 로그인 보호 동작은 유지됩니다.

검증

  • pnpm --filter @solid-connect/web run lint:check 통과
  • pnpm --filter @solid-connect/web run typecheck:ci 통과
  • pre-push 훅의 @solid-connect/web ci:check + build 통과

@manNomi manNomi requested review from enunsnv and wibaek as code owners April 29, 2026 07:52
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

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

Project Deployment Actions Updated (UTC)
solid-connection-web Ready Ready Preview, Comment Apr 29, 2026 7:54am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
solid-connect-web-admin Skipped Skipped Apr 29, 2026 7:54am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 13256e88-7f15-46d3-8e64-0e198837648b

📥 Commits

Reviewing files that changed from the base of the PR and between ef70e22 and b1d810a.

📒 Files selected for processing (1)
  • apps/web/src/middleware.ts

Walkthrough

미들웨어가 토큰 만료 검사 로직을 간소화했습니다. 로컬호스트 요청은 인증 검사를 건너뛰고, 리프레시 토큰 만료 여부 확인을 제거하되 토큰 부재 시에만 로그인을 강제하도록 변경되었습니다.

주요 변경사항:

  1. isTokenExpired 유틸리티 제거 — 더 이상 토큰 만료 여부를 명시적으로 검사하지 않습니다.
  2. 로컬호스트 바이패스 추가 — localhost127.0.0.1 요청은 인증 검사 없이 통과합니다.
  3. 리프레시 토큰 만료 검사 폐기 — 보호된 페이지에서 토큰 만료 여부 확인을 중단합니다.
  4. 단순화된 로그인 강제 로직 — refreshToken이 누락된 경우에만 로그인을 요구합니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • wibaek
  • enunsnv
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/skip-localhost-middleware-auth-check

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1d810aa3b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 101 to 104
return buildLoginRedirectResponse(request);
}

if (needLogin && isTokenExpired(refreshToken ?? null)) {
return buildLoginRedirectResponse(request, { clearRefreshToken: true });
}

return NextResponse.next();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reinstate refresh-token expiry guard on login-required paths

With this change, /mentor, /my, and /community only check whether refreshToken exists, and no longer validate expiration before allowing the request through. In stage/prod, a user with an expired but still-present cookie now bypasses the middleware redirect and reaches protected pages until downstream API calls fail, and the cookie-clearing path is never executed. This is a regression from the previous behavior where expired refresh tokens were redirected to /login immediately.

Useful? React with 👍 / 👎.

@manNomi manNomi merged commit 936cd22 into main Apr 29, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant