Class RuntimeConfig

java.lang.Object
ai.attackframework.tools.burp.utils.config.RuntimeConfig

public final class RuntimeConfig extends Object
Holds the current runtime configuration used by live export pipelines.

UI actions update this state, and runtime exporters read it from worker threads. The core state and run-suppression flags are kept in volatile fields so readers can consume the latest snapshot without additional locking.

The export-running flag gates whether traffic and reporter pipelines may send documents to sinks. Start and Stop update that runtime gate without mutating the persisted config snapshot.

  • Method Details

    • getState

      public static ConfigState.State getState()
      Returns the current runtime config state.
    • isExportRunning

      public static boolean isExportRunning()
      Returns whether export is currently running (Start pressed).

      When false, traffic and other exporters do not send data to sinks.

      Returns:
      true if export has been started and not stopped
    • isCommunityEdition

      public static boolean isCommunityEdition()
      Returns whether the active Burp instance is Community Edition.
    • isExportReady

      public static boolean isExportReady()
      Returns whether export is fully active and allowed to emit runtime documents.

      This stays false during Start/bootstrap work so background listeners do not begin pushing traffic or exporter-log documents before OpenSearch preflight and index bootstrap have succeeded.

    • setExportRunning

      public static void setExportRunning(boolean running)
      Sets the export-running flag.

      Start button sets true; Stop button sets false.

      Parameters:
      running - new running state
    • setExportStarting

      public static void setExportStarting(boolean starting)
      Sets whether export startup/bootstrap is still in progress.

      When true, the UI may show a running state while runtime exporters remain gated until startup succeeds.

    • updateState

      public static void updateState(ConfigState.State newState)
      Updates the runtime config state with a normalized, non-null value.
    • disableOpenSearchDestination

      public static boolean disableOpenSearchDestination()
      Disables only the OpenSearch destination in the current runtime state.

      This is used for runtime shutdown of a failing destination while allowing any configured file export destination to continue. The disable remains sticky for the active export run so later UI refreshes do not silently re-enable OpenSearch until export is stopped.

      Returns:
      true when OpenSearch was enabled and is now disabled; false otherwise
    • disableFileDestination

      public static boolean disableFileDestination()
      Disables only the file destination in the current runtime state.

      This is used for runtime shutdown of a failing file destination while allowing any configured OpenSearch destination to continue. The disable remains sticky for the active export run so later UI refreshes do not silently re-enable Files until export is stopped.

      Returns:
      true when Files were enabled and are now disabled; false otherwise
    • isFileExportDisabledForCurrentRun

      public static boolean isFileExportDisabledForCurrentRun()
      True when Files export has been suppressed for the active export run.
    • isOpenSearchDisabledForCurrentRun

      public static boolean isOpenSearchDisabledForCurrentRun()
      True when OpenSearch has been suppressed for the active export run.
    • registerStateListener

      public static void registerStateListener(RuntimeConfig.StateListener listener)
      Registers a listener for runtime-state changes and immediately replays the current state.
    • unregisterStateListener

      public static void unregisterStateListener(RuntimeConfig.StateListener listener)
      Removes a previously registered runtime-state listener.
    • isOpenSearchExportEnabled

      public static boolean isOpenSearchExportEnabled()
      True when OpenSearch export is enabled and a non-blank runtime URL is available.
    • isOpenSearchTrafficEnabled

      public static boolean isOpenSearchTrafficEnabled()
      True when OpenSearch export is enabled for the traffic source and at least one tool type is selected.
    • isAnySinkEnabled

      public static boolean isAnySinkEnabled()
      True when any export sink is enabled and sufficiently configured to accept documents.
    • activeSinkSummary

      public static String activeSinkSummary()
      Returns a human-readable summary of the currently enabled export destinations.

      The result is intended for UI and log messages such as start/stop status updates. It reflects the current runtime sink selection and returns "no destinations" when neither Files nor OpenSearch is enabled.

      Returns:
      destination summary suitable for operator-facing status text
    • isAnyTrafficExportEnabled

      public static boolean isAnyTrafficExportEnabled()
      True when traffic export has at least one destination sink enabled.
    • isAnyExporterExportEnabled

      public static boolean isAnyExporterExportEnabled()
      Returns whether the exporter source is enabled with at least one sub-option selected.
    • isDataSourceEnabled

      public static boolean isDataSourceEnabled(String source)
      Returns whether the named data source is currently enabled after edition normalization.
    • isTrafficToolTypeEnabled

      public static boolean isTrafficToolTypeEnabled(String toolType)
      Returns whether the given traffic tool type is currently enabled after edition normalization.
    • isExporterSubOptionEnabled

      public static boolean isExporterSubOptionEnabled(String option)
      Returns whether the named exporter sub-option is currently enabled.
    • isAnyExporterLogLevelEnabled

      public static boolean isAnyExporterLogLevelEnabled()
      Returns whether any exporter log level is currently enabled.
    • isExporterLogLevelEnabled

      public static boolean isExporterLogLevelEnabled(String level)
      Returns whether the given exporter log level is enabled.
    • isExporterStatsEnabled

      public static boolean isExporterStatsEnabled()
      Returns whether exporter stats snapshots are enabled.
    • isExporterConfigEnabled

      public static boolean isExporterConfigEnabled()
      Returns whether exporter config snapshots are enabled.
    • exporterStatsIntervalSeconds

      public static int exporterStatsIntervalSeconds()
      Returns the configured exporter stats interval in seconds.
    • prepareIndexNamesForCurrentRun

      public static IndexNaming.ResolutionResult prepareIndexNamesForCurrentRun()
      Resolves and stores the index names that should remain stable for the active export run.

      Call this exactly once during Start after the latest UI state has been pushed into runtime config. When validation fails, the previous run snapshot remains unchanged.

    • indexNameForKey

      public static String indexNameForKey(String indexKey)
      Returns the effective concrete index name for the provided logical key.
    • allIndexNames

      public static Map<String,String> allIndexNames()
      Returns all effective concrete index names for the current state or run snapshot.
    • resolvedIndexNamesAt

      public static Instant resolvedIndexNamesAt()
      Returns the instant used when the current run's index names were resolved.
    • openSearchUrl

      public static String openSearchUrl()
      Current OpenSearch URL for runtime exports; blank when OpenSearch export is disabled.
    • isOpenSearchActive

      public static boolean isOpenSearchActive()
      Returns true when OpenSearch export is currently active, i.e. enabled and resolved to a non-blank base URL. Convenience over inline baseUrl != null && !baseUrl.isBlank() checks scattered across reporters.
    • openSearchUser

      public static String openSearchUser()
      Optional OpenSearch username for basic auth (empty = no auth).
    • openSearchPassword

      public static String openSearchPassword()
      Optional OpenSearch password for basic auth (empty = no auth).
    • openSearchTlsMode

      public static String openSearchTlsMode()
      Current OpenSearch TLS mode.
    • uiPreferences

      public static ConfigState.UiPreferences uiPreferences()
      Returns the persisted UI preferences currently attached to runtime config.
    • statsChartStyle

      public static int statsChartStyle()
      Returns the configured StatsPanel chart style in the range 1-3.
    • logPanelPreferences

      public static ConfigState.LogPanelPreferences logPanelPreferences()
      Returns the configured LogPanel preferences.
    • updateStatsChartStyle

      public static void updateStatsChartStyle(int chartStyle)
      Updates only the persisted StatsPanel chart style while preserving all other runtime config.
    • updateLogPanelPreferences

      public static void updateLogPanelPreferences(ConfigState.LogPanelPreferences logPanelPreferences)
      Updates only the persisted LogPanel preferences while preserving all other runtime config.
    • getAllowedExportKeys

      public static Set<String> getAllowedExportKeys(String indexShortName)
      Returns the set of top-level field keys allowed for export for the given index. Used for document filtering (which fields to include in pushed documents). When no field selection is saved, returns required + all toggleable fields.
    • isAnyFileExportEnabled

      public static boolean isAnyFileExportEnabled()
      Returns whether any runtime file export format is enabled and a root path is set.
    • isFileJsonlEnabled

      public static boolean isFileJsonlEnabled()
      Returns whether document-only JSONL export is enabled.
    • isFileBulkNdjsonEnabled

      public static boolean isFileBulkNdjsonEnabled()
      Returns whether bulk-compatible NDJSON export is enabled.
    • fileExportRoot

      public static String fileExportRoot()
      Returns the configured file export root, or blank when unset.
    • isFileTotalCapEnabled

      public static boolean isFileTotalCapEnabled()
      True when the total exporter-file cap is enabled.
    • fileTotalCapBytes

      public static long fileTotalCapBytes()
      Configured total cap across exporter files under the selected root.
    • isFileDiskUsagePercentEnabled

      public static boolean isFileDiskUsagePercentEnabled()
      True when the optional destination-volume used-percent threshold is enabled.
    • fileDiskUsagePercent

      public static int fileDiskUsagePercent()
      Configured destination-volume used-percent threshold for file export.