Expand description
Type-directed redaction for structured data.
This crate separates:
- Policy markers: what kind of sensitive data this is (e.g.,
Pii,Token,Email). - Redaction policies: how that data should be redacted.
The derive macro walks your data and applies the policy at the boundary when
you call redact() or Redactable::redact().
What this crate does:
- defines policy marker types (e.g.,
Pii,Token,Email) - defines redaction policies and the
redactentrypoint - provides integrations behind feature flags (e.g.
slog)
What it does not do:
- perform I/O or logging
- validate your policy choices
Explicitly non-sensitive output remains an exceptional opt-in. Use
NotSensitiveDebug or NotSensitiveDisplay only when the complete
formatted value is safe to log. With the json feature, those wrappers
serialize the raw inner value for transport or storage; Serde output is not
redaction. Sensitive values should use SensitiveValue or a custom
ToRedactedOutput projection instead.
The Sensitive derive macro lives in redactable-derive and is re-exported
from this crate.
Re-exports§
pub use policy::BlockchainAddress;pub use policy::CreditCard;pub use policy::Email;pub use policy::EmailConfig;pub use policy::IpAddress;pub use policy::KeepConfig;pub use policy::MASK_CHAR;pub use policy::MaskConfig;pub use policy::PhoneNumber;pub use policy::Pii;pub use policy::REDACTED_PLACEHOLDER;pub use policy::RedactionPolicy;pub use policy::Secret;pub use policy::TextRedactionPolicy;pub use policy::Token;pub use slog::RedactedDisplayValue;pub use slog::SlogRedactedDisplayExt;pub use slog::SlogRedactedExt;
Modules§
- policy
- Redaction policies: marker types and text transformations.
- slog
- Adapters for emitting redacted values through
slog. - tracing
- Adapters for emitting redacted values through
tracing.
Structs§
- NotSensitive
- Wrapper for explicitly non-sensitive values without formatting opinions.
- NotSensitive
Debug - Owns an explicitly non-sensitive value and emits its
Debugrepresentation. - NotSensitive
Display - Owns an explicitly non-sensitive value and emits its
Displayrepresentation. - NotSensitive
Json - Wrapper for explicitly non-sensitive values using JSON serialization.
- NotSensitive
Value - Wrapper for foreign types that should pass through unchanged.
- Redacted
Formatter Ref - Display wrapper that uses
RedactableWithFormatter::fmt_redacted. - Redacted
Json - Owned redacted JSON output produced at logging boundaries.
- Redacted
Json Ref - Wrapper for redacted JSON output from structured types.
- Redacted
Output Ref - Wrapper for explicitly redacting structured types.
- Sensitive
Value - Wrapper for leaf values to apply a redaction policy.
Enums§
- Redacted
Output - Output produced at a logging boundary.
Traits§
- NotSensitive
Debug Ext - Extension trait to mark values as explicitly non-sensitive using
Debug. - NotSensitive
Display Ext - Extension trait to mark values as explicitly non-sensitive using
Display. - NotSensitive
Ext - Extension trait to mark values as explicitly non-sensitive for logging.
- NotSensitive
Json Ext - Extension trait to mark values as explicitly non-sensitive using JSON.
- Redactable
- Public entrypoint for redaction on types with declared redaction behavior.
- Redactable
With Formatter - Formats a redacted string representation without requiring
CloneorSerialize. - Redacted
Json Ext - Extension trait to obtain a redacted JSON output wrapper.
- Redacted
Output Ext - Extension trait to obtain a redacted output wrapper.
- Sensitive
With Policy - A type that can be redacted using a specific policy.
- ToRedacted
Output - Produces a logging-safe output representation.
Derive Macros§
- NotSensitive
- Derives a no-op
redactable::RedactableWithMapperimplementation, along withslog::Value/SlogRedactedandTracingRedacted. - NotSensitive
Display - Derives
redactable::RedactableWithFormatterfor types with no sensitive data. - Sensitive
- Derives
redactable::RedactableWithMapper(and related impls) for structs and enums. - Sensitive
Display - Derives
redactable::RedactableWithFormatterusing a display template.