Files
document-haness/docs/clean-architecture-backend-template/final/evidence/rendered/a10-f006-requireidentifier-branch.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

191 lines
16 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1910" viewBox="0 0 1200 1910" 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="1908" 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
D=$(mktemp -d); trap &#x27;rm -rf &quot;$D&quot;&#x27; EXIT
JAR=/shared/codebase/clean-architecture-backend-template/src/adapter/ou</tspan><tspan x="24" dy="22">tbound/cache-redis/build/libs/cache-redis-0.0.1+21234e38cdb9.jar
java -version 2&gt;&amp;1 | head -1
cat &gt; &quot;$D/IdentifierBranch</tspan><tspan x="24" dy="22">Probe.java&quot; &lt;&lt;&#x27;JAVA&#x27;
import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.key.RedisKeyRules;
import java.util.Loca</tspan><tspan x="24" dy="22">le;
import java.util.Random;
import java.util.regex.Pattern;
public final class IdentifierBranchProbe {
private stat</tspan><tspan x="24" dy="22">ic final Pattern IDENTIFIER =
Pattern.compile(&quot;^[A-Za-z0-9][A-Za-z0-9._~-]{0,127}$&quot;);
private static final Patte</tspan><tspan x="24" dy="22">rn JSON_WEB_TOKEN =
Pattern.compile(&quot;^[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}$&quot;);
private stat</tspan><tspan x="24" dy="22">ic final Pattern INTERNATIONAL_PHONE = Pattern.compile(&quot;^\\+\\d[\\d.~-]{7,}$&quot;);
private static final String[] GUARDS </tspan><tspan x="24" dy="22">= {&quot;문자클래스&quot;, &quot;메일&quot;, &quot;JWT&quot;, &quot;전화&quot;, &quot;접두&quot;};
/** Which guards a value satisfies, in source order. */
private st</tspan><tspan x="24" dy="22">atic boolean[] guards(String v) {
String low = v.toLowerCase(Locale.ROOT);
return new boolean[] {
!IDENTIF</tspan><tspan x="24" dy="22">IER.matcher(v).matches(),
v.indexOf(&#x27;@&#x27;) &gt;= 0,
JSON_WEB_TOKEN.matcher(v).matches(),
INTERNATIONAL_PHON</tspan><tspan x="24" dy="22">E.matcher(v).matches(),
low.startsWith(&quot;bearer&quot;) || low.startsWith(&quot;eyj&quot;),
};
}
/** The message the first</tspan><tspan x="24" dy="22"> satisfied guard would produce. */
private static String predict(String v) {
boolean[] hit = guards(v);
if (hi</tspan><tspan x="24" dy="22">t[0]) {
return &quot;identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not contain a&quot;
+ &quot; key </tspan><tspan x="24" dy="22">separator&quot;;
}
if (hit[1]) {
return &quot;identifier must not contain a mail address&quot;;
}
if (hit[2]) {
</tspan><tspan x="24" dy="22"> return &quot;identifier must not contain a JSON web token&quot;;
}
if (hit[3]) {
return &quot;identifier must not co</tspan><tspan x="24" dy="22">ntain a phone number&quot;;
}
if (hit[4]) {
return &quot;identifier must not contain authentication material&quot;;
}</tspan><tspan x="24" dy="22">
return &quot;통과&quot;;
}
private static String actual(String v) {
try {
RedisKeyRules.requireIdentifier(v);
</tspan><tspan x="24" dy="22"> return &quot;통과&quot;;
} catch (IllegalArgumentException e) {
return e.getMessage();
}
}
private static</tspan><tspan x="24" dy="22"> void run(String label, String v) {
boolean[] hit = guards(v);
StringBuilder marks = new StringBuilder();
fo</tspan><tspan x="24" dy="22">r (int i = 0; i &lt; GUARDS.length; i++) {
marks.append(hit[i] ? GUARDS[i] : &quot; &quot;.repeat(GUARDS[i].length())).append(&#x27;</tspan><tspan x="24" dy="22"> &#x27;);
}
System.out.printf(&quot;%-16s %-4d %s| %s%n&quot;, label, v.length(), marks, actual(v));
}
public static void </tspan><tspan x="24" dy="22">main(String[] args) {
String jwtHead = &quot;eyJhbGciOiJIUzI1NiJ9&quot;;
String longJwt = jwtHead + &quot;.&quot; + &quot;a&quot;.repeat(120) </tspan><tspan x="24" dy="22">+ &quot;.&quot; + &quot;b&quot;.repeat(96);
System.out.println(&quot;입력 길이 걸리는 검사 전부 | requireId</tspan><tspan x="24" dy="22">entifier 가 낸 메시지&quot;);
System.out.println(&quot;-&quot;.repeat(122));
run(&quot;test: 메일&quot;, &quot;person@example.com&quot;);
run(&quot;</tspan><tspan x="24" dy="22">test: 전화&quot;, &quot;+821012345678&quot;);
run(&quot;test: eyj&quot;, jwtHead);
run(&quot;test: bearer&quot;, &quot;bearer-abcdefabcdef&quot;);
run(&quot;t</tspan><tspan x="24" dy="22">est: JWT&quot;, jwtHead + &quot;.eyJzdWIiOiIxIn0.c2lnbmF0dXJlLXZhbHVl&quot;);
run(&quot;test: 129자&quot;, &quot;a&quot;.repeat(129));
System.out.p</tspan><tspan x="24" dy="22">rintln();
System.out.println(&quot;JWT 분기만 걸리는 값이 있는가&quot;);
run(&quot;합성 JWT 26자&quot;, &quot;abcdefgh.abcdefgh.abcdefgh&quot;</tspan><tspan x="24" dy="22">);
run(&quot;_로 시작&quot;, &quot;_bcdefgh.abcdefgh.abcdefgh&quot;);
run(&quot;실제 크기 JWT&quot;, longJwt);
System.out.println();
S</tspan><tspan x="24" dy="22">ystem.out.println(&quot;메일과 전화 분기만 걸리는 값이 있는가&quot;);
System.out.println(&quot; 메일 분기는 &#x27;@&#x27; 를 요구한다 -&gt; I</tspan><tspan x="24" dy="22">DENTIFIER 문자 클래스에 &#x27;@&#x27; 없음&quot;);
System.out.println(&quot; 전화 분기는 &#x27;+&#x27; 로 시작한다 -&gt; IDENTIFIER 첫 문자는 [A-Z</tspan><tspan x="24" dy="22">a-z0-9]&quot;);
System.out.println();
System.out.println(&quot;옮겨 적은 정규식이 실제와 같은지 무작위 입력으로 대조한다.&quot;</tspan><tspan x="24" dy="22">);
selfCheck(200_000);
}
private static void selfCheck(int rounds) {
String alphabet = &quot;abcdefghjrzABZ09._~</tspan><tspan x="24" dy="22">-@+:{} eyj.&quot;;
Random random = new Random(20260902L);
int agreed = 0;
int[] firstGuard = new int[GUARDS.lengt</tspan><tspan x="24" dy="22">h + 1];
for (int i = 0; i &lt; rounds; i++) {
int length = 1 + random.nextInt(200);
StringBuilder b = new S</tspan><tspan x="24" dy="22">tringBuilder(length);
for (int j = 0; j &lt; length; j++) {
b.append(alphabet.charAt(random.nextInt(alphabet.</tspan><tspan x="24" dy="22">length())));
}
// Half the draws start from a token shape so the later guards are reachable.
String va</tspan><tspan x="24" dy="22">lue = (i % 2 == 0) ? b.toString() : seeded(random, b.toString());
if (actual(value).equals(predict(value))) {
</tspan><tspan x="24" dy="22"> agreed++;
}
boolean[] hit = guards(value);
int landed = GUARDS.length;
for (int g = 0; g &lt; G</tspan><tspan x="24" dy="22">UARDS.length; g++) {
if (hit[g]) {
landed = g;
break;
}
}
firstGuard[lan</tspan><tspan x="24" dy="22">ded]++;
}
System.out.printf(&quot; %d / %d 일치%n&quot;, agreed, rounds);
for (int g = 0; g &lt; GUARDS.length; g++) {
</tspan><tspan x="24" dy="22"> System.out.printf(&quot; %-10s 에서 갈린 입력 %d%n&quot;, GUARDS[g], firstGuard[g]);
}
System.out.printf(&quot; %-10</tspan><tspan x="24" dy="22">s %d%n&quot;, &quot;통과&quot;, firstGuard[GUARDS.length]);
}
/** A value shaped like something the later guards could match. */
</tspan><tspan x="24" dy="22"> private static String seeded(Random random, String tail) {
String core = tail.replaceAll(&quot;[^A-Za-z0-9_-]&quot;, &quot;a&quot;);
</tspan><tspan x="24" dy="22"> return switch (random.nextInt(4)) {
case 0 -&gt; &quot;eyj&quot; + core;
case 1 -&gt; &quot;bearer&quot; + core;
case 2 -&gt; &quot;+8</tspan><tspan x="24" dy="22">210&quot; + core.replaceAll(&quot;\\D&quot;, &quot;1&quot;);
default -&gt; {
String seg = (core + &quot;abcdefgh&quot;).substring(0, 8);
</tspan><tspan x="24" dy="22"> yield seg + &quot;.&quot; + seg + &quot;.&quot; + seg;
}
};
}
}
JAVA
javac -encoding UTF-8 -cp &quot;$JAR&quot; -d &quot;$D&quot; &quot;$D/IdentifierBra</tspan><tspan x="24" dy="22">nchProbe.java&quot;
java -Dstdout.encoding=UTF-8 -cp &quot;$JAR:$D&quot; IdentifierBranchProbe
</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">cwd: /shared/codebase/clean-architecture-backend-template</tspan></text>
<text x="24" y="1124" 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-02T12:55:51+00:00 · exit 0</tspan></text>
<line x1="24" y1="1138" x2="1176" y2="1138" stroke="#30363d"/>
<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">openjdk version &quot;21.0.12&quot; 2026-07-21</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">입력 길이 걸리는 검사 전부 | requireIdentifier 가 낸 메시지</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">--------------------------------------------------------------------------------------------------------------------------</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">test: 메일 18 문자클래스 메일 | identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not contain</tspan><tspan x="24" dy="22"> a key separator</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">test: 전화 13 문자클래스 전화 | identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not contain</tspan><tspan x="24" dy="22"> a key separator</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">test: eyj 20 접두 | identifier must not contain authentication material</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">test: bearer 19 접두 | identifier must not contain authentication material</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">test: JWT 57 JWT 접두 | identifier must not contain a JSON web token</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">test: 129자 129 문자클래스 | identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not contain a </tspan><tspan x="24" dy="22">key separator</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"></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">JWT 분기만 걸리는 값이 있는가</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">합성 JWT 26자 26 JWT | identifier must not contain a JSON web token</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">_로 시작 26 문자클래스 JWT | identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not contain </tspan><tspan x="24" dy="22">a key separator</tspan></text>
<text x="24" y="1552" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">실제 크기 JWT 238 문자클래스 JWT 접두 | identifier must be 1..128 characters of [A-Za-z0-9._~-] and must not conta</tspan><tspan x="24" dy="22">in a key separator</tspan></text>
<text x="24" y="1596" 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="1618" 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="1640" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 메일 분기는 &#x27;@&#x27; 를 요구한다 -&gt; IDENTIFIER 문자 클래스에 &#x27;@&#x27; 없음</tspan></text>
<text x="24" y="1662" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 전화 분기는 &#x27;+&#x27; 로 시작한다 -&gt; IDENTIFIER 첫 문자는 [A-Za-z0-9]</tspan></text>
<text x="24" y="1684" 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="1706" 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="1728" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 200000 / 200000 일치</tspan></text>
<text x="24" y="1750" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 문자클래스 에서 갈린 입력 144166</tspan></text>
<text x="24" y="1772" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 메일 에서 갈린 입력 0</tspan></text>
<text x="24" y="1794" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> JWT 에서 갈린 입력 23462</tspan></text>
<text x="24" y="1816" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 전화 에서 갈린 입력 0</tspan></text>
<text x="24" y="1838" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 접두 에서 갈린 입력 30843</tspan></text>
<text x="24" y="1860" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 통과 1529</tspan></text>
</svg>