Repository navigation
fix(core): reject blank URIs and empty template captures - #1117
Open
liyifan9642-creator wants to merge 1 commit into
Open
liyifan9642-creator wants to merge 1 commit into
liyifan9642-creator wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Looks good to me — approving, thanks!
Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=dbe5a7e3-0471-430e-bb7c-86cf9a27c4c1
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1085.
PathSegmentTemplateMatcher.match("")currently matches{id}withid = "", allowing a blankresources/readURI to reach a template handler.file:///report.txt.RESOURCE_NOT_FOUNDand do not invoke the template handler.No public API or tracked build configuration changes.
Verification
Before the production fix, the matcher tests failed in the two expected cases, and the new client/server regression test failed because no exception was thrown.
After the fix:
:kotlin-sdk-core:jvmTest: 258 tests passed.:integration-test:jvmTest --tests '*ServerResourceTemplateTest': 9 tests passed.:kotlin-sdk-core:ktlintCheckand:integration-test:ktlintCheck: passed.:kotlin-sdk-core:checkKotlinAbi: passed, including the multiplatform ABI comparison.git diff --check: passed.The core Detekt task completed successfully but reported 107 compiler errors during analysis, so its type-resolved analysis accuracy was limited. Local validation used an external Gradle init script to resolve plugins through a reachable mirror; dependency versions and tracked build files were unchanged.