| Crates.io | rappct |
| lib.rs | rappct |
| version | 0.13.3 |
| created_at | 2025-10-21 19:29:22.74195+00 |
| updated_at | 2025-10-23 00:59:26.408366+00 |
| description | Rust AppContainer / LPAC toolkit for Windows (profiles, capabilities, process launch, diagnostics). |
| homepage | https://github.com/cpjet64/rappct |
| repository | https://github.com/cpjet64/rappct |
| max_upload_size | |
| id | 1894321 |
| size | 369,596 |
Stable (main branch)
Rust toolkit for working with Windows AppContainer (AC) and Low Privilege AppContainer (LPAC) security boundaries.
rappct packages the underlying Windows APIs into a cohesive crate so that you can create, manage, and launch AppContainer-aware workloads from Rust with minimal boilerplate. It is designed for security-sensitive automation that needs to compose profiles, capabilities, process launches, ACL helpers, and diagnostics in one place.
UnsupportedPlatform.DeriveCapabilitySidsFromName, with ergonomic builders for known and custom capability SIDs.STARTUPINFOEX, optional job object integration, and stdio redirection.introspection) and network loopback management (net).main run CI; when green, the release workflow cuts a GitHub release and publishes to crates.io automatically.| Requirement | Notes |
|---|---|
| Windows 10 1703+ | LPAC support requires at least Windows 10 1703. AppContainer APIs are available on Windows 8+. |
| Windows SDK 10.0.19041+ | Required so the windows crate can link against the necessary Win32 symbols. |
| MSVC build tools 17.x+ | cargo uses the MSVC linker when targeting x86_64-pc-windows-msvc. |
| Rust toolchain | Install via rustup. Run rustup target add x86_64-pc-windows-msvc if needed. |
# Clone the repository
git clone https://github.com/cpjet64/rappct.git
cd rappct
# Build the library
cargo build
# Run the example CLI
cargo run --example acrun -- --help
The crate is structured as a binary-agnostic library. Add it to your project:
# Stable release from crates.io (recommended)
cargo add rappct
# Pin a specific version (optional)
# See the latest on crates.io or the release badge
cargo add rappct@<x.y.z>
# Development version from git (optional)
cargo add rappct --git https://github.com/cpjet64/rappct.git --branch main
use rappct::{AppContainerProfile, KnownCapability, LaunchOptions, SecurityCapabilitiesBuilder, launch_in_container};
fn main() -> rappct::Result<()> {
let profile = AppContainerProfile::ensure("demo.rappct", "Demo", Some("rappct example"))?;
let caps = SecurityCapabilitiesBuilder::new(&profile.sid)
.with_known(&[KnownCapability::InternetClient])
.with_lpac_defaults() // opt in to LPAC defaults when required
.build()?;
let opts = LaunchOptions { exe: "C:/Windows/System32/notepad.exe".into(), ..Default::default() };
let child = launch_in_container(&caps, &opts)?;
println!("child pid: {}", child.pid);
Ok(())
}
The examples/ directory contains runnable demonstrations of rappct features:
Simple demonstration of essential features:
net feature)cargo run --example rappct_demo --all-features
Comprehensive demonstrations with isolated examples for each capability:
cargo run --example comprehensive_demo --all-features
Advanced and less common features:
cargo run --example advanced_features --all-features
Network capability demonstration with automatic firewall configuration:
cargo run --example network_demo --features net
Developer CLI tool for managing AppContainer profiles and launching sandboxed processes:
# Create a profile
cargo run --example acrun -- ensure demo.app
# Launch a process in an AppContainer
cargo run --example acrun -- launch demo.app notepad.exe
# View help for all commands
cargo run --example acrun -- --help
| Feature | Description |
|---|---|
net |
Enable AppContainer enumeration and firewall loopback exemption helpers. ⚠️ This feature changes global Windows Firewall state. Always call LoopbackAdd::confirm_debug_only() before add_loopback_exemption, and use remove_loopback_exemption to restore the original configuration when finished. |
introspection |
Toggle diagnostics, configuration validation, and capability suggestions. |
tracing |
Emit structured tracing spans/logs; integrate with tracing-subscriber. |
serde |
Enable Serialize/Deserialize support for core types (SecurityCapabilities, AppContainerSid, SidAndAttributes). Useful for config files or JSON APIs. |
Disable unused features for the leanest runtime surface; APIs gracefully return AcError::Unimplemented when a
feature is not compiled in.
SecurityCapabilitiesBuilder::with_lpac_defaults() explicitly.net feature are meant for debug scenarios only. Production use should rely on
standard firewall policy.supports_lpac() to guard LPAC-specific code paths.
For tests/CI, you can set RAPPCT_TEST_LPAC_STATUS=ok|unsupported to force detection.See also: docs/capabilities.md for common capability SIDs and starter sets.
src/ — core library modules (capabilities, launch, ACLs, diagnostics).examples/ — runnable samples such as acrun for quick CLI exploration.tests/ — integration tests covering launch/ACL/token behaviours on Windows.cargo fmt
cargo clippy --all-targets --all-features
cargo test --all-targets --all-features
Run Windows-specific scenarios in an elevated PowerShell session when the tests require loopback exemptions or ACL adjustments.
These environment variables help diagnose local environment quirks during AppContainer launches. They are intended for local testing only and are not required on CI.
RAPPCT_TEST_FORCE_ENV=1
CreateProcessW built from the current process environment (sorted case-insensitively).RAPPCT_TEST_NO_CWD=1
CreateProcessW.RAPPCT_DEBUG_LAUNCH=1
CreateProcessW diagnostics (flags, env bytes, HRESULT) to stderr during tests.Examples:
$env:RAPPCT_TEST_FORCE_ENV='1'
$env:RAPPCT_TEST_NO_CWD='1'
$env:RAPPCT_DEBUG_LAUNCH='1'
cargo test --test windows_launch -- --nocapture
Contributions are welcome! Please:
See CONTRIBUTING.md for style and review guidelines.
Please report vulnerabilities privately through the GitHub Security Advisory workflow.
This project is licensed under the MIT license.