fix(config): reject blank Config Server repository authority - #327
fix(config): reject blank Config Server repository authority#327seonghobae wants to merge 13 commits into
Conversation
Removing the demo Git default is not fail-closed: Spring Cloud Config 5.0.4 still starts with an unset or empty CONFIG_REPO_URI. Validate destination authority at default-profile startup and keep native fixtures independently startable. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📝 WalkthroughWalkthroughConfig Server의 기본 Git 프로필에서 데모 저장소 fallback을 제거했습니다. ChangesConfig Server 저장소 권한
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to When the default and native profiles are combined, repository validation can be bypassed and the service may start without a repository authority; one live test is also sensitive to the caller’s environment. These bounded correctness and verification risks should be addressed or explicitly accepted before merging. Sequence Diagram(s)sequenceDiagram
participant Startup as Spring Boot Config Server 시작
participant Validator as ConfigServerRepositoryAuthorityValidator
participant Authority as ConfigServerRepositoryAuthority
participant GitBackend as Config Server Git backend
Startup->>Validator: afterPropertiesSet() 호출
Validator->>Authority: requireExplicitRepository(repositoryUri) 호출
Authority-->>Validator: 검증 결과 또는 IllegalStateException 반환
Validator-->>Startup: 시작 계속 또는 시작 실패
Startup->>GitBackend: CONFIG_REPO_URI로 Git backend 초기화
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| String repositoryUri; | ||
| try { | ||
| repositoryUri = environment.getProperty(REPOSITORY_URI_PROPERTY); | ||
| } catch (IllegalArgumentException unresolvedPlaceholder) { | ||
| throw new IllegalStateException( | ||
| ConfigServerRepositoryAuthority.MISSING_AUTHORITY_MESSAGE, | ||
| unresolvedPlaceholder | ||
| ); | ||
| } | ||
| ConfigServerRepositoryAuthority.requireExplicitRepository(repositoryUri); |
There was a problem hiding this comment.
📝 Info: Only the top-level git URI is validated
requireExplicitRepository inspects only spring.cloud.config.server.git.uri. A composite backend or named repos (...git.repos.<name>.uri) with a blank top-level URI would fail closed despite being validly configured. Outside the default single-URI setup this constrains future config shapes.
Was this helpful? React with 👍 or 👎 to provide feedback.
Port #327 live isolation and native-only composition into #328 without dropping demo, template, Unicode, or SCP matching. Unset CONFIG_REPO_URI now fails with the finite authority message after systemEnvironment is removed, and mixed native profiles cannot skip Git destination checks. Verified: ./mvnw -B -pl config-server -am test (Temurin 25, 19 tests).
What changed
Default-profile Config Server now rejects unset, blank, unresolved, and demo
CONFIG_REPO_URIvalues at startup. The YAML token stays${CONFIG_REPO_URI}with no demo remote. Thenativefixture profile still starts without a Git remote.Why this change
PR #322 removed
https://github.com/your-repo/config-repo.gitbut did not fail closed. Local./mvnw -B -pl config-server teston50ddcc0showed unset and blankCONFIG_REPO_URIstarting Tomcat. Spring Cloud Config 5.0.4 accepts a non-null empty URI whencloneOnStartis false.Risk and rollout notes
CONFIG_REPO_URIto a reviewed Git URI before starting the default profile. Usenativeonly for local fixtures.File-level intent and rationale
ConfigServerRepositoryAuthority.javaConfigServerRepositoryAuthorityValidator.java@Profile("!native")application.ymlCONFIG_REPO_URIConfigServerRepositoryAuthorityLiveTest.javaserver.port=0docs/doctoring/config-server-repository-authority.mdactive_pruntil developTest evidence
./mvnw -B -pl config-server testwith Temurin 25.0.4CONFIG_REPO_URI.Merge-gate evidence
50ddcc0. After this head is accepted, close fix(config): require explicit Config Server repository authority #189 and fix(config): require explicit Config Server repository authority #322 as superseded.Security checklist
Reviewer focus areas
CONFIG_REPO_URIstop the default profile before JGit runs.nativefixtures still start without a remote.Summary by CodeRabbit
새 기능
native프로필을 지원합니다.문서
테스트