Skip to content

admin 세션 연장 CSRF 차단 해제 + TTL 1시간 - #702

Merged
sevineleven merged 2 commits into
devfrom
fix/admin-session-extend-csrf-ttl
Jul 7, 2026
Merged

admin 세션 연장 CSRF 차단 해제 + TTL 1시간#702
sevineleven merged 2 commits into
devfrom
fix/admin-session-extend-csrf-ttl

Conversation

@sevineleven

Copy link
Copy Markdown
Collaborator

Situation

  • admin 백오피스 세션 **연장 버튼을 누르면 "세션 만료됨"**이 떠 연장이 안 됐다.
  • 남은시간은 정상 표시되는데 연장만 실패 — GET 은 되고 POST 만 막히는 전형적 CSRF 증상.

Task

  • 연장이 실제로 되게 고치고, 세션 TTL 을 운영에 맞게 조정한다.

Action

원인

AdminSecurityConfig 가 CSRF 를 /admin-access/** 만 제외하고 /admin/** 은 유지했다.

  • POST /admin/session/extend/admin/**CSRF 적용 → 프론트 fetch 는 토큰을 안 실어 403
  • 403 응답엔 remainingSeconds 가 없어 프론트가 undefined | 0 = 0"만료됨" 오표시
  • GET /admin/session/ttl 은 safe method 라 CSRF 무관 → 남은시간은 정상 표시(그래서 연장만 실패로 보였다)

수정

  • CSRF: /admin/session/** 를 CSRF 제외에 추가. 폼이 아니라 fetch(JSON) API 라 admin-access 처럼 토큰을 실을 수 없다. 자기 세션 연장이라 CSRF 위험도 없다.
  • TTL: allowlistTtl 24h → 1h. 무활동 만료를 짧게 하고 연장 버튼으로 갱신(AdminProperties·application.yml 양쪽).
  • 프론트 견고성: 연장 fetch 가 비 2xx·네트워크 실패 시 기존 카운트다운을 유지(응답 실패를 "만료됨"으로 오표시하지 않는다).

Result


연관 이슈

연장 버튼(POST /admin/session/extend)이 CSRF 에 막혀 403 나고, 프론트가 그
실패 응답(remainingSeconds 없음)을 '만료됨'으로 오표시했다. GET /ttl 은 safe
method 라 통과해 남은시간은 보이는데 연장만 조용히 실패하던 문제.

- /admin/session/** 을 CSRF 제외에 추가. 폼이 아니라 fetch(JSON) API 라
  admin-access 처럼 토큰을 실을 수 없다(자기 세션 연장이라 CSRF 위험도 없음).
- allowlistTtl 24h → 1h. 무활동 만료를 짧게, 연장 버튼으로 갱신.
- 연장 fetch 가 비 2xx·네트워크 실패 시 기존 카운트다운 유지(만료 오표시 방지).
@sevineleven sevineleven added the infra 운영 환경 (IaC·클라우드 리소스·secret·배포 workflow) label Jul 7, 2026
@sevineleven sevineleven self-assigned this Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sevineleven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4acf3fac-4863-468e-911a-faa791de711b

📥 Commits

Reviewing files that changed from the base of the PR and between e76e84c and 67bd53e.

📒 Files selected for processing (4)
  • src/main/kotlin/com/depromeet/piki/admin/config/AdminProperties.kt
  • src/main/kotlin/com/depromeet/piki/admin/config/AdminSecurityConfig.kt
  • src/main/resources/application.yml
  • src/main/resources/templates/admin/fragments.html
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/admin-session-extend-csrf-ttl

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.

@sevineleven
sevineleven merged commit 96bc1d8 into dev Jul 7, 2026
6 checks passed
@sevineleven
sevineleven deleted the fix/admin-session-extend-csrf-ttl branch July 7, 2026 17:15
m-a-king added a commit that referenced this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra 운영 환경 (IaC·클라우드 리소스·secret·배포 workflow)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant