Move AWS, Azure, and 1Password vault providers to extensions
Opened by swampadmin · 8/4/2025
Summary
Move the aws-sm, azure-kv, and 1password vault providers from built-in types to extension vaults, installable via swamp extension pull. This reduces core binary size, makes vault providers independently updatable, and dogfoods the extension vault system.
After migration, only local_encryption (and mock for testing) remain as built-in vault types.
Motivation
- The extension system already fully supports vault extensions (
UserVaultLoader,bundleExtension,extension pull) - Vault providers with external SDK dependencies (AWS, Azure) shouldn't be baked into the core binary
- Makes it easier to add new vault providers without core releases
Plan
Phase 1: Create extension vault packages
Create three extensions publishable to swamp.club:
@swamp/aws-sm— wrapsAwsVaultProviderwith ZodconfigSchema+createProvider@swamp/azure-kv— wrapsAzureKvVaultProvider@swamp/1password— wrapsOnePasswordVaultProvider
Each exports a vault object matching the UserVaultSchema expected by UserVaultLoader.
Start with @swamp/1password as proof-of-concept — it only shells out to op CLI (no npm SDK dependencies), so bundling is trivially safe.
Phase 2: Validate SDK bundling
Test that deno bundle correctly inlines @aws-sdk/client-secrets-manager, @azure/identity, and @azure/keyvault-secrets into extension bundles. This is the main technical risk — if bundle size or correctness is an issue, we may need to explore alternatives (e.g. external dependency support in the bundler).
Phase 3: Publish to swamp.club
Push all three extensions to the registry:
swamp extension push @swamp/aws-sm
swamp extension push @swamp/azure-kv
swamp extension push @swamp/1passwordPhase 4: Add migration guidance in VaultService
When VaultService.fromRepository() encounters a vault config with a type that's been migrated but the extension isn't installed, surface a clear error:
Vault 'my-aws-vault' uses type 'aws-sm' which is no longer built-in.
Install it with: swamp extension pull @swamp/aws-smUpdate RENAMED_VAULT_TYPES to map old names to new extension names:
const RENAMED_VAULT_TYPES: Record<string, string> = {
"aws": "@swamp/aws-sm",
"aws-sm": "@swamp/aws-sm",
"azure": "@swamp/azure-kv",
"azure-kv": "@swamp/azure-kv",
"1password": "@swamp/1password",
};Important: The migration error must fire after type remapping, checking if the remapped type is registered in the vault type registry.
Phase 5: Remove from core
vault_types.ts: Removeaws-sm,azure-kv,1passwordfromBUILT_IN_VAULT_TYPESvault_service.ts: Remove switch cases, remove provider imports, removeisBuiltIngate oncreateProviderpathvault_create.ts: Remove--region,--vault-url,--op-vault,--op-accountflags andresolveProviderConfig(). Extension vaults use--config <json>- Delete
aws_vault_provider.ts,azure_kv_vault_provider.ts,onepassword_vault_provider.tsfromsrc/domain/vaults/ ensureDefaultVaults(): Remove auto-create-AWS-vault logic or have it suggest pulling the extension
Phase 6: Update RENAMED_VAULT_TYPES and backwards compat
Existing vault configs on disk (.swamp/vault/aws-sm/*.yaml) continue to work via type remapping — users don't need to edit config files, just pull the extension.
UX changes
vault create changes from:
swamp vault create aws-sm my-vault --region us-east-1to:
swamp vault create @swamp/aws-sm my-vault --config '{"region":"us-east-1"}'Follow-up: Add optional resolveConfig to VaultTypeInfo so extensions can provide interactive config prompting and preserve the convenience flag UX.
Risks
- SDK bundling: AWS/Azure SDKs may produce large bundles or fail to bundle. Validate in Phase 2 before committing.
- Offline users: Can't pull from registry. They can manually create extension files locally.
- CLI UX regression:
--config <json>is less ergonomic than dedicated flags. Mitigated by futureresolveConfigsupport.
Files affected
src/domain/vaults/vault_types.tssrc/domain/vaults/vault_service.tssrc/domain/vaults/vault_type_registry.tssrc/domain/vaults/aws_vault_provider.ts(delete)src/domain/vaults/azure_kv_vault_provider.ts(delete)src/domain/vaults/onepassword_vault_provider.ts(delete)src/cli/commands/vault_create.ts- Tests for all of the above
Closed
No activity in this phase yet.
Sign in to post a ripple.