Skip to content

fix: getHref 결과를 LMS 출처로 제한 - #20

Merged
6-keem merged 2 commits into
mainfrom
fix/19-gethref-origin
Oct 24, 2026
Merged

6-keem merged 2 commits into
mainfrom
fix/19-gethref-origin

Conversation

@6-keem

@6-keem 6-keem commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

관련 이슈

Closes #19

변경 내용

  • getHref 가 new URL(href, base) 결과의 origin 이 BASE_LINK(https://learn.hansung.ac.kr) 와 다르면 null 을 반환한다. 다른 호스트·//evil·javascript:·data:·http 링크가 상세 요청 대상으로 쓰이지 않는다.
  • 호출부(parseCourses, fetchQuiz, fetchAssign, fetchVodList)는 이미 null 이면 해당 행을 버리므로 추가 수정 없음.
  • 동작 변경(CHANGELOG): LMS 외부 링크(다른 호스트·http·javascript: 등)를 가진 강좌·VOD·과제·퀴즈 행은 이제 결과에서 제외된다.
  • README Node 예제: fetchHtml 이 new URL(url, BASE_LINK).origin 이 LMS 일 때만 MoodleSession 쿠키를 붙이고 그 외는 거부, redirect: 'manual' 로 리다이렉트를 따라가며 쿠키가 새지 않게 함.
  • 테스트(test/dom.test.ts): 외부 호스트·유사 도메인·http·//evil·javascript:·data: → null 케이스 추가. 외부 호스트(example.com)를 기대하던 기존 케이스는 LMS 주소로 교체. 상대/같은 출처 절대 경로 케이스는 그대로 통과.

변경 유형

  • 🐛 버그 수정 (fix)
  • ✨ 기능 추가 (feat)
  • 📝 문서 (docs)
  • ♻️ 리팩터링 (refactor)
  • 🎨 스타일/포맷 (style)
  • ⚡ 성능 개선 (perf)
  • ✅ 테스트 (test)
  • ⚙️ 빌드/CI/기타 (build, ci, chore, revert)

체크리스트

  • 이 PR과 연결된 이슈가 존재합니다.
  • 로컬에서 npx prettier --check . / npm run lint / npm run build / npm run test 가 통과합니다. (테스트 196개)
  • 변경 사항을 직접 테스트했습니다. (단위 테스트)
  • 리뷰어 피드백을 반영할 준비가 되어 있습니다.

🤖 Generated with Claude Code

6-keem and others added 2 commits October 24, 2026 15:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@6-keem
6-keem merged commit f5eb195 into main Oct 24, 2026
5 of 6 checks passed
@6-keem
6-keem deleted the fix/19-gethref-origin branch October 24, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] getHref 결과를 LMS 출처로 제한 (보안 보강)

1 participant