Package com.code_intelligence.jazzer.api
Class BugDetectors
java.lang.Object
com.code_intelligence.jazzer.api.BugDetectors
Provides static functions that configure the behavior of bug detectors provided by Jazzer.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SilentCloseable
Allows all network connections.static SilentCloseable
allowNetworkConnections
(BiPredicate<String, Integer> connectionPermitted) Allows all network connections for which the provided predicate returnstrue
.
-
Method Details
-
allowNetworkConnections
Allows all network connections.See
allowNetworkConnections(BiPredicate)
for an alternative that provides fine-grained control over which network connections are expected.By default, all attempted network connections are considered unexpected and result in a finding being reported.
By wrapping the call into a try-with-resources statement, network connection permissions can be configured to apply to individual parts of the fuzz test only:
Image image = parseImage(bytes); Response response; try (SilentCloseable unused = BugDetectors.allowNetworkConnections()) { response = uploadImage(image); } handleResponse(response);
- Returns:
- a
SilentCloseable
that restores the previously set permissions when closed
-
allowNetworkConnections
public static SilentCloseable allowNetworkConnections(BiPredicate<String, Integer> connectionPermitted) Allows all network connections for which the provided predicate returnstrue
.By default, all attempted network connections are considered unexpected and result in a finding being reported.
By wrapping the call into a try-with-resources statement, network connection permissions can be configured to apply to individual parts of the fuzz test only:
Image image = parseImage(bytes); Response response; try (SilentCloseable unused = BugDetectors.allowNetworkConnections( (host, port) -> host.equals("example.org"))) { response = uploadImage(image, "example.org"); } handleResponse(response);
- Parameters:
connectionPermitted
- a predicate that evaluate totrue
if network connections to the provided combination of host and port are permitted- Returns:
- a
SilentCloseable
that restores the previously set predicate when closed
-