You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
로그인/회원가입 후 리다이렉트 signup_view, login_view에서 이미 로그인된 경우 redirect('/')로 처리되어 있는데, 현재 프로젝트에 루트 URL(/)이 없어서 404가 발생합니다. redirect('exams:period_list') 등 실제 첫 화면으로 바꾸거나, LOGIN_REDIRECT_URL 설정으로 통일하면 좋을 것 같습니다.
로그인 next 파라미터 검증 login_view에서 next_url = request.POST.get('next') or request.GET.get('next') or '/'를 검증 없이 바로 redirect()에 넣고 있어서, 외부 주소를 next로 넘기면 로그인 후 외부 사이트로 리다이렉트되는 오픈 리다이렉트 이슈가 있습니다. django.utils.http.url_has_allowed_host_and_scheme()으로 현재 호스트인지 검증 후 리다이렉트하는 게 안전할 것 같습니다.
직접 추가한 학습 작업 예상시간 0분 StudyTaskForm에 예상시간 필드가 없고, StudyTask 모델 기본값도 min/max 둘 다 0이라, study_task_create에서 저장 시 time_estimator를 호출하지 않으면 사용자가 직접 추가한 작업이 스케줄러에서 0분짜리로 처리됩니다. 저장 전 시간 계산 서비스 호출을 추가해주시면 좋겠습니다.
#34#35 로그인/회원가입 후 리다이렉트 404 발생 이슈 조치 및 오픈 리다이렉트 보안 취약점을 보완했습니다.
🛠️ 작업 내용
로그인/회원가입 기본 리다이렉트 목적지 변경: 루트(/) 경로 미존재로 인한 404 에러 방지를 위해 기본 경로를 exams:period_list로 수정
오픈 리다이렉트(Open Redirect) 방지 로직 추가: login_view에서 next 파라미터 수신 시 url_has_allowed_host_and_scheme()로 동일 호스트 검증 실행 후 안전한 경로로만 리다이렉트되도록 개선
🧪 테스트 방법 및 결과
일반 로그인 테스트: next 파라미터 없이 로그인 시 /exams/periods/로 정상 이동 확인
내부 경로 next 테스트: ?next=/exams/periods/ 지정 후 로그인 시 해당 내부 경로로 리다이렉트 확인
외부 경로 next(악성 URL) 테스트: ?next=https://google.com 입력 후 로그인 시 외부 사이트로 이동하지 않고 기본 페이지(exams:period_list)로 안전하게 차단 이동되는 점 확인
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
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.
관련 이슈
#25
주요 변경 사항
URL 패턴 연결 (
accounts/urls.py):path('signup/', views.signup_view, name='signup'),
path('login/', views.login_view, name='login'),
path('logout/', views.logout_view, name='logout'),
URL 패턴 연결 (
exams/urls.py):path('periods/', views.period_list, name='period_list'),
path('periods/create/', views.period_create, name='period_create'),
path('periods/int:period_id/', views.period_detail, name='period_detail'),
path('periods/int:period_id/subjects/create/', views.subject_create, name='subject_create'),
path('periods/int:period_id/available-time/', views.available_time_update, name='available_time_update'),
path('subjects/int:exam_id/materials/create/', views.material_create, name='material_create'),
path('materials/int:material_id/', views.material_detail, name='material_detail'),
path('subjects/int:exam_id/tasks/review/', views.task_review, name='task_review'),
── 표에 없어서 임시로 지음 (이주헌/신예원에게 공유 필요) ──
path('periods/int:period_id/update/', views.period_update, name='period_update'),
path('periods/int:period_id/delete/', views.period_delete, name='period_delete'),
path('periods/int:period_id/subjects/int:exam_id/update/', views.subject_update, name='subject_update'),
path('periods/int:period_id/subjects/int:exam_id/delete/', views.subject_delete, name='subject_delete'),
path('materials/int:material_id/extract/', views.material_extract, name='material_extract'),
path('materials/int:material_id/delete/', views.material_delete, name='material_delete'),
path('subjects/int:exam_id/tasks/create/', views.study_task_create, name='task_create'),
path('subjects/int:exam_id/tasks/confirm/', views.study_task_confirm, name='task_confirm'),