Class SecretRedactor

java.lang.Object
com.inductiveautomation.ignition.gateway.config.SecretRedactor

public final class SecretRedactor extends Object
Strips secret values out of configuration JSON before it is shown to an AI agent.

Redaction preserves structure: a field holding a secret keeps its name and stays present with the placeholder REDACTED as its value, so a reader can tell that a secret is configured without learning what it is. Values that identify where a secret lives — the provider and secret names of a secret-provider reference — are left intact, because they are useful grounding and are not themselves sensitive.

Use this on every configuration element that leaves the gateway for a model:

JsonElement safe = SecretRedactor.redact(jsonCodec.encodeToJson(decoded.config()));
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The value substituted for every redacted secret.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.inductiveautomation.ignition.common.gson.JsonElement
    redact(com.inductiveautomation.ignition.common.gson.JsonElement element)
    Returns a redacted copy of the given element.
    static com.inductiveautomation.ignition.common.gson.JsonElement
    redact(com.inductiveautomation.ignition.common.gson.JsonElement element, Set<String> additionalSensitiveKeys)
    Redacts with additional field names supplied by the caller, for a resource type that stores a secret in a field this class has no business knowing about.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • redact

      public static com.inductiveautomation.ignition.common.gson.JsonElement redact(com.inductiveautomation.ignition.common.gson.JsonElement element)
      Returns a redacted copy of the given element. The argument is never modified, and the result shares no mutable state with it.
      Parameters:
      element - the configuration JSON to redact; may be any kind of element, including a bare primitive or JsonNull.
      Returns:
      a copy with every embedded secret and every sensitively-named string value replaced by REDACTED.
    • redact

      public static com.inductiveautomation.ignition.common.gson.JsonElement redact(com.inductiveautomation.ignition.common.gson.JsonElement element, Set<String> additionalSensitiveKeys)
      Redacts with additional field names supplied by the caller, for a resource type that stores a secret in a field this class has no business knowing about. A name that is a credential in one resource type may be innocuous in another, so these stay with the caller.
      Parameters:
      element - the configuration JSON to redact; never modified.
      additionalSensitiveKeys - field names to blank in addition to the shared list, matched case-insensitively.