This repository was archived by the owner on Jun 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
fix(kms): auto-append /prpc to onboard source_url #8
Closed
kvinwang
wants to merge
1
commit into
Phala-Network:master
from
kvinwang:fix/onboard-source-url-normalize
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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(), | ||
|
|
||
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.
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.