Skip to content
Merged
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: 2 additions & 2 deletions app/analysis/rules/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def analyze_text_with_rules(text: str, traced_url: Optional[str] = None) -> dict
matched_rules.append(f"로컬 가드 도메인 룰 매치 ({traced_url})")
score += MALICIOUS_DOMAIN_RULE_SCORE

if _RE_ACCOUNT_NUMBER.search(text):
if _RE_ACCOUNT_NUMBER.search(text) or "[ACCOUNT]" in text:
matched_rules.append("계좌번호로 추정되는 숫자 패턴 발견")
score += ACCOUNT_NUMBER_SCORE

if _RE_CARD_NUMBER.search(text):
if _RE_CARD_NUMBER.search(text) or "[CARD]" in text:
matched_rules.append("카드번호로 추정되는 숫자 패턴 발견")
score += CARD_NUMBER_SCORE

Expand Down
15 changes: 15 additions & 0 deletions tests/analysis/rules/test_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,18 @@ def test_rule_score_never_exceeds_100():
result = analyze_text_with_rules(text, traced_url="https://scam.ru/phish")

assert result["rule_score"] == 100

def test_masked_account_token_is_detected():
"""Spring이 마스킹한 [ACCOUNT] 토큰도 계좌번호로 탐지되어야 한다."""
result = analyze_text_with_rules("입금 계좌 [ACCOUNT] 으로 보내주세요")

assert result["rule_score"] >= 30
assert any("계좌번호" in r for r in result["matched_rules"])


def test_masked_card_token_is_detected():
"""Spring이 마스킹한 [CARD] 토큰도 카드번호로 탐지되어야 한다."""
result = analyze_text_with_rules("카드번호 [CARD] 을 입력해주세요")

assert result["rule_score"] >= 30
assert any("카드번호" in r for r in result["matched_rules"])
Loading