Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/security-policy-enforcement/case/case-messaging-security-f01.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00

93 lines
4.5 KiB
Markdown

---
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:
- 원본 분석 절은 analysis/messaging/messaging-security.md#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
## 재현 조건
원문은 analysis/messaging/messaging-security.md#L634 에 있다.
## 본문
<!-- body:start -->
`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 가 답한다.
<!-- body:end -->