mirror of https://github.com/grpc/grpc.git
[server-fuzzer] Add a fuzzer that uses the fake creds library to hit some security codepaths (#37395)
Also fix some buffer overruns/underruns in our fake creds implementation.
@jboeuf
Closes #37395
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37395 from ctiller:renegade-chicken fd835bcd38
PiperOrigin-RevId: 659600701
pull/37400/head
parent
a35ce3d68c
commit
781fcf9d10
5 changed files with 59 additions and 6 deletions
@ -0,0 +1,30 @@ |
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <grpc/credentials.h> |
||||
#include <grpc/grpc_security.h> |
||||
|
||||
#include "src/core/lib/security/credentials/fake/fake_credentials.h" |
||||
#include "src/libfuzzer/libfuzzer_macro.h" |
||||
#include "test/core/end2end/fuzzers/server_fuzzer.h" |
||||
|
||||
DEFINE_PROTO_FUZZER(const fuzzer_input::Msg& msg) { |
||||
grpc_core::RunServerFuzzer(msg, [](grpc_server* server, int port_num, |
||||
const grpc_core::ChannelArgs&) { |
||||
auto* creds = grpc_fake_transport_security_server_credentials_create(); |
||||
grpc_server_add_http2_port( |
||||
server, absl::StrCat("0.0.0.0:", port_num).c_str(), creds); |
||||
grpc_server_credentials_release(creds); |
||||
}); |
||||
} |
Loading…
Reference in new issue