From: Andrei Pavel Date: Wed, 22 Apr 2026 09:12:31 +0000 (+0200) Subject: [#4272] Remove fuzz_agent; CA was removed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad099bf775c7263b2604dda0db5a2eb52bda9f52;p=thirdparty%2Fkea.git [#4272] Remove fuzz_agent; CA was removed --- diff --git a/src/fuzz/build.sh b/src/fuzz/build.sh index 49860e6ec6..a5198db9b4 100755 --- a/src/fuzz/build.sh +++ b/src/fuzz/build.sh @@ -62,7 +62,7 @@ LIBS="-lpthread -ldl -lm -lc++ -lc++abi -lssl -lcrypto -lkrb5 -lgssapi_krb5" export CXXFLAGS="${CXXFLAGS} -std=c++17 -stdlib=libc++ -Wno-unused-parameter -Wno-unused-value" # Build non-dhcp specific fuzzers -for fuzzer in fuzz_cc fuzz_d2 fuzz_agent fuzz_util fuzz_dhcpsrv fuzz_dhcpsrv_csv_lease fuzz_dns fuzz_encode fuzz_cryptolink +for fuzzer in fuzz_cc fuzz_d2 fuzz_util fuzz_dhcpsrv fuzz_dhcpsrv_csv_lease fuzz_dns fuzz_encode fuzz_cryptolink do extra_lib="" case "$fuzzer" in fuzz_hook_tsig) @@ -182,7 +182,7 @@ done # Prepare maximum size option for configuration parsing related fuzzers for fuzzer in fuzz_eval4 fuzz_eval6 fuzz_dhcp_parser4 fuzz_dhcp_parser6 \ - fuzz_dhcp_pkt4 fuzz_dhcp_pkt6 fuzz_cc fuzz_d2 fuzz_agent \ + fuzz_dhcp_pkt4 fuzz_dhcp_pkt6 fuzz_cc fuzz_d2 \ fuzz_config_kea_dhcp4 fuzz_config_kea_dhcp6 do printf '[libfuzzer]\nmax_len=25600\n' > "${OUT}/${fuzzer}.options" @@ -192,5 +192,4 @@ done zip -j "${OUT}/fuzz_dhcpsrv_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json zip -j "${OUT}/fuzz_dhcp_parser4_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json zip -j "${OUT}/fuzz_dhcp_parser6_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json -zip -j "${OUT}/fuzz_agent_seed_corpus.zip" "${SRC}/kea/src/bin/agent/tests/testdata"/*.json zip -j "${OUT}/fuzz_d2_seed_corpus.zip" "${SRC}/kea/src/bin/d2/tests/testdata"/*.json diff --git a/src/fuzz/fuzz_agent.cc b/src/fuzz/fuzz_agent.cc deleted file mode 100644 index 1da4c2850e..0000000000 --- a/src/fuzz/fuzz_agent.cc +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2026 Internet Systems Consortium, Inc. ("ISC") -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. -//////////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2025 Ada Logics Ltd. -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. -//////////////////////////////////////////////////////////////////////////////// -#include "config.h" -#include - -#include -#include -#include - -#include -#include - -#include -#include - -using namespace isc::agent; -using namespace isc::data; - -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - FuzzedDataProvider fdp(data, size); - bool checkOnly = fdp.ConsumeBool(); - - AgentSimpleParser simpleParser; - CtrlAgentCfgContextPtr ctxPtr(new CtrlAgentCfgContext()); - ParserContext ctx; - ElementPtr elem; - - // Generate random parsing mode - const uint8_t mode = fdp.ConsumeIntegralInRange(0, 2); - ParserContext::ParserType type = ParserContext::PARSER_JSON; - if (mode == 1) { - type = ParserContext::PARSER_AGENT; - } else if (mode == 2) { - type = ParserContext::PARSER_SUB_AGENT; - } - - const std::string payload = fdp.ConsumeRemainingBytesAsString(); - - // Target context parseString - try { - ctx.parseString(payload, type); - } catch (const isc::Exception&) { - // Silent exceptions - } - - // Parse payload to JSON - try { - elem = Element::fromJSON(payload); - } catch (...) { - // If failed to parse the payload, early exit - return 0; - } - - // Target SimpleParser - try { - AgentSimpleParser::setAllDefaults(elem); - simpleParser.checkTlsSetup(elem); - simpleParser.parse(ctxPtr, elem, checkOnly); - } catch (const isc::Exception&) { - // Silent exceptions - } - - return 0; -} diff --git a/src/fuzz/fuzz_agent.dict b/src/fuzz/fuzz_agent.dict deleted file mode 100644 index 2daa66aeab..0000000000 --- a/src/fuzz/fuzz_agent.dict +++ /dev/null @@ -1,156 +0,0 @@ -"{" -"}" -"[" -"]" -":" -"," -"\"" -"\"\"" -"null" -"true" -"false" -" " -"\\n" -"\\r\\n" -"\"Control-agent\"" -"\"control-agent\"" -"\"http-host\"" -"\"http-port\"" -"\"http-ciphers\"" -"\"http-headers\"" -"\"http-max-body-size\"" -"\"http-status\"" -"\"http-response-headers\"" -"\"localhost\"" -"\"127.0.0.1\"" -"\"::1\"" -"\"0.0.0.0\"" -"0" -"53" -"67" -"80" -"443" -"8080" -"65535" -"\"tls\"" -"\"enable-tls\"" -"\"cert-file\"" -"\"key-file\"" -"\"ca-file\"" -"\"trust-anchor\"" -"\"verify-peer\"" -"\"cipher-list\"" -"\"cipher-suite\"" -"\"protocols\"" -"\"min-tls-version\"" -"\"max-tls-version\"" -"\"/etc/kea/ctrl-agent.crt\"" -"\"/etc/kea/ctrl-agent.key\"" -"\"/etc/ssl/certs/ca-certificates.crt\"" -"\"/tmp/kea.crt\"" -"\"/tmp/kea.key\"" -"\"REQUIRED\"" -"\"OPTIONAL\"" -"\"NONE\"" -"\"TLSv1.2\"" -"\"TLSv1.3\"" -"\"control-sockets\"" -"\"dhcp4\"" -"\"dhcp6\"" -"\"d2\"" -"\"netconf\"" -"\"socket-type\"" -"\"socket-name\"" -"\"socket-url\"" -"\"unix\"" -"\"http\"" -"\"/tmp/kea4-ctrl.sock\"" -"\"/tmp/kea6-ctrl.sock\"" -"\"/tmp/kea-d2-ctrl.sock\"" -"\"http://127.0.0.1:8000/\"" -"\"http://[::1]:8000/\"" -"\"commands\"" -"\"command\"" -"\"arguments\"" -"\"access-list\"" -"\"whitelist\"" -"\"blacklist\"" -"\"allowed-clients\"" -"\"paths\"" -"\"path\"" -"\"GET\"" -"\"POST\"" -"\"Logging\"" -"\"name\"" -"\"output_options\"" -"\"output\"" -"\"flush\"" -"\"maxsize\"" -"\"maxver\"" -"\"file-name\"" -"\"severity\"" -"\"debuglevel\"" -"\"INFO\"" -"\"WARN\"" -"\"ERROR\"" -"\"DEBUG\"" -"\"kea-ctrl-agent\"" -"\"stdout\"" -"\"stderr\"" -"\"/var/log/kea-ctrl-agent.log\"" -"\"interfaces\"" -"\"hooks-libraries\"" -"\"library\"" -"\"parameters\"" -"\"user-context\"" -"\"comment\"" -"\"config-control\"" -"\"config-databases\"" -"\"database\"" -"\"type\"" -"\"host\"" -"\"port\"" -"\"user\"" -"\"password\"" -"\"name\"" -"\"Control-agent\":{" -"\"http-host\":\"" -"\"http-port\":" -"\"enable-tls\":" -"\"cert-file\":\"" -"\"key-file\":\"" -"\"ca-file\":\"" -"\"verify-peer\":" -"\"control-sockets\":{" -"\"dhcp4\":{" -"\"dhcp6\":{" -"\"d2\":{" -"\"netconf\":{" -"\"socket-type\":\"" -"\"socket-name\":\"" -"\"Logging\":[{" -"\"output_options\":[{" -"\"severity\":\"" -"\"debuglevel\":" -"}]" -"}]" -"}" -"\"\"" -"\" \"" -"\"\\u0000\"" -"\"\\uD800\"" -"\"\\x\"" -"-1" -"2147483647" -"4294967295" -"9223372036854775807" -"3.14159" -"\"[],{}:\"" -"\":{" -"\": [" -"]}" -"}]" -"}," -"]," -"\" : " -" , " diff --git a/src/fuzz/meson.build b/src/fuzz/meson.build index a11d349c50..2e7f7a16ef 100644 --- a/src/fuzz/meson.build +++ b/src/fuzz/meson.build @@ -72,7 +72,6 @@ endforeach # From external contribution. foreach i : [ - 'fuzz_agent', 'fuzz_cc', 'fuzz_crypto', 'fuzz_cryptolink', @@ -122,7 +121,6 @@ foreach i : [ dependencies: [MYSQL_DEP, POSTGRESQL_DEP, CRYPTO_DEP, GTEST_DEP, KRB5_DEP], include_directories: includes, link_with: [ - agent_lib, d2_lib, ddns_gss_tsig_lib, dhcp_lease_query_lib,