secure_resilience
Anti-tampering and environment-detection policy engine for MASVS-RESILIENCE. Part of the SunLit Security Libraries workspace.
When to reach for this crate
You're building a mobile or desktop client that needs runtime self-protection (RASP) — root/jailbreak detection, emulator detection, debugger detection, and integrity checks — and you want a policy engine that can:
- Aggregate signals from many platform-specific probes into a single threat level.
- Decide an action (
Allow,Warn,Block,Degrade) based on configurable policy. - Emit
security_eventsfor every block/degrade decision so you have an audit trail.
This crate is a pure policy engine — you write the platform-specific probes (or use a vendor SDK), and you feed signals in. This crate decides what to do with them.
Install
[]
= "0.1.2"
Quick example — RASP decision pipeline
use ;
// Configure policy: jailbreak high-confidence -> block; medium -> warn.
let policy = builder
.on_signal_category
.on_signal_category
.build;
let engine = new;
// A platform probe detected jailbreak with high confidence.
let signal = builder
.category
.confidence
.threat_level
.build;
match engine.evaluate
What's inside
| Module | Use it for |
|---|---|
environment::EnvironmentSignal / Confidence / ThreatLevel |
The signal-input vocabulary your probes feed in. |
rasp::RaspEngine / RaspPolicy / RaspDecision / ResponseAction |
Policy aggregation and decision output. |
integrity::IntegrityCheck / IntegrityCheckResult / IntegrityResult |
App-bundle integrity verification primitives. |
error::ResilienceError |
Structured, redaction-safe errors. |
Compatibility
- MSRV: 1.78
#![forbid(unsafe_code)],#![deny(missing_docs)]- Emits
security_events::SecurityEventfor block/degrade decisions
Status
Alpha.
Related crates
Part of the SunLit Security Libraries workspace:
| Crate | Purpose |
|---|---|
security_core |
Shared types, identity, classification, severity, redaction. |
security_events |
Security logging and tamper-evident audit chain. |
secure_errors |
Three-layer error model with redaction-safe public errors. |
secure_output |
Context-aware output encoders (HTML, JSON, URL, JS, CSS, XML, LDAP, shell). |
secure_data |
Secrets, envelope encryption, Argon2id, FIPS, mobile storage. |
secure_network |
TLS policy, SPKI pinning, mTLS, cleartext detection. |
secure_device_trust |
Native-client device trust and session certificates. |
secure_privacy |
PII classification, consent, retention, pseudonymization. |
secure_boundary |
Input validation, security headers, boundary protections. |
secure_identity |
JWT/OIDC, MFA, sessions, biometric step-up. |
secure_authz |
Typed deny-by-default authorization with device-trust predicates. |
Getting help
- Questions, ideas, design discussions — open a GitHub Discussion.
- Bug reports — use the bug-report template in GitHub Issues.
- Security issues — please do not open a public issue. See SECURITY.md for the responsible-disclosure process.
Contributing
Contributions are welcome. Please read CONTRIBUTING.md and the Code of Conduct before opening a PR.
License
Dual-licensed under MIT or Apache-2.0 at your option.