Files
document-haness/docs/clean-architecture-backend-template/final/evidence/rendered/a13-f003-accesscontext-reveal.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

119 lines
10 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1294" viewBox="0 0 1200 1294" 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="1292" 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
CORE=$C/src/application-core
java -version 2&gt;&amp;1 | head -1
CP=$(find &quot;$N/build/lib</tspan><tspan x="24" dy="22">s&quot; &quot;$CORE/build/libs&quot; -name &quot;*+21234e38cdb9.jar&quot; 2&gt;/dev/null | tr &#x27;\n&#x27; &#x27;:&#x27;)
cat &gt; &quot;$D/AccessContextProbe.java&quot; &lt;&lt;&#x27;JAVA&#x27;
</tspan><tspan x="24" dy="22">import dev.caskeleton.adapter.outbound.notification.platform.security.AesGcmContactPointProtector;
import dev.caskeleton</tspan><tspan x="24" dy="22">.application.notification.platform.contact.ContactPointValue;
import dev.caskeleton.application.notification.platform.co</tspan><tspan x="24" dy="22">ntact.EmailAddress;
import dev.caskeleton.application.notification.platform.security.AccessContext;
import dev.caskeleto</tspan><tspan x="24" dy="22">n.application.notification.platform.security.ProtectedContactPoint;
import dev.caskeleton.application.notification.platf</tspan><tspan x="24" dy="22">orm.security.SecretKeyMaterial;
import dev.caskeleton.application.notification.platform.security.SecretMaterialProvider;</tspan><tspan x="24" dy="22">
import dev.caskeleton.application.notification.platform.security.SecretPurpose;
import java.lang.reflect.Constructor;
i</tspan><tspan x="24" dy="22">mport java.lang.reflect.Field;
import java.util.Arrays;
public final class AccessContextProbe {
/** Deterministic ma</tspan><tspan x="24" dy="22">terial; the probe only needs the round trip to work. */
private static final SecretMaterialProvider KEYS =
new S</tspan><tspan x="24" dy="22">ecretMaterialProvider() {
@Override
public SecretKeyMaterial activeKey(SecretPurpose purpose) {
</tspan><tspan x="24" dy="22"> return material(purpose);
}
@Override
public SecretKeyMaterial keyById(String keyId) {
</tspan><tspan x="24" dy="22"> return material(
keyId.startsWith(&quot;mac&quot;) ? SecretPurpose.CONTACT_LOOKUP_HMAC
</tspan><tspan x="24" dy="22"> : SecretPurpose.CONTACT_ENCRYPTION);
}
private SecretKeyMaterial material(SecretPurpose pu</tspan><tspan x="24" dy="22">rpose) {
boolean hmac = purpose == SecretPurpose.CONTACT_LOOKUP_HMAC;
byte[] bytes = new byte[32];
</tspan><tspan x="24" dy="22"> Arrays.fill(bytes, hmac ? (byte) 0x22 : (byte) 0x11);
return new SecretKeyMaterial(hmac ? &quot;mac-1&quot; : &quot;</tspan><tspan x="24" dy="22">enc-1&quot;, purpose, bytes);
}
};
public static void main(String[] args) throws Exception {
AesGcmConta</tspan><tspan x="24" dy="22">ctPointProtector protector = new AesGcmContactPointProtector(KEYS);
ProtectedContactPoint stored = protector.protect</tspan><tspan x="24" dy="22">(EmailAddress.parse(&quot;user@example.com&quot;));
System.out.println(&quot;[문맥을 바꿔 가며 같은 값을 복호화한다]&quot;);
Access</tspan><tspan x="24" dy="22">Context[] contexts = {
AccessContext.dispatch(&quot;ses-primary&quot;),
new AccessContext(&quot;BREAK_GLASS&quot;, &quot;operator@exa</tspan><tspan x="24" dy="22">mple.com&quot;, true),
new AccessContext(&quot;SUPPORT_LOOKUP&quot;, &quot;agent-42&quot;, true),
};
for (AccessContext context : c</tspan><tspan x="24" dy="22">ontexts) {
ContactPointValue revealed = protector.reveal(stored, context);
System.out.printf(
&quot; p</tspan><tspan x="24" dy="22">urposeCode=%-14s auditRequired=%-5s -&gt; %s%n&quot;,
context.purposeCode(), context.auditRequired(), revealed.getClas</tspan><tspan x="24" dy="22">s().getSimpleName());
}
System.out.println();
System.out.println(&quot;[복호화기가 들고 있는 협력자]&quot;);
for </tspan><tspan x="24" dy="22">(Constructor&lt;?&gt; constructor : AesGcmContactPointProtector.class.getDeclaredConstructors()) {
System.out.printf(&quot; </tspan><tspan x="24" dy="22">생성자 인자 : %s%n&quot;,
Arrays.toString(Arrays.stream(constructor.getParameterTypes())
.map(Class::</tspan><tspan x="24" dy="22">getSimpleName).toArray()));
}
for (Field field : AesGcmContactPointProtector.class.getDeclaredFields()) {
</tspan><tspan x="24" dy="22">if (!field.getType().isPrimitive() &amp;&amp; !field.getName().startsWith(&quot;$&quot;)) {
System.out.printf(&quot; 필드 %-10s : %s%n</tspan><tspan x="24" dy="22">&quot;, field.getName(), field.getType().getSimpleName());
}
}
System.out.println();
System.out.println(&quot;[</tspan><tspan x="24" dy="22">dispatch 팩토리가 정하는 값]&quot;);
AccessContext dispatch = AccessContext.dispatch(&quot;ses-primary&quot;);
System.out.print</tspan><tspan x="24" dy="22">f(&quot; purposeCode=%s actorRef=%s auditRequired=%s%n&quot;,
dispatch.purposeCode(), dispatch.actorRef(), dispatch.aud</tspan><tspan x="24" dy="22">itRequired());
}
}
JAVA
javac -encoding UTF-8 -cp &quot;$CP&quot; -d &quot;$D&quot; &quot;$D/AccessContextProbe.java&quot;
java -Dstdout.encoding=UT</tspan><tspan x="24" dy="22">F-8 -cp &quot;$CP$D&quot; AccessContextProbe
</tspan></text>
<text x="24" y="816" 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="838" 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-02T14:58:28+00:00 · exit 0</tspan></text>
<line x1="24" y1="852" x2="1176" y2="852" stroke="#30363d"/>
<text x="24" y="892" 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="914" 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="936" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> purposeCode=DISPATCH auditRequired=false -&gt; EmailAddress</tspan></text>
<text x="24" y="958" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> purposeCode=BREAK_GLASS auditRequired=true -&gt; EmailAddress</tspan></text>
<text x="24" y="980" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> purposeCode=SUPPORT_LOOKUP auditRequired=true -&gt; EmailAddress</tspan></text>
<text x="24" y="1002" 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="1024" 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="1046" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 생성자 인자 : [SecretMaterialProvider]</tspan></text>
<text x="24" y="1068" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 생성자 인자 : [SecretMaterialProvider, SecureRandom]</tspan></text>
<text x="24" y="1090" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 필드 CIPHER : String</tspan></text>
<text x="24" y="1112" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 필드 HMAC : String</tspan></text>
<text x="24" y="1134" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"> 필드 KEY_ALGORITHM : String</tspan></text>
<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"> 필드 keys : SecretMaterialProvider</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"> 필드 random : SecureRandom</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">[dispatch 팩토리가 정하는 값]</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"> purposeCode=DISPATCH actorRef=ses-primary auditRequired=false</tspan></text>
</svg>