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>
47 lines
3.3 KiB
Markdown
47 lines
3.3 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: adapter-outbound-objectstorage-c09
|
|
title: 경로 방어는 세그먼트마다, 발행은 배타적 하드링크로
|
|
topic: identity-and-value-contracts
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:adapter-outbound-objectstorage-c09
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: adapter-outbound-objectstorage-c09
|
|
file: ../../../final/evidence/rendered/adapter-outbound-objectstorage-c09.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/adapter-outbound-objectstorage-c09.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/09-adapter-outbound-objectstorage.md#L601 이다.
|
|
module: adapter-outbound-objectstorage
|
|
---
|
|
|
|
# 경로 방어는 세그먼트마다, 발행은 배타적 하드링크로
|
|
|
|
`LocalObjectPathGuard`는 부모 경로를 root부터 한 세그먼트씩 내려가며 심링크와 비디렉터리를 거부한다. 발행은 `Files.createLink`가 주는 배타성에 기대고, 하드링크를 지원하지 않는 파일시스템에서 조용히 약한 방식으로 내려가지 않는다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
`LocalObjectPathGuard`는 이 저장소에서 반복해 본 강한 형태다 — root 정규화 + `startsWith` 봉쇄 + root 자신 거부에 더해, 부모 경로를 **root부터 한 세그먼트씩 내려가며** 심링크와 비디렉터리를 거부하고(`createParentsWithoutLinks` / `rejectExistingLinks`), 대상 자신도 심링크면 거부한다. control key는 `control/v1/` 접두사 + `[a-z0-9._/-]+` + `//`·`/./`·`/../` 금지 + 세그먼트별 재검사다.
|
|
|
|
그리고 control 레코드는 물리 파일명에 `.record`를 붙인다 — 객체 저장소가 허용하는 `reference`와 `reference/lifecycle` 쌍이 파일시스템에서 파일/디렉터리 충돌을 일으키지 않도록. 논리 키는 그대로 유지된다.
|
|
|
|
## LocalObjectPathGuard 참조 위치
|
|
|
|
:::evidence key="adapter-outbound-objectstorage-c09" alt="코드베이스에서 LocalObjectPathGuard 를 검색한 출력 14줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="LocalObjectPathGuard 코드베이스 검색 — 14줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 발행이 배타적 하드링크인 이유
|
|
|
|
`LocalDevObjectDataStore.create`가 임시 파일에 쓰고 `channel.force(true)` 후 `Files.createLink(target, temporary)`를 하며, `FileAlreadyExistsException`을 `CONFLICT`로, `UnsupportedOperationException`을 "local filesystem cannot prove immutable create"로 번역한다 — 하드링크를 지원하지 않는 파일시스템에서 조용히 약한 방식으로 내려가지 않는다. 앞선 `Files.exists(NOFOLLOW)` 검사는 빠른 경로일 뿐이고 배타성은 `createLink`가 준다. POSIX면 소유자 읽기 전용 권한을 씌운다.
|
|
|
|
## 테스트 이름이 잡는 여섯 가지
|
|
|
|
`traversalAbsoluteUnicodePercentAndSymlinkEscapesAreRejected`, `exclusiveCreateRaceHasOneWinner`, `injectedDiskFailureLeavesNoFinalOrTemporaryData`, `restartInspectsCommittedDataWithoutReplayingProducer`, `corruptControlRecordRemainsPresentAndNeverAppearsAbsent`, `createsRestrictivePermissionsWherePosixIsSupported`. 마지막에서 두 번째가 특히 이 leaf의 규칙이다 — 손상된 control 레코드는 **부재로 보이지 않는다**.
|
|
|
|
<!-- body:end -->
|