Strand Vault
Permissions and Policy
Permissions and policy in Strand Vault — capability bindings, per-session gates, and pluggable policy engines.
Purpose
Policy-aware strand vault with sessions, permissions, storage backends, WAL, fsck, snapshots, and replication.
This page follows the real source shape for Strand Vault and explains the workflow a developer is likely to use first.
Trust contract
Document which keys authorize the operation, what is signed, what is encrypted, what is deliberately public, and which policy hook can deny the call. Security examples should use deterministic test vectors where possible.
Note
Vault sessions are short-lived. A session carries the agent's AgentPermissions snapshot — permission changes made after a session opens do not apply until the agent reopens.
Primary types to know
AgentPermissions— libs/strand-vault/src/permissions.rsAppendGuard— libs/strand-vault/src/vault.rsAtom— libs/strand-vault/src/vault.rsCreateOptions— libs/strand-vault/src/config.rsDefaultPolicy— libs/strand-vault/src/policy.rsFileMetadataStorage— libs/strand-vault/src/storage/filesystem.rsFileSystemStorage— libs/strand-vault/src/storage/filesystem.rsFileSystemStorageFactory— libs/strand-vault/src/storage/filesystem.rsFileStrandStorage— libs/strand-vault/src/storage/filesystem.rsFsckReport— libs/strand-vault/src/fsck.rsIndexingConfig— libs/strand-vault/src/config.rsLruStoragePool— libs/strand-vault/src/storage/mod.rs
Example shape
use strand_vault::{AgentPermissions, Permission};
fn main() {
// Permissions ship with two preset constructors plus a custom builder.
let admin = AgentPermissions::full_access();
let viewer = AgentPermissions::read_only();
let mut writer = AgentPermissions::default();
writer.max_strands = Some(8);
writer.max_storage_bytes = Some(64 * 1024 * 1024);
writer.custom.insert("woven.publish".into());
// has_permission is the unified check used by vault-side authorization.
assert!(admin.has_permission(Permission::Delete));
assert!(!viewer.has_permission(Permission::Create));
assert!(writer.has_permission(Permission::Custom("woven.publish".into())));
println!(
"admin_can_delete=true viewer_can_create={} writer_custom_count={}",
viewer.can_create,
writer.custom.len(),
);
}