-
Notifications
You must be signed in to change notification settings - Fork 88
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
fix: add validation on data.method when using transport.request #801
fix: add validation on data.method when using transport.request #801
Conversation
Signed-off-by: SuZhoue-Joe <[email protected]>
Signed-off-by: SuZhoue-Joe <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #801 +/- ##
=======================================
Coverage 63.40% 63.40%
=======================================
Files 340 340
Lines 11540 11540
Branches 2238 2238
=======================================
Hits 7317 7317
Misses 3649 3649
Partials 574 574 |
@SuZhou-Joe , could you add a UT for it? |
server/services/CommonService.ts
Outdated
* Check valid method here | ||
*/ | ||
if (endpoint === "transport.request" && data?.method) { | ||
if (VALID_METHODS.indexOf(data.method?.toUpperCase()) === -1) { |
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.
? after data.method can be removed because it's checked for null in 65
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.
Yes, good point and modify that to catch toUpperCase in case data.method is not a string.
Signed-off-by: SuZhoue-Joe <[email protected]>
Sure, thanks for reminding. |
Signed-off-by: SuZhoue-Joe <[email protected]>
* fix: add validation on data.method when using tranport.request Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add validation on endpoint Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add unit test Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add more protect Signed-off-by: SuZhoue-Joe <[email protected]> --------- Signed-off-by: SuZhoue-Joe <[email protected]> (cherry picked from commit 13fb97f)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-801-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 13fb97fac3db5d6af6ef03b2bee8e04c80de4094
# Push it to GitHub
git push --set-upstream origin backport/backport-801-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
* fix: add validation on data.method when using tranport.request Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add validation on endpoint Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add unit test Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add more protect Signed-off-by: SuZhoue-Joe <[email protected]> --------- Signed-off-by: SuZhoue-Joe <[email protected]> (cherry picked from commit 13fb97f)
* fix: add validation on data.method when using tranport.request Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add validation on endpoint Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add unit test Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add more protect Signed-off-by: SuZhoue-Joe <[email protected]> --------- Signed-off-by: SuZhoue-Joe <[email protected]> (cherry picked from commit 13fb97f)
…search-project#801) * fix: add validation on data.method when using tranport.request Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add validation on endpoint Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add unit test Signed-off-by: SuZhoue-Joe <[email protected]> * feat: add more protect Signed-off-by: SuZhoue-Joe <[email protected]> --------- Signed-off-by: SuZhoue-Joe <[email protected]> (cherry picked from commit 13fb97f) Signed-off-by: SuZhou-Joe <[email protected]>
#803) * fix: add validation on data.method when using tranport.request * feat: add validation on endpoint * feat: add unit test * feat: add more protect --------- (cherry picked from commit 13fb97f) Signed-off-by: SuZhoue-Joe <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: suzhou <[email protected]>
Description
[Describe what this change achieves]
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.