Class AdapterRedactionPolicy

java.lang.Object
org.j7m.middleware.adapter.spi.AdapterRedactionPolicy

public final class AdapterRedactionPolicy extends Object
Central redaction policy for adapter SPI and TCK public values.

The policy is stateless, immutable, and thread-safe. It is used by public report, status, audit, evidence, result, and configuration records before adapter-provided metadata is exposed to callers. The policy redacts both sensitive metadata keys and credential-like values under otherwise harmless keys. TCK runners can additionally detect the redaction marker to reject adapters that attempted to place sensitive data in public compatibility reports.

The policy is deliberately vendor-neutral. It does not parse or validate external product credentials and does not treat a redacted report as proof of authorization. Implementations remain responsible for normalizing public errors and for avoiding raw credential values in exception messages.

  • Field Details

    • REDACTED

      public static final String REDACTED
      Public marker used when a sensitive key or value is redacted.
      See Also:
  • Method Details

    • isSensitiveKey

      public static boolean isSensitiveKey(String key)
      Returns whether a metadata key is sensitive.
      Parameters:
      key - metadata key to inspect
      Returns:
      true when the key must not expose its value
    • containsSensitiveValue

      public static boolean containsSensitiveValue(String value)
      Returns whether a text value contains a sentinel or credential-like value that must not appear in public adapter output.
      Parameters:
      value - text value to inspect
      Returns:
      true when the text contains sensitive data
    • redactText

      public static String redactText(String value)
      Redacts sensitive value patterns from public text.
      Parameters:
      value - public text candidate
      Returns:
      redacted text, never null
    • redactMetadata

      public static Map<String,String> redactMetadata(Map<String,String> values)
      Redacts a metadata map.
      Parameters:
      values - metadata map supplied by an adapter or TCK probe
      Returns:
      immutable metadata map with sensitive keys and values redacted
    • publicTextLeaksSensitiveValue

      public static boolean publicTextLeaksSensitiveValue(Object value)
      Returns whether public text still contains a configured sensitive sentinel.
      Parameters:
      value - public value to inspect
      Returns:
      true when a sensitive sentinel remains visible
    • containsRedactionMarker

      public static boolean containsRedactionMarker(Object value)
      Returns whether public text contains the redaction marker.

      The TCK uses this signal on scenario and failure-mode report metadata to reject adapters that attempted to place sensitive data in compatibility evidence. The marker itself is safe for callers.

      Parameters:
      value - public value to inspect
      Returns:
      true when the redaction marker is present