-
Notifications
You must be signed in to change notification settings - Fork 726
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
server: add Self Protection mechanism #4466
Conversation
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
… in last commit Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
@@ Coverage Diff @@
## master #4466 +/- ##
==========================================
- Coverage 74.96% 74.40% -0.57%
==========================================
Files 264 266 +2
Lines 27796 28013 +217
==========================================
+ Hits 20837 20842 +5
- Misses 5115 5312 +197
- Partials 1844 1859 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
server/api/server.go
Outdated
@@ -37,6 +37,7 @@ func NewHandler(ctx context.Context, svr *server.Server) (http.Handler, server.S | |||
router.PathPrefix(apiPrefix).Handler(negroni.New( | |||
serverapi.NewRuntimeServiceValidator(svr, group), | |||
serverapi.NewRedirector(svr), | |||
svr.SelfProtectionHandler, |
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.
seem we need negroni.Handler
.
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@@ -200,3 +200,12 @@ | |||
|
|||
## When enabled, usage data will be sent to PingCAP for improving user experience. | |||
# enable-telemetry = true | |||
|
|||
[self-protection] |
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.
Consider a better name? For example [middleware]
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package middleware |
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.
better move to pkg
?
close this PR to change spliting small PRs |
What problem does this PR solve?
This PR is used for fix #4373 including add audit logger and rate limiter for HTTP API
(close #4207, #2971, #3111, #3383)
This PR is split to three small ones:
- self protection framework #4469
- implement QPS rate limiter and Audit logger #4470
- add config #4471
What is changed and how it works?
SelfProtectionHandler
which implement http.Handler and has method to add gRPC interceptorSelfProtectionHandler
SelfProtectionHandler
middleware in serverCheck List
Tests
Code changes
Side effects
Release note
To be written