Skip to content

[FEATURE] 외부 DB 비의존 피싱 탐지 파이프라인 개발#28

Merged
minsoo0506 merged 5 commits into
devfrom
feat/#25-db-independent-pipeline
May 21, 2026
Merged

[FEATURE] 외부 DB 비의존 피싱 탐지 파이프라인 개발#28
minsoo0506 merged 5 commits into
devfrom
feat/#25-db-independent-pipeline

Conversation

@minsoo0506

Copy link
Copy Markdown
Contributor

요약

외부 위협 DB에 의존하지 않는 URL 분석 파이프라인을 추가했습니다. (혼동행렬을 위한 테스트용)
스크린샷 2026-05-21 오후 6 40 35

주요 변경 사항:

  • /api/v1/analyze/db-independent/sync 엔드포인트 추가
  • 일반/DB 비의존 파이프라인 응답 지연 개선
  • 스킴 없는 URL 입력 처리 개선
  • 콘텐츠 분석 응답에 status_code 추가
  • AI 사유(ai_reason)를 쉬운 한국어 100자 이내로 제한
  • RDAP 캐시/호출 제한 및 분석 동작 README 반영
  • make run reload 범위를 app으로 제한

응답 예시:

{
  "status": "success",
  "analysis_id": "e58d42e8-3741-4a41-95ac-265d6a18ec07",
  "original_url": "   https://www.naver.com/",
  "final_url": "https://www.naver.com/",
  "verdict": "safe",
  "score": 0,
  "timings": {
    "total_seconds": 2.799809,
    "stages": {
      "normalize": 0.000074,
      "unchain": 0.052175,
      "threat_db": null,
      "domain_heuristic": 0.940779,
      "content_analysis": 2.746444
    }
  },
  "stages": {
    "normalize": {
      "original_url": "https://www.naver.com/",
      "normalized_url": "https://www.naver.com/",
      "scheme_was_added": false
    },
    "unchain": {
      "input_url": "https://www.naver.com/",
      "final_url": "https://www.naver.com/",
      "hops": [
        {
          "url": "https://www.naver.com/",
          "status_code": 200,
          "raw_location": null,
          "location": null,
          "method": "HEAD"
        }
      ],
      "hop_count": 1,
      "timed_out": false,
      "error": null,
      "signals": []
    },
    "domain_heuristic": {
      "domain": "naver.com",
      "score": 0,
      "signals": [],
      "rdap": {
        "domain": "naver.com",
        "registrar": "Gabia, Inc.",
        "created_date": "1997-09-12T04:00:00Z",
        "expiry_date": "2032-09-11T04:00:00Z",
        "domain_age_days": 10478,
        "is_new_domain": false
      },
      "rdap_error": null,
      "skipped_reason": null
    },
    "content_analysis": {
      "final_url": "https://www.naver.com/",
      "fetched": true,
      "status_code": 200,
      "score": 0,
      "signals": [],
      "title": "NAVER",
      "has_password_field": false,
      "has_password_form_external_action": false,
      "has_meta_refresh": false,
      "has_external_meta_refresh": false,
      "external_link_ratio": 0,
      "brand_impersonation": false,
      "logo_alt_impersonation": false,
      "is_spa_shell": false,
      "ai_verdict": "benign",
      "ai_reason": "이 페이지는 공식 NAVER 사이트로 보이며, 의심스러운 요소가 없습니다.",
      "reason": null,
      "ai_error": null,
      "ai_model": "gpt-4o-mini",
      "ai_token_usage": {
        "prompt_tokens": 547,
        "completion_tokens": 29,
        "total_tokens": 576
      },
      "error": null
    }
  }
}

테스트 방법:

  • pytest -q
  • ruff check app tests
  • mypy app

검증 결과:

  • 374 passed in 2.43s
  • All checks passed
  • Success: no issues found in 63 source files

연관 이슈 및 Close 할 이슈

close #25

Pull Request 체크리스트

TODO

  • 최종 결과물을 확인했는가?
  • 의미 있는 커밋 메시지를 작성했는가?

@minsoo0506 minsoo0506 requested review from kbh0218 and sunm2n May 21, 2026 09:42
@minsoo0506 minsoo0506 self-assigned this May 21, 2026
@minsoo0506 minsoo0506 added the feature 새로운 기능/특징 label May 21, 2026
@minsoo0506 minsoo0506 changed the title Feat/#25 db independent pipeline [FEATURE] 외부 DB 비의존 피싱 탐지 파이프라인 개발 May 21, 2026

@sunm2n sunm2n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! 바로 머지해도 될 거 같고 제가 드린 제안도 사소한거라 머지를 하는데 있어서는 문제가 되진 않아 보입니다 수고하셨습니다!

return ContentAnalysisResult(
final_url=final_url,
fetched=False,
status_code=None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 항상 None으로 생성되는데 실제 호출부에서는

result = _fetch_failed_result(final_url, fetch_result.error)
  result.status_code = fetch_result.status_code

None으로 만들고 바로 외부에서 덮어쓰는 구조로 확인 됩니다.
함수 시그니처에 status_code를 추가하는 것이 어떨까 제안 드립니다.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 확인해보겠습니다!!

@minsoo0506 minsoo0506 merged commit 1818e53 into dev May 21, 2026
@minsoo0506 minsoo0506 deleted the feat/#25-db-independent-pipeline branch May 21, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 새로운 기능/특징

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 외부 DB 비의존 피싱 탐지 파이프라인 개발

2 participants