Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/schema-and-wire-models/concept/concept-adapter-outbound-fileserver-c02.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

51 lines
2.9 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-fileserver-c02
title: 파싱은 되지만 우리가 쓰지 않았을 형태를 전부 거부한다
topic: schema-and-wire-models
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-fileserver-c02
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-fileserver-c02
file: ../../../final/evidence/rendered/adapter-outbound-fileserver-c02.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-fileserver-c02.txt
source:
- 원본 분석 절은 analysis/08-adapter-outbound-fileserver.md#L168 이다.
module: adapter-outbound-fileserver
---
# 파싱은 되지만 우리가 쓰지 않았을 형태를 전부 거부한다
`FileserverControlRecordCodec`이 decode 직후 재encode해 바이트를 비교한다(`requireCanonical(bytes, encodeOperation(record))`).
## 본문
<!-- body:start -->
`FileserverControlRecordCodec`은 세 레코드와 receipt snapshot에 대해 **decode 직후 재encode해 바이트를 비교**한다(`requireCanonical(bytes, encodeOperation(record))`). 그래서 "파싱은 되지만 우리가 쓰지 않았을 형태"가 전부 거부된다 — 공백, 필드 재배열, 이스케이프, `-0`·선행 0 같은 숫자 표기, 후행 콘텐츠.
## FileserverControlRecordCodec 참조 위치
:::evidence key="adapter-outbound-fileserver-c02" alt="코드베이스에서 FileserverControlRecordCodec 를 검색한 출력 12줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="FileserverControlRecordCodec 코드베이스 검색 — 12줄 · exit 0" zoom="true"
:::
## 파서 자체도 좁다
- 필드 집합을 **정확히 일치**시킨다(`values.keySet().equals(allowedFields)`) — 누락도 미지 필드도 거부
- 중복 키를 거부한다(`putIfAbsent`)
- UTF-8 디코딩이 `REPORT` 모드라 malformed 바이트가 대체문자로 조용히 바뀌지 않는다
- `\b \f \n \r \t` 이스케이프를 **문법 수준에서 거부**한다("control characters are forbidden")
- 짝 없는 서로게이트를 거부한다(`requireWellFormedUnicode`)
- `Instant.parse``result.toString().equals(value)`로 **canonical UTC 표기**만 받는다
- receipt snapshot은 `rsv1.` 접두사 + unpadded base64url이고, 디코딩 후 **재인코딩 문자열 비교**로 alias(후행 비트가 0이 아닌 변형)를 거부한다
## 오버플로가 상한 검사를 무력화하지 못한다
`requireFormulaCountWithinCells``rowCount * columnCount` 곱을 하기 전에 `rowCount <= Long.MAX_VALUE / columnCount`를 먼저 본다. test가 그 하나하나를 이름으로 고정한다 — `canonicalDecoderRejectsWhitespaceReorderingEscapesNumbersUtf8AndTrailingContent`, `receiptSnapshotRejectsBase64urlAliasWithNonZeroTrailingBits`, `canonicalCodecRoundTripsSupplementaryUnicodeInOpaqueText`, `formulaMitigationCountCannotExceedCellsAndUsesOverflowSafeBounds`.
<!-- body:end -->