fix: integration readiness — guides, example server, rollback, versioning#8
Merged
Conversation
PolicyGrant uses AgentPattern/SecretPattern/allowed_domains/lease_terms, not the bare fields that were documented. Vault::new takes 5 args including CipherAlgorithm. vault.initialize() must be called before use. access_secret takes &str for target_domain, not &DomainScope. Added note about JSON policy file loading.
… policies PolicyConfig already derives Serialize/Deserialize. Add convenience methods for loading from JSON files so operators don't need to write Rust code to configure policies. Includes JSON policy examples in the cloud service guide showing agent/secret patterns (Exact, Prefix, Any) and lease terms format. Tests verify round-trip serialization and parsing from JSON strings.
Three integration readiness fixes: 1. Example vault server (examples/vault_server.rs): Working TCP server with EnvVarSource + RusqliteStore + TracingAuditLog + TokenAuthenticator. Prints registered tokens on startup for testing. 2. Provisioner rollback on failure: If any credential acquisition fails partway through, all previously-acquired leases are revoked before exit. Prevents orphaned leases from partially-successful provisioning. 3. Lease state version field: LeaseState now has a version: u32 field (default 1). The proxy warns and ignores files with unknown versions. Backward compatible via serde(default). Also fixes unnecessary qualifications in policy module caught by clippy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five fixes for day-one integration friction, preparing for handoff to colleagues.
1. Fix embedded guide API examples
docs/guide-embedded.mdhad wrong field names forPolicyGrant(non-existentdomains,max_ttl_seconds, etc.). Updated to match actual API:AgentPattern,SecretPattern,allowed_domains,lease_terms: Option<LeaseTerms>. FixedVault::newsignature (5 args) andaccess_secretparameter type.2. Add JSON policy loading
PolicyConfig::from_file()andfrom_json()methods.PolicyConfigalready derivedSerialize + Deserialize— just needed convenience constructors. Added JSON policy example to cloud service guide with all three pattern types (Exact, Prefix, Any). Three new tests for parsing and round-tripping.3. Example vault server
examples/vault_server.rs— a complete TCP server withEnvVarSource + RusqliteStore + TracingAuditLog + TokenAuthenticator. Prints registered tokens on startup. Colleagues cancargo run --example vault_serverand test against it immediately.4. Provisioner rollback on failure
If credential acquisition fails partway (e.g., 8th of 10 secrets doesn't exist), the provisioner now revokes all previously-acquired leases before exiting. Prevents orphaned leases.
5. Lease state schema version
LeaseStatenow includesversion: u32(default 1). The proxy warns and ignores files with unknown versions. Backward compatible viaserde(default).Test plan
cargo clippy --workspace --all-targets— cleancargo test --workspace— 103 tests passcargo build --example vault_server— compiles