| Version | Supported |
|---|---|
| 0.1.x | ✅ |
inspect-rs provides mechanisms to mark fields as sensitive or secret using attributes:
#[derive(Inspect)]
struct Credentials {
#[inspect(secret)]
password: String,
#[inspect(sensitive)]
api_key: String,
}Important: The library can only redact values that are explicitly marked. It cannot automatically determine if arbitrary data is sensitive. You are responsible for:
- Marking sensitive fields with appropriate attributes
- Ensuring custom
Inspectimplementations don't leak secrets - Configuring renderers appropriately for your security requirements
inspect-rs includes configurable limits to prevent resource exhaustion:
max_depth: Prevent stack overflow from deep nestingmax_items: Limit collection traversalmax_nodes: Limit total nodes visitedmax_string_length: Truncate long stringsmax_bytes: Limit byte slice lengths
Always configure appropriate limits when inspecting untrusted data.
When implementing Inspect for your own types:
- Never accidentally expose secrets or sensitive data
- Respect the context's limits
- Handle cycles appropriately
- Avoid panicking in inspection code
The library tracks visited memory addresses to detect cycles. This is a best-effort mechanism. Do not rely on it for security-critical isolation between values.
If you discover a security vulnerability in inspect-rs, please report it responsibly:
- Do not open a public GitHub issue
- Email the maintainers directly at: [SECURITY_EMAIL]
- Include:
- A description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
We will:
- Acknowledge receipt within 48 hours
- Provide an initial assessment within 1 week
- Work with you to understand and address the issue
- Credit you in the security advisory (unless you prefer to remain anonymous)
When using inspect-rs:
- Mark sensitive fields: Use
#[inspect(secret)]and#[inspect(sensitive)] - Configure limits: Don't use unlimited inspection on untrusted data
- Review custom implementations: Audit any custom
Inspectimplementations - Choose renderers carefully: Not all renderers may respect sensitivity markers
- Avoid logging secrets: Don't accidentally log inspected output containing secrets
- Test security: Verify that secrets are actually redacted in your output
inspect-rs is an introspection library, not a security framework. It provides tools to help you avoid accidentally exposing sensitive data, but cannot protect against:
- Deliberate misuse
- Bugs in your custom implementations
- Side-channel attacks
- Memory dumps or debugger access
- Serialization of raw memory
Always follow security best practices appropriate for your application's threat model.