Class BugDetectors

java.lang.Object
com.code_intelligence.jazzer.api.BugDetectors

public final class BugDetectors extends Object
Provides static functions that configure the behavior of bug detectors provided by Jazzer.
  • Method Details

    • allowNetworkConnections

      public static SilentCloseable 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 returns true.

      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 to true if network connections to the provided combination of host and port are permitted
      Returns:
      a SilentCloseable that restores the previously set predicate when closed