Lightning.Scrubber (Lightning v2.15.0-pre5)
View SourceProcess used to scrub strings of sensitive information.
Can be started via start_link/1.
{:ok, scrubber} =
Lightning.Scrubber.start_link(
samples:
Lightning.Credentials.sensitive_values_for(credential)
)Takes an optional :name key, in case you need to name the process.
Summary
Functions
Returns a specification to start this module under a supervisor.
Prepare a list of sensitive samples (strings) into a potentially bigger list composed of variations a sample may appear.
This is used for scrubbing logs (is_list) and JSON (is_binary)
Recursively scrubs all values from a data structure, replacing them with type placeholders.
Preserves keys and structure while hiding actual values. Arrays are sampled up to array_limit
elements with a "...N more" indicator if truncated.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Prepare a list of sensitive samples (strings) into a potentially bigger list composed of variations a sample may appear.
This is used for scrubbing logs (is_list) and JSON (is_binary)
@spec scrub_values(any(), non_neg_integer()) :: any()
Recursively scrubs all values from a data structure, replacing them with type placeholders.
Preserves keys and structure while hiding actual values. Arrays are sampled up to array_limit
elements with a "...N more" indicator if truncated.
Examples
iex> scrub_values(%{"name" => "John", "age" => 30})
%{"name" => "string", "age" => "number"}
iex> scrub_values([1, 2, 3])
["number", "number", "...1 more"]
@spec start_link( opts :: [ samples: [String.t()], basic_auth: [String.t()], name: nil | GenServer.name() ] ) :: Agent.on_start()