Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ Explicitly defining `allow_pickle=False` is a robust defense-in-depth practice.
**Vulnerability:** MD5 hashing in `fast_mlsirm/report.py` triggered a high severity warning by Bandit, because by default it is assumed to be used for security purposes which is unsafe due to weak hashing.
**Learning:** For non-security purposes like generating unique dom ids, `hashlib.md5()` triggers a vulnerability warning unless `usedforsecurity=False` is passed. This allows bypassing FIPS compliance limitations as well as suppressing false positive warnings.
**Prevention:** Always add `usedforsecurity=False` parameter to `hashlib.md5` and other weak hashing functions unless they are genuinely used for secure cryptography (which they shouldn't be).
## 2026-07-31 - [리포트 생성 μ‹œ λ¬΄μ œν•œ JSON λ‘œλ”©μœΌλ‘œ μΈν•œ DoS 취약점]
**Vulnerability:** `fast_mlsirm/report.py` νŒŒμΌμ—μ„œ 파일 크기 μ œν•œ 없이 `json.loads(source.read_text())`λ₯Ό μ‚¬μš©ν•˜μ—¬ 진단 JSON νŒŒμΌμ„ λ‘œλ“œν•˜κ³  μžˆμ—ˆμŠ΅λ‹ˆλ‹€. μ•…μ˜μ μœΌλ‘œ μ‘°μž‘λ˜κ±°λ‚˜ 맀우 큰 JSON 파일이 μž…λ ₯될 경우, λ©”λͺ¨λ¦¬ 고갈둜 μΈν•œ OOM(Out-Of-Memory) ν¬λž˜μ‹œ 및 μ„œλΉ„μŠ€ κ±°λΆ€(DoS)κ°€ λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.
**Learning:** μ™ΈλΆ€λ‚˜ μ‚¬μš©μžκ°€ μ œκ³΅ν•œ νŒŒμΌμ— λŒ€ν•΄ ν‘œμ€€ 라이브러리의 λ¬΄μ œν•œ 읽기 및 νŒŒμ‹±μ„ μ‚¬μš©ν•  경우 μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μžμ› 고갈 곡격에 μ·¨μ•½ν•΄μ§‘λ‹ˆλ‹€.
**Prevention:** λ©”λͺ¨λ¦¬ κ³ κ°ˆμ„ ν†΅ν•œ DoSλ₯Ό λ°©μ§€ν•˜κΈ° μœ„ν•΄ λ¬΄μ œν•œ `json.loads(source.read_text())` λŒ€μ‹  크기 μ œν•œμ΄ μžˆλŠ” μ•ˆμ „ν•œ JSON λ‘œλ” (예: `io.py`의 `_load_json_bounded`)λ₯Ό μ‚¬μš©ν•΄μ•Ό ν•©λ‹ˆλ‹€.
5 changes: 3 additions & 2 deletions python/fast_mlsirm/report.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

import hashlib
import json
import math
from html import escape
from pathlib import Path
from typing import Any

from fast_mlsirm.io import _load_json_bounded


def render_diagnostics_report(
diagnostics_path: str | Path,
Expand All @@ -17,7 +18,7 @@ def render_diagnostics_report(
"""Render saved diagnostics JSON as a standalone HTML report."""

source = Path(diagnostics_path)
payload = json.loads(source.read_text(encoding="utf-8"))
payload = _load_json_bounded(source, source="diagnostics JSON")
if not isinstance(payload, dict):
raise ValueError("diagnostics JSON must contain an object")

Expand Down
1 change: 1 addition & 0 deletions test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"test": 1}
Loading