merge: PR #22을 합친 검사 브랜치에 넣는다

This commit is contained in:
DongHyeonka
2026-11-13 07:21:13 +09:00
17 changed files with 40 additions and 46 deletions
+8 -7
View File
@@ -85,11 +85,12 @@ README의 "startup" 절에 있다.
시크릿을 어디서 읽을지(env / Vault / 클라우드 시크릿 매니저)를 인터페이스 뒤로 숨기고, 위험한
런타임 설정값은 기동 시점에 막는다.
### SecretSource
- **시크릿 해석을 인터페이스 한 겹 뒤로 숨긴 backend seam 이다.** 시크릿이 필요한 코드는 이
인터페이스에만 의존하고, 실제 백엔드(env / Vault / AWS Secrets Manager / GCP Secret Manager)는
### SecretSourcePort
- **시크릿 해석을 인터페이스 한 겹 뒤로 숨긴 backend seam 이다.** 포트는 application-core
`dev.caskeleton.application.secret`에 있다. 시크릿이 필요한 코드는 이 인터페이스에만 의존하고,
실제 백엔드(env / Vault / AWS Secrets Manager / GCP Secret Manager)는
`SecretSourceFactory`가 설정값으로 고른다. 설정과 구현 선택을 한 factory에 모으는 패턴이다.
백엔드를 추가하는 비용이 "새 `SecretSource` 구현 1개 + `SecretSourceStrategy` enum 값 1개 +
백엔드를 추가하는 비용이 "새 `SecretSourcePort` 구현 1개 + `SecretSourceStrategy` enum 값 1개 +
factory case 1개"로 고정되고, 소비자(`SecretSourceValidator`, 향후 어댑터)는 전혀 손대지 않는다.
- **빈 문자열은 "없음"으로 취급한다.** `resolve`가 blank 값을 `Optional.empty()`로 돌려주지 않으면,
"값은 존재하지만 비어 있는" 시크릿이 존재 검사(presence check)를 통과해 버려 prod 부팅을 막을 수
@@ -98,7 +99,7 @@ README의 "startup" 절에 있다.
### SecretSourceStrategy
- **enum 값 하나가 곧 백엔드 하나라는 확장 규약을 못 박는다.** `app.secret-source.strategy`로
바인딩되며 `ENVIRONMENT`만 기본 제공한다. 미래 백엔드(VAULT, AWS_SECRETS_MANAGER,
GCP_SECRET_MANAGER)는 주석으로만 남겨 두어, 추가 절차가 "enum 값 + `SecretSource` 구현 + factory
GCP_SECRET_MANAGER)는 주석으로만 남겨 두어, 추가 절차가 "enum 값 + `SecretSourcePort` 구현 + factory
case"임을 코드에서 바로 읽히게 했다(rate-limit algorithm enum 패턴과 동일).
### SecretSourceSettings
@@ -108,7 +109,7 @@ README의 "startup" 절에 있다.
### SecretSourceConfig
- **시크릿 백엔드와 그 시작 가드를 composition root 에서만 와이어링한다.** `SecretSourceFactory`로
선택된 `SecretSource`(기본 `ENVIRONMENT`)와, 그것을 통해 필수 시크릿을 검증하는
선택된 `SecretSourcePort` 구현(기본 `ENVIRONMENT`)과, 그것을 통해 필수 시크릿을 검증하는
`SecretSourceValidator`를 빈으로 노출한다. 검증기를 Spring 스테레오타입 없는 일반 클래스로 둔
이유는 단위 테스트 가능성을 지키기 위함이고, 이 config 가 유일한 production 와이어링이다.
- **`RuntimeSafetyConfig`와 일부러 분리했다.** 시크릿 계약은 secrets-config-source-contract 가
@@ -117,7 +118,7 @@ README의 "startup" 절에 있다.
### SecretSourceFactory
- **유일한 확장 지점을 `switch` 하나로 모았다.** 새 백엔드는 `SecretSourceStrategy` 값 +
`SecretSource` 구현 + 이 `switch`의 case 추가로 끝나고 소비자는 바뀌지 않는다.
`SecretSourcePort` 구현 + 이 `switch`의 case 추가로 끝나고 소비자는 바뀌지 않는다.
factory 한곳에 "확장 비용이 어디에 있는가"를 보이게 했다.
### EnvironmentSecretSource
@@ -21,7 +21,7 @@ import org.springframework.core.env.Environment;
* replay TTL, retention, codec id, policy revision — is the same whichever store holds the records,
* so it lives in one {@link IdempotencySettings} record and the executor is built here from it.
* Every composition root that serves idempotent requests takes this module rather than a copy of
* it: the application and the sample build the same executor from the same checks.
* it, so every one builds the same executor from the same checks.
*
* <p>A selected provider must yield exactly one store. None means the provider's module is not on
* the runtime classpath or its switch is off; two means something else registered one (a scan-found
@@ -32,7 +32,7 @@ import org.springframework.security.web.authentication.HttpStatusEntryPoint;
*
* <p>A composition root that deliberately wants another actuator posture declares its own bean
* named {@code actuatorSecurityFilterChain}; this one then steps aside instead of putting two
* chains with the same matcher in front of the same requests. The standalone sample does that.
* chains with the same matcher in front of the same requests.
*/
@AutoConfiguration(
before = {