fix(analytics): 인라인 스크립트 보간 제거로 XSS 잠재 위험 차단 - #94
Merged
Conversation
- measurementId를 인라인 JavaScript 코드에 템플릿 리터럴로 직접 보간하던 방식에서 data-ga-measurement-id 속성 기반 전달 방식으로 개선 - 인라인 스크립트 코드를 완전한 정적 문자열로 고정하여 잠재적인 코드 인젝션 벡터 차단 - GoogleAnalytics 렌더링 검증 단위 테스트 추가
CoBool
force-pushed
the
fix/ga-script-injection-safety
branch
from
August 16, 2026 12:15
62f59cb to
f9adfa5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
src/components/google-analytics.tsx에서config.measurementId를 인라인 JavaScript 코드 문자열에 템플릿 리터럴로 직접 보간하던 방식을 제거<script async data-ga-measurement-id={config.measurementId} src={gtagSource} />속성을 통해 ID를 전달하고, 인라인 스크립트 본문은 완전한 정적 문자열로 고정tests/stage-7-seo-feed-integrations.test.tsx에 GoogleAnalytics 활성화 시 스크립트 태그 및 데이터 속성 렌더링 검증 단위 테스트 추가변경 이유
검증
pnpm lint: 통과pnpm typecheck: 통과pnpm test: GA 렌더링 테스트 포함 32개 테스트 파일 / 226개 테스트 전체 통과pnpm build: 정적 빌드 성공 및 HTML 내 스크립트 태그 정상 생성 확인