Cased.Sensitive.Processor (cased v1.0.0)
Processes audit events for sensitive data.
Link to this section Summary
Functions
Process an audit event, collecting any sensitive data found.
Link to this section Types
Link to this type
address()
Specs
address() :: [String.t() | non_neg_integer()]
Link to this type
process_opt()
Specs
process_opt() :: {:return, :embedded | :pii} | {:handlers, [Cased.Sensitive.Handler.spec()]}
Link to this type
process_opts()
Specs
process_opts() :: [process_opt()]
Link to this section Functions
Link to this function
process(audit_event, opts \\ [])
Specs
process(audit_event :: map(), opts :: process_opts()) :: map()
Process an audit event, collecting any sensitive data found.
Examples
Process an audit event, returning any sensitive data in a new :".cased" key:
iex> audit_event = %{action: "comment.create", body: "Hi, @username"}
iex> Cased.Sensitive.Processor.process(audit_event, handlers: [
iex> {Cased.Sensitive.RegexHandler, :username, ~r/@\w+/}
iex> ])
%{
".cased": %{
pii: %{
".body" => [
%Cased.Sensitive.Range{
begin_offset: 4,
end_offset: 13,
key: :body,
label: :username
}
]
}
},
action: "comment.create",
body: "Hi, @username"
}
Return just the sensitive data:
iex> audit_event = %{action: "comment.create", body: "Hi, @username"}
iex> Cased.Sensitive.Processor.process(audit_event, handlers: [
iex> {Cased.Sensitive.RegexHandler, :username, ~r/@\w+/}
iex> ], return: :pii)
%{
".body" => [
%Cased.Sensitive.Range{
begin_offset: 4,
end_offset: 13,
key: :body,
label: :username
}
]
}