--- kind: CASE slug: messaging-security-f01 title: 같은 TLS posture를 두 클래스가 다른 엄격도로 검사한다 topic: security-policy-enforcement project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: case:messaging-security-f01 evidenceCapturedOn: 2026-09-01 assets: - key: messaging-security-f01 file: ../../../final/evidence/rendered/messaging-security-f01.svg - key: messaging-security-f01-diagram file: ../../../final/assets/diagrams/messaging-security-f01.svg evidence: - ../../../final/evidence/raw/messaging-security-f01.txt source: - 원본 분석 절은 final/document.md#a19-messaging-security#L634 이다. module: messaging-security priority: P2 --- # 같은 TLS posture를 두 클래스가 다른 엄격도로 검사한다 MessageSecurityValidator는 hostname 검증을 production && !hostnameVerification일 때만 요구하고, BrokerTlsPolicy는 tlsEnabled && !hostnameVerification일 때 요구한다. 전자는 코드 없는 IllegalArgumentException, 후자는 안정 코드가 붙은 MessagingConfigurationException을 던진다. ## 관계 - **배선된 게이트는 자기 leaf 레인에서 검증한다** 같은 분석 리프에서 끌어낸 규칙이다. - **같은 술어가 두 타입에 있으면 하나가 다른 하나를 부른다** 같은 분석 리프에서 끌어낸 규칙이다. - **가변 필드로 상태 전이를 표현하면 가시성을 함께 정한다** 같은 분석 리프에서 끌어낸 규칙이다. - **맵 갱신 함수 안에서 I/O를 하면 그 지연이 락 범위가 된다** 같은 분석 리프에서 끌어낸 규칙이다. ## 문제 MessageSecurityValidator는 hostname 검증을 production && !hostnameVerification일 때만 요구하고, BrokerTlsPolicy는 tlsEnabled && !hostnameVerification일 때 요구한다. 전자는 코드 없는 IllegalArgumentException, 후자는 안정 코드가 붙은 MessagingConfigurationException을 던진다. ## 결론 둘 다 같은 BrokerSecurityProfile을 받고, 후자만 어댑터에서 실제로 호출된다. 비운영에서 TLS를 켜고 hostname 검증을 끈 구성을 두 검사가 다르게 판정한다. 그리고 이 leaf 자신의 javadoc이 그 구성을 "looks encrypted in every dashboard while accepting any certificate a man in the middle presents"라고 부른다 — 즉 더 느슨한 쪽이 그 위험을 통과시킨다. 실패 형태도 달라서 운영자가 두 어휘를 알아야 한다. ## 검증 환경 OpenJDK : 21.0.12 java -version 으로 확인 Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인 확인 방식 : MessageSecurityValidator 참조 7건 검색과 두 클래스의 검사 조건·예외 타입 대조 소스 수정 : x ## 재현 조건 원문은 final/document.md#a19-messaging-security#L634 에 있다. ## 본문 `MessageSecurityValidator`는 hostname 검증을 `production && !hostnameVerification`일 때만 요구하고, `BrokerTlsPolicy`는 `tlsEnabled && !hostnameVerification`일 때 요구한다. ## 두 검사의 차이 :::evidence key="messaging-security-f01-diagram" alt="검증기 쪽에 production 일 때만과 코드 없는 예외가 빗금으로 놓이고 정책 쪽에 tls 켜지면 언제나와 안정 코드 예외가 놓인다" caption="두 검사의 차이" zoom="false" ::: 전자는 코드 없는 `IllegalArgumentException`, 후자는 안정 코드가 붙은 `MessagingConfigurationException`을 던진다. ## MessageSecurityValidator 참조 위치 :::evidence key="messaging-security-f01" alt="코드베이스에서 MessageSecurityValidator 를 검색한 출력 7줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MessageSecurityValidator 코드베이스 검색 — 7줄 · exit 0" zoom="true" ::: ## 느슨한 쪽이 위험을 통과시킨다 둘 다 같은 `BrokerSecurityProfile`을 받고, 후자만 어댑터에서 실제로 호출된다. 비운영에서 TLS를 켜고 hostname 검증을 끈 구성을 두 검사가 다르게 판정한다. 이 leaf 자신의 javadoc이 그 구성을 "looks encrypted in every dashboard while accepting any certificate a man in the middle presents"라고 부른다. 실패 형태도 달라서 운영자가 두 어휘를 알아야 한다. ## 확인하지 못한 것 validate 가 실제로 호출되는지 확인하지 못했다. starter 가 bean 을 만들고 같은 파일에서 직접 부를 가능성이 있으며, 그 leaf 가 답한다.