-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Enforces topic and pubsubName for publishing events. #2091
Conversation
/ok-to-test-windows |
Found the available test cluster - dapr-aks-e2e-06 for linux. Please check the build status. |
Codecov Report
@@ Coverage Diff @@
## master #2091 +/- ##
==========================================
+ Coverage 43.81% 44.46% +0.65%
==========================================
Files 69 69
Lines 6028 6041 +13
==========================================
+ Hits 2641 2686 +45
+ Misses 3163 3123 -40
- Partials 224 232 +8
Continue to review full report at Codecov.
|
pkg/http/api.go
Outdated
@@ -179,7 +179,7 @@ func (a *api) constructPubSubEndpoints() []Endpoint { | |||
return []Endpoint{ | |||
{ | |||
Methods: []string{fasthttp.MethodPost, fasthttp.MethodPut}, | |||
Route: "publish/{pubsubname}/{topic:*}", | |||
Route: "publish/{pubsubname}/{topic}", |
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.
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.
Well. This fixed the bug. Users should provide encoded / in http. It is one of those %something type of encoding.
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.
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.
You are correct, this needs to be reverted back. It breaks the complex topic feature.
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.
Let me take another look at it. There is another way to fix it.
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.
That check was only in the GRPC API. For HTTP, I tried to solve via the route setting.
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.
Correct, our code was already validating the presence of component, we were just missing the check on nil topic which can result from trailing slash on publish POST for example. this LGTM
So :*
is just for trailling slash? then this fix will be fine.
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.
No, * is not for trailing slash. The change needs to be reverted to include *.
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.
Put it back and added more unit tests for the HTTP route to make sure this bug does not come back when someone messes with the HTTP route again.
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.
+1 unittest
End-to-end tests failed on linux. Please check the build logs |
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.
/lgtm
fbabf0a
to
f482a52
Compare
f482a52
to
c348d93
Compare
/ok-to-test |
Found the available test cluster - dapr-aks-e2e-05 for linux. Please check the build status. |
Congrats! All end-to-end tests have passed on linux. Thanks for your contribution! |
Description
Enforces topic and pubsubName for publishing events.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #2061
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: