Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

## [Unreleased]
- **보안 개선**: 향후 `target="_blank"` 링크 추가 시 `rel="noopener noreferrer"` 속성 누락으로 인한 Reverse Tabnabbing 취약점이 발생하는 것을 방지하기 위해 정적 분석 테스트를 추가했습니다.
- **보안 개선**: `i18n.js`에서 잘못된 언어 요청 시 `console.warn` 메시지에 사용자 입력값이 직접 포함되지 않도록 수정하여 로그 인젝션(Log Injection) 취약점을 제거했습니다.
- **성능 개선**: `.skip-link` 애니메이션을 `top`에서 `transform: translateY()`로 변경하여 전환 중 레이아웃 재계산을 줄일 수 있도록 했습니다. 실제 효과는 브라우저별 측정 대상입니다.
- **렌더링 힌트 정합성**: 첫 화면의 eager 이미지와 단일 LCP 후보에서 강제 `decoding="async"`를 제거해 HTML 표준의 기본 `auto` 판단에 맡기고, 지연 로드 이미지에는 비동기 디코딩 힌트를 유지했습니다. 정적 테스트가 eager, lazy, LCP 후보 집합의 존재와 조합을 검증하며, 실제 LCP 효과는 배포 후 실측 대상으로 유지합니다.
Expand Down
13 changes: 13 additions & 0 deletions tests/test_index_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,16 @@ def test_index_has_no_inline_active_content() -> None:
assert (
'<meta name="referrer" content="strict-origin-when-cross-origin">' in html
)

def test_index_external_links_have_noopener_noreferrer() -> None:
"""Ensure all external links (target="_blank") have rel="noopener noreferrer" to prevent reverse tabnabbing."""
html = _index_html()

# Very basic HTML parsing for the specific tag to avoid brittle regex and avoid missing imports
links = re.findall(r'<a[^>]+>', html, flags=re.IGNORECASE)
for link in links:
if 'target="_blank"' in link or "target='_blank'" in link:
# Check for noopener and noreferrer anywhere in the tag
has_noopener = 'noopener' in link
has_noreferrer = 'noreferrer' in link

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Parse anchor attributes before validating rel tokens

When a future link contains these words outside the rel token list, this test passes without providing either protection; for example, rel="noopener-noreferrer" makes both substring checks true even though the browser recognizes neither required token. A syntactically valid form such as target = "_blank" also bypasses the check entirely. Parse the anchor attributes and compare _blank and the whitespace-separated rel tokens instead.

Useful? React with 👍 / 👎.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
assert has_noopener and has_noreferrer, f"External link missing noopener or noreferrer: {link}"
Loading