Jido.Action.Sanitizer (Jido Action v2.3.0)

View Source

Shared structural sanitizer for transport-safe and telemetry-safe values.

The default :transport profile recursively converts arbitrary Elixir terms into plain, Jason-safe data suitable for normalized error payloads and cross-package boundaries. Structs become plain maps with a string :__struct__ marker, exceptions also keep :__exception__, tuples become lists, and inspect-hostile terms fall back to safe string representations.

The :telemetry profile preserves the existing execution telemetry behavior: sensitive-key redaction, payload truncation, depth caps, and inspect-safe struct summaries.

Examples

iex> Jido.Action.Sanitizer.sanitize({:ok, %URI{scheme: "https", host: "example.com"}})
[:ok, %{__struct__: "URI", scheme: "https", host: "example.com", path: nil, port: 443, query: nil, authority: "example.com", fragment: nil, userinfo: nil}]

iex> Jido.Action.Sanitizer.sanitize_telemetry(%{token: "secret", payload: String.duplicate("a", 300)})
%{token: "[REDACTED]", payload: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...(truncated 44 bytes)"}

Summary

Functions

Sanitizes a value using the requested profile.

Sanitizes a value using the telemetry profile.

Types

profile()

@type profile() :: :transport | :telemetry

Functions

sanitize(value, opts \\ [])

@spec sanitize(
  term(),
  keyword()
) :: term()

Sanitizes a value using the requested profile.

sanitize_telemetry(value, opts \\ [])

@spec sanitize_telemetry(
  term(),
  keyword()
) :: term()

Sanitizes a value using the telemetry profile.