Class UrlAllowListManager

java.lang.Object
ghidra.framework.client.UrlAllowListManager

public class UrlAllowListManager extends Object
UrlAllowListManager provides management of the Server URL Allow List persistent cache.
  • Field Details

    • alwaysAllowLocalAccess

      public static boolean alwaysAllowLocalAccess
  • Method Details

    • addChangeListener

      public static void addChangeListener(ChangeListener listener)
      Add listener to be notified when allow list changes are made. NOTE: This is intended for Swing use only and notification will be provided within the Swing thread.
      Parameters:
      listener - change listener
    • removeChangeListener

      public static void removeChangeListener(ChangeListener listener)
      Remove existing change listener.
      Parameters:
      listener - change listener
    • getAccess

      public static Boolean getAccess(String protocol, String host, int port)
      Determine if the specified server access is allowed. This method will return true for all localhost/127.0.0.1 URLs if alwaysAllowLocalAccess is true.
      Parameters:
      protocol - URL protocol
      host - server host
      port - server port
      Returns:
      true if server access is allowed, false if disallowed, null if no server entry was found
    • getAccess

      public static Boolean getAccess(URL url)
      Determine if the specified server access is allowed. This method will return true for opaque or non-server URLs. This method will return true for all localhost/127.0.0.1 URLs if alwaysAllowLocalAccess is true.
      Parameters:
      url - server URL
      Returns:
      true if server access is allowed, false if disallowed, null if no server entry was found
    • updateAccess

      public static void updateAccess(String protocol, String host, int port, boolean allowAccess) throws IllegalArgumentException
      Update the access for the specified server within the cached allow list. Changes to localhost/127.0.0.1 server access will be ignored if alwaysAllowLocalAccess is true.
      Parameters:
      protocol - URL protocol (e.g., https, ghidra, ghidra:<ext>).
      host - host name or IP address
      port - connection port (positive value)
      allowAccess - true allows access, false disallows access
      Throws:
      IllegalArgumentException - if an invalid parameter is specified
    • updateAccess

      public static void updateAccess(URL url, boolean allowAccess) throws IllegalArgumentException
      Update the access for the specified server URL within the cached allow list. Changes to localhost/127.0.0.1 server access will be ignored if alwaysAllowLocalAccess is true.
      Parameters:
      url - remote server URL (local and opaque URLs not permitted)
      allowAccess - true allows access, false disallows access
      Throws:
      IllegalArgumentException - if an invalid, local or opaque URL is specified.
    • clearAccessEntry

      public static void clearAccessEntry(ServerSpecification server)
      Clear the access entry for the specified server. This is intended to be used along with getAccessMap() for managing the existing access map. Changes to localhost/127.0.0.1 server access will be ignored if alwaysAllowLocalAccess is true.
      Parameters:
      server - server entry to be removed
    • clearAccessEntry

      public static void clearAccessEntry(URL url)
      Clear the access entry for the specified server URL. Changes to localhost/127.0.0.1 server access will be ignored if alwaysAllowLocalAccess is true.
      Parameters:
      url - remote server URL (local and opaque URLs not permitted)
    • clearAll

      public static void clearAll()
      Clear all server access entries.
    • getAccessMap

      public static Map<ServerSpecification, AccessRecord> getAccessMap()
      Returns copy of current server access map.
      Returns:
      copy of current server access map