fix(backend): 인증 실패 응답의 한글 깨짐(???) 수정 - #164
Merged
Merged
Conversation
SecurityConfig 는 인증 실패 JSON 을 메시지 컨버터 없이 직접 쓴다. charset 을 지정하지 않아 getWriter() 가 ISO-8859-1 로 인코딩했고, "유효하지 않은 토큰입니다." 가 "???? ?? ?????." 로 나갔다. 만료 토큰 401 은 사용자가 가장 자주 만나는 응답이라 그대로 화면에 노출된다. 운영에 요청을 던져 확인. 도메인 예외는 Spring 메시지 컨버터를 타서 영향이 없다 — 직접 쓰는 이 경로만 문제. 테스트는 본문 문자열이 아니라 "charset 을 명시했는가"를 본다. MockHttpServletResponse 의 기본 인코딩이 실제 컨테이너와 달라 깨짐 자체는 재현되지 않기 때문. 수정을 되돌리면 실패하는 것까지 확인했다.
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.
문제
운영에 요청을 던져 확인했습니다.
유효하지 않은 토큰입니다.가 물음표로 나갑니다. 만료 토큰 401 은 사용자가 가장 자주 만나는 응답이고, 프론트는 이 message 를 그대로 화면에 띄웁니다.원인
SecurityConfig.writeErrorResponse는 인증 실패 JSON 을 Spring 메시지 컨버터 없이 직접 씁니다.setContentType("application/json")만 하고 charset 을 지정하지 않아,getWriter()가 서블릿 기본값인 ISO-8859-1 로 인코딩했습니다.도메인 예외(
GlobalExceptionHandler)는 메시지 컨버터를 타서 영향이 없습니다 — 직접 쓰는 이 경로만 문제입니다.테스트
본문 문자열로는 검증할 수 없었습니다.
MockHttpServletResponse의 기본 인코딩이 실제 서블릿 컨테이너와 달라 깨짐이 재현되지 않습니다(수정 없이도 통과하는 가짜 가드였습니다).대신 "charset 을 명시했는가" 를 고정했습니다. 수정을 되돌리면 실패하는 것까지 확인했습니다.