-
Notifications
You must be signed in to change notification settings - Fork 1
fix(kms): auto-append /prpc to onboard source_url #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,8 +77,13 @@ impl OnboardRpc for OnboardHandler { | |
| } | ||
|
|
||
| async fn onboard(self, request: OnboardRequest) -> Result<OnboardResponse> { | ||
| let source_url = if request.source_url.ends_with("/prpc") { | ||
| request.source_url.clone() | ||
| } else { | ||
| format!("{}/prpc", request.source_url.trim_end_matches('/')) | ||
| }; | ||
|
Comment on lines
+80
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The URL normalization logic incorrectly handles a Suggested FixReverse the order of operations in the URL normalization logic. First, call Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| let keys = Keys::onboard( | ||
| &request.source_url, | ||
| &source_url, | ||
| &request.domain, | ||
| self.state.config.onboard.quote_enabled, | ||
| self.state.config.pccs_url.clone(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: URL normalization incorrectly appends a duplicate
/prpcsuffix if the input URL already ends with/prpc/, causing downstream requests to fail.Severity: MEDIUM
Suggested Fix
The normalization logic should be adjusted to correctly handle URLs with a trailing slash. A robust approach is to first trim any trailing slashes from
request.source_url, and then check if the resulting string ends with/prpcbefore conditionally appending it. This ensures that inputs like.../prpc/are correctly normalized to.../prpc.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.