fix: 스냅샷 직렬화 500 수복 + 입금 CSRF 방어 + 대시보드 다듬기#446
Merged
Conversation
3차 점검(통합 스크립트·린트·프론트/스레딩 적대 리뷰) 결과 일괄 적용. HIGH — /api/snapshots 매 폴링 500(수익률 차트 사망): 어제 일간 수익률 경계용으로 추가한 created_at 컬럼을 직렬화가 처리하지 못해 pd.Timestamp가 JSON 예외를 냈다. 프론트는 비정상 응답을 조용히 스킵해 차트만 빈 채였고, 빈 DF만 타는 테스트는 못 잡았다. 모든 날짜형 컬럼 처리 + 비어 있지 않은 DF·실행 회귀 고정. 실서버 200/2rows 확인. MED — POST /api/deposit CSRF: 루프백 바인딩도 브라우저 경유 cross-site POST는 못 막고 aiohttp request.json()은 Content-Type을 안 본다(위조 입금 → 트랙 원금 오염 가능). X-Requested-With 커스텀 헤더 필수(preflight 강제, 이 서버는 preflight 미응답) + 프론트 한 쌍 + 무헤더 403·기록 0건 테스트. MED — 기본 계정 차트가 전 계정 혼합: 빈 account_key를 무필터로 강등하던 핸들러 수정(존재/빈 값 구분) + 프론트 상시 파라미터 전송 + 격리 테스트. LOW — 폴링 오버랩 가드, 계정 옵션 값 시그니처 비교, escHtml 따옴표·포지션 심볼 이스케이프, Dashboard 싱글턴화(10초마다 초기화 INFO 스팸 제거), 항상 0이던 KIS 통계 폴백 삭제(무의미 측정 + 폴링 로그 스팸). 린트(pyflakes): 미사용 import 2건 + 플레이스홀더 없는 f-string 1건. 통합 스크립트 test_integration.py 38/38(5주 만 재실행), 전체 스위트 1650.
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.
무엇
3차 코드 점검(통합 스크립트 + 린트 + 대시보드 프론트/스레딩 적대 리뷰)에서 나온 수정 일괄 적용. 핵심: 어제 넣은 회귀로 수익률 차트가 실서버에서 조용히 죽어 있던 것을 발견·수복했습니다.
발견 → 수정
🔴 HIGH —
/api/snapshots매 폴링 500 (수익률 차트 사망)어제 일간 수익률 경계용으로 스냅샷 DF에
created_at을 추가했는데, 직렬화가date컬럼만 문자열화해pd.Timestamp가 그대로 새어나가 JSON 직렬화 예외 → 500. 프론트는r.ok가 아니면 조용히 스킵이라 차트만 빈 채로 남았고, 테스트는 빈 DF 경로만 타서 못 잡았습니다. → 직렬화가 모든 날짜형 컬럼을 처리하도록 수정 + 비어 있지 않은 DF·실행(row 존재) 엔드포인트 회귀 고정. 실서버 확인: 200/2rows 부활.🟠 MED — POST /api/deposit CSRF
루프백 바인딩이어도 브라우저 경유 cross-site POST는 막지 못하고, aiohttp
request.json()은 Content-Type을 안 봅니다(악성 페이지가 text/plain fetch로 위조 입금 가능 → 60일 트랙 원금 오염). → 커스텀 헤더(X-Requested-With) 필수(preflight 강제, 이 서버는 preflight 미응답이라 외부 오리진 불가) + 프론트 한 쌍 + 무헤더 403·기록 0건 테스트. 실서버 확인: 403.🟠 MED — '기본 계정' 차트가 전 계정 혼합
핸들러가 빈 account_key를 None(무필터)으로 강등 → 10M/30만 스케일이 한 차트에 톱니로 섞임. → 파라미터 존재/빈 값 구분 + 프론트가 항상 파라미터 전송 + 격리 테스트.
🟡 LOW 4건(리뷰 확정분): 폴링 오버랩 가드(느린 응답 적체 방지) · 계정 옵션 갱신을 개수→값 시그니처 비교로 · escHtml 따옴표 이스케이프 + 포지션 심볼 이스케이프 · 폴링 소음 제거(Dashboard 싱글턴화 — 10초마다 초기화 INFO 스팸, 신규 인스턴스라 항상 0이던 KIS 통계 폴백 삭제).
린트(pyflakes) 3건: 미사용 import 2건(basket_rebalancer의 Optional, web_dashboard의 get_latest_snapshot_summary) + 플레이스홀더 없는 f-string 1건.
함께 확인
test_integration.py38/38 통과 (5주 만의 재실행 — 리포트 v2·관측성·TWR·pocket·대시보드·가드·마이그레이션 전부 반영된 상태에서).