Files
document-haness/docs/clean-architecture-backend-template/final/evidence/rendered/a13-f008-host-wire.svg
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

151 lines
14 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1580" viewBox="0 0 1200 1580" role="img">
<title>terminal evidence</title>
<desc>Terminal-style rendering generated from retained command output. Sensitive-looking values are redacted in the visual asset.</desc>
<rect x="1" y="1" width="1198" height="1578" rx="14" fill="#0d1117" stroke="#30363d"/>
<rect x="1" y="1" width="1198" height="44" rx="14" fill="#161b22"/>
<rect x="1" y="30" width="1198" height="14" fill="#161b22"/>
<circle cx="24" cy="22" r="6" fill="#ff5f57"/>
<circle cx="44" cy="22" r="6" fill="#febc2e"/>
<circle cx="64" cy="22" r="6" fill="#28c840"/>
<text x="92" y="27" fill="#8b949e" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace">terminal evidence</text>
<text x="24" y="68" fill="#c9d1d9" font-size="15" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">$ set -e
set -o pipefail
D=$(mktemp -d); trap &#x27;rm -rf &quot;$D&quot;&#x27; EXIT
C=/shared/codebase/clean-architecture-backend-template
</tspan><tspan x="24" dy="22">N=$C/src/adapter/outbound/notification
CACHE=/root/.gradle/caches/modules-2/files-2.1
java -version 2&gt;&amp;1 | head -1
cp=&quot;&quot;</tspan><tspan x="24" dy="22">
while IFS= read -r line; do
coord=${line%%=*}; confs=${line#*=}
case &quot;,$confs,&quot; in *&quot;,runtimeClasspath,&quot;*) ;; *) co</tspan><tspan x="24" dy="22">ntinue ;; esac
g=${coord%%:*}; rest=${coord#*:}; n=${rest%%:*}; v=${rest##*:}
jar=$(find &quot;$CACHE/$g/$n/$v&quot; -name &#x27;*.</tspan><tspan x="24" dy="22">jar&#x27; ! -name &#x27;*sources*&#x27; ! -name &#x27;*javadoc*&#x27; 2&gt;/dev/null | head -1)
[ -n &quot;$jar&quot; ] &amp;&amp; cp=&quot;$cp:$jar&quot;
done &lt; &lt;(grep -E &#x27;^</tspan><tspan x="24" dy="22">[a-zA-Z0-9._-]+:[^=]+=&#x27; &quot;$N/gradle.lockfile&quot;)
CP=$(find &quot;$N/build/libs&quot; &quot;$C/src/application-core/build/libs&quot; -name &#x27;*+21</tspan><tspan x="24" dy="22">234e38cdb9.jar&#x27; | tr &#x27;\n&#x27; &#x27;:&#x27;)${cp#:}
cat &gt; &quot;$D/SignedHostProbe.java&quot; &lt;&lt;&#x27;JAVA&#x27;
import com.sun.net.httpserver.HttpServer;</tspan><tspan x="24" dy="22">
import dev.caskeleton.adapter.outbound.notification.platform.provider.http.JdkNotificationHttpGateway;
import dev.caske</tspan><tspan x="24" dy="22">leton.adapter.outbound.notification.platform.provider.http.NotificationHttpRequest;
import java.net.InetSocketAddress;
i</tspan><tspan x="24" dy="22">mport java.net.URI;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.LinkedHashMap;</tspan><tspan x="24" dy="22">
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/** 매퍼가 서명하는 호스트 값과 JDK 가 실제</tspan><tspan x="24" dy="22">로 보내는 Host 헤더를 나란히 잰다. */
public final class SignedHostProbe {
private static final String PATH = &quot;/v2/em</tspan><tspan x="24" dy="22">ail/outbound-emails&quot;;
/** SesRequestMapper:103 이 쓰는 식 그대로. */
private static String signedHost(URI endpoint)</tspan><tspan x="24" dy="22"> {
return endpoint.getHost();
}
/** ExternalRequestUrlResolver:57-63 이 쓰는 판정. 전선의 Host 가 따르는 규칙이</tspan><tspan x="24" dy="22">다. */
private static boolean defaultPort(String scheme, int port) {
return port &lt; 0
|| (&quot;https&quot;.equalsIgn</tspan><tspan x="24" dy="22">oreCase(scheme) &amp;&amp; port == 443)
|| (&quot;http&quot;.equalsIgnoreCase(scheme) &amp;&amp; port == 80);
}
private static String</tspan><tspan x="24" dy="22"> expectedWireHost(URI endpoint) {
return defaultPort(endpoint.getScheme(), endpoint.getPort())
? endpoint.ge</tspan><tspan x="24" dy="22">tHost()
: endpoint.getHost() + &quot;:&quot; + endpoint.getPort();
}
public static void main(String[] args) throws Ex</tspan><tspan x="24" dy="22">ception {
HttpServer server = HttpServer.create(new InetSocketAddress(&quot;127.0.0.1&quot;, 0), 0);
AtomicReference&lt;Strin</tspan><tspan x="24" dy="22">g&gt; received = new AtomicReference&lt;&gt;(&quot;(받지 못함)&quot;);
server.createContext(PATH, exchange -&gt; {
received.set(Stri</tspan><tspan x="24" dy="22">ng.valueOf(exchange.getRequestHeaders().getFirst(&quot;Host&quot;)));
byte[] ok = &quot;{}&quot;.getBytes(StandardCharsets.UTF_8);
</tspan><tspan x="24" dy="22"> exchange.sendResponseHeaders(200, ok.length);
exchange.getResponseBody().write(ok);
exchange.close();
</tspan><tspan x="24" dy="22"> });
server.start();
int port = server.getAddress().getPort();
URI endpoint = URI.create(&quot;http://127.0.0.1:&quot;</tspan><tspan x="24" dy="22"> + port);
String signed = signedHost(endpoint);
JdkNotificationHttpGateway gateway = new JdkNotificationHttpGate</tspan><tspan x="24" dy="22">way(Duration.ofSeconds(5));
try {
System.out.println();
System.out.println(&quot;[헤더 맵 세 모양으로 같은 </tspan><tspan x="24" dy="22">서버에 보낸다]&quot;);
Map&lt;String, Map&lt;String, String&gt;&gt; shapes = new LinkedHashMap&lt;&gt;();
shapes.put(&quot;매퍼가 실제로</tspan><tspan x="24" dy="22"> 보내는 넷&quot;, Map.of(
&quot;content-type&quot;, &quot;application/json&quot;, &quot;x-amz-date&quot;, &quot;20260903T000000Z&quot;,
&quot;x-amz-co</tspan><tspan x="24" dy="22">ntent-sha256&quot;, &quot;UNSIGNED-PAYLOAD&quot;, &quot;authorization&quot;, &quot;AWS4-HMAC-SHA256 ...&quot;));
shapes.put(&quot;거기에 host 를 더한 것&quot;,</tspan><tspan x="24" dy="22"> Map.of(&quot;content-type&quot;, &quot;application/json&quot;, &quot;host&quot;, signed));
shapes.put(&quot;대문자 Host 로 더한 것&quot;, Map.of(&quot;content</tspan><tspan x="24" dy="22">-type&quot;, &quot;application/json&quot;, &quot;Host&quot;, signed));
for (var shape : shapes.entrySet()) {
received.set(&quot;(받지 못</tspan><tspan x="24" dy="22">함)&quot;);
NotificationHttpRequest request =
new NotificationHttpRequest(&quot;POST&quot;, URI.create(endpoint + P</tspan><tspan x="24" dy="22">ATH),
JdkNotificationHttpGateway.headers(shape.getValue()),
&quot;{}&quot;.getBytes(StandardCharse</tspan><tspan x="24" dy="22">ts.UTF_8), Duration.ofSeconds(5));
int status = gateway.exchange(request).statusCode();
// 포트는 실행마</tspan><tspan x="24" dy="22">다 다르다. 재는 것은 두 값이 갈리느냐이므로 자리표시로 바꾼다.
System.out.printf(&quot; %-22s 상태 %d · 서버가 받은</tspan><tspan x="24" dy="22"> Host %s%n&quot;,
shape.getKey(), status, received.get().replace(Integer.toString(port), &quot;&lt;포트&gt;&quot;));
}
</tspan><tspan x="24" dy="22"> System.out.printf(&quot; %-22s %s%n&quot;, &quot;서명 대상&quot;, signed);
System.out.printf(&quot; %-22s %s%n&quot;, &quot;둘이 같은가&quot;,
</tspan><tspan x="24" dy="22"> received.get().equals(signed) ? &quot;&quot; : &quot;아니오&quot;);
System.out.println();
System.out.println(&quot;[갈리는 조건</tspan><tspan x="24" dy="22"> — 위 규칙을 엔드포인트마다 적용한다]&quot;);
System.out.println(&quot; 전선과 갈리면 서명이 어긋난다. 권한부는 갈려도 어</tspan><tspan x="24" dy="22">긋나지 않는 자리가 있다.&quot;);
System.out.printf(&quot; %-46s %-14s %s%n&quot;, &quot;엔드포인트&quot;, &quot;전선과 갈리나&quot;, &quot;권한부와 갈리</tspan><tspan x="24" dy="22">&quot;);
URI[] endpoints = {
URI.create(&quot;https://email.eu-central-1.amazonaws.com&quot;),
URI.create(&quot;http</tspan><tspan x="24" dy="22">s://email.eu-central-1.amazonaws.com:8443&quot;),
URI.create(&quot;https://email.eu-central-1.amazonaws.com:443&quot;),
</tspan><tspan x="24" dy="22"> URI.create(&quot;http://127.0.0.1:80&quot;),
URI.create(&quot;https://user@email.example.com&quot;),
URI.create(&quot;http://loc</tspan><tspan x="24" dy="22">alhost:4566&quot;),
};
for (URI each : endpoints) {
String host = signedHost(each);
System.out.pr</tspan><tspan x="24" dy="22">intf(&quot; %-46s %-16s %s%n&quot;, each,
host.equals(expectedWireHost(each)) ? &quot;아니오&quot; : &quot;&quot;,
host.equ</tspan><tspan x="24" dy="22">als(each.getAuthority()) ? &quot;아니오&quot; : &quot;&quot;);
}
} finally {
server.stop(0);
}
}
}
JAVA
javac -encod</tspan><tspan x="24" dy="22">ing UTF-8 -cp &quot;$CP&quot; -d &quot;$D&quot; &quot;$D/SignedHostProbe.java&quot;
java -Dstdout.encoding=UTF-8 -cp &quot;$CP:$D&quot; SignedHostProbe
</tspan></text>
<text x="24" y="1080" fill="#8b949e" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">cwd: /shared/codebase/clean-architecture-backend-template/src</tspan></text>
<text x="24" y="1102" fill="#8b949e" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">time: 2026-09-02T17:45:59+00:00 · exit 0</tspan></text>
<line x1="24" y1="1116" x2="1176" y2="1116" stroke="#30363d"/>
<text x="24" y="1156" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">openjdk version &quot;21.0.12&quot; 2026-07-21</tspan></text>
<text x="24" y="1178" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"></tspan></text>
<text x="24" y="1200" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">[헤더 맵 세 모양으로 같은 서버에 보낸다]</tspan></text>
<text x="24" y="1222" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 매퍼가 실제로 보내는 넷 상태 200 · 서버가 받은 Host 127.0.0.1:&lt;포트&gt;</tspan></text>
<text x="24" y="1244" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 거기에 host 를 더한 것 상태 200 · 서버가 받은 Host 127.0.0.1:&lt;포트&gt;</tspan></text>
<text x="24" y="1266" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 대문자 Host 로 더한 것 상태 200 · 서버가 받은 Host 127.0.0.1:&lt;포트&gt;</tspan></text>
<text x="24" y="1288" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 서명 대상 127.0.0.1</tspan></text>
<text x="24" y="1310" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 둘이 같은가 아니오</tspan></text>
<text x="24" y="1332" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"></tspan></text>
<text x="24" y="1354" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">[갈리는 조건 — 위 규칙을 엔드포인트마다 적용한다]</tspan></text>
<text x="24" y="1376" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 전선과 갈리면 서명이 어긋난다. 권한부는 갈려도 어긋나지 않는 자리가 있다.</tspan></text>
<text x="24" y="1398" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 엔드포인트 전선과 갈리나 권한부와 갈리나</tspan></text>
<text x="24" y="1420" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> https://email.eu-central-1.amazonaws.com 아니오 아니오</tspan></text>
<text x="24" y="1442" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> https://email.eu-central-1.amazonaws.com:8443 예 예</tspan></text>
<text x="24" y="1464" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> https://email.eu-central-1.amazonaws.com:443 아니오 예</tspan></text>
<text x="24" y="1486" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> http://127.0.0.1:80 아니오 예</tspan></text>
<text x="24" y="1508" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> https://user@email.example.com 아니오 예</tspan></text>
<text x="24" y="1530" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> http://localhost:4566 예 예</tspan></text>
</svg>