fix: 입금 입력 강화 — NaN/Infinity 차단 + note 절단 + 배치율 클램프#445
Merged
Conversation
웹 입금 경로(미리뷰 표면) 자체 점검에서 실제 구멍 발견: python json.loads는 Infinity/NaN 리터럴을 기본 허용하는데, float(inf) > 0 은 True, nan <= 0 은 False라 기존 양수 검사를 둘 다 통과 — 무한대/NaN 입금이 기록되면 현금·원금·TWR 합산이 통째로 오염된다. CLI --amount inf 도 같은 구멍. 수정(심층 방어 3겹): - record_basket_deposit(공유 검증): math.isfinite 필수 + note 200자 서버측 절단(SQLite는 String(200) 미강제) - repositories.record_cash_flow(최종 방어선): 비유한값 ValueError (NaN은 truthy라 기존 `if not amount`도 통과했음) - CLI --account-key 직접 경로: isfinite 검증 일관성: get_baskets_json 배치율 음수 클램프(헬스와 동일 규칙). 회귀 고정: 실제 Infinity/NaN JSON 페이로드 → 400 + 기록 0건, repo 계층 ValueError, 500자 note → 200자 절단. 전체 스위트 1646 통과.
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.
무엇
웹 입금 경로(적대적 리뷰 없이 나갔던 표면)를 자체 점검하다 발견한 실제 입력 검증 구멍 수정.
구멍 (실측 확인)
python
json.loads는Infinity/NaN리터럴을 기본 허용합니다. 그런데:float('inf') > 0= True → 무한대 입금이 기록됨nan <= 0= False → NaN이 양수 검사를 그대로 통과기록되는 순간 현금·원금·TWR 합산이 통째로 오염됩니다. CLI
--amount inf도 같은 구멍이었습니다.수정 (심층 방어 3겹)
record_basket_deposit(웹·CLI 공유 검증):math.isfinite필수 + note 200자 서버측 절단(SQLite는String(200)미강제)record_cash_flow(repo 최종 방어선): 비유한값 ValueError — NaN은 truthy라 기존if not amount도 통과했음--account-key직접 경로에도 isfinite일관성:
get_baskets_json배치율 음수 클램프(헬스 점검과 동일 규칙).회귀 고정
Infinity/NaN/-InfinityJSON 페이로드 → 400 + 기록 0건 (엔드포인트 테스트)