feat: move AWS, Azure, and 1Password vault providers to extensions#736
feat: move AWS, Azure, and 1Password vault providers to extensions#736
Conversation
Move the aws-sm, azure-kv, and 1password vault providers from built-in types to extension vaults, installable via swamp extension pull or auto-resolved from the registry on first use. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Vault create now auto-resolves @-prefixed vault types from the registry,
matching the behavior of model commands. This allows users to run
swamp vault create @swamp/aws-sm my-vault --config '{"region":"us-east-1"}'
without manually installing the extension first.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Adversarial Review
I systematically traced code paths, examined edge cases, and stress-tested the error handling. The code is well-structured and handles the migration cleanly.
Critical / High
None found. The migration logic is sound, error handling is appropriate, and no security issues are introduced.
Medium
-
UX gap in
vault_create.ts:127-132: When a user provides a deprecated type name likeaws-sm, the error message is:Unknown vault type: aws-sm. Available types: local_encryption. Use 'swamp vault type search' to see available types.This doesn't mention that
aws-smhas been renamed to@swamp/aws-sm. Contrast withregisterVaultinvault_service.ts:149-155which callssuggestVaultType()and helpfully says "The type 'aws-sm' has been renamed to '@swamp/aws-sm'". Sincevault_createvalidates the type before callingregisterVault, users hit the less helpful error first.Breaking example:
swamp vault create aws-sm my-vault --config '{"region":"us-east-1"}'gives a confusing error instead of a migration hint.Suggested fix: Call
suggestVaultType()in the vault_create error path, or auto-remap old type names before validation (similar tofromRepository). -
Extension vaults require
--configeven when empty (vault_create.ts:154-159): If an extension vault type has no required configuration, users still must pass--config '{}'. This is awkward but not broken.
Low
-
Theoretical:
resolveProviderConfigdefault case (vault_create.ts:52-53): Returns{}for unknown built-in types. Currently fine since onlylocal_encryptionandmockare built-in, but future built-in types would silently get empty config. Mock vaults already work with{}per tests. -
fromRepositorysilently swallows non-"Unsupported vault type" errors at debug level (vault_service.ts:103-105): If config schema validation fails insideregisterVaultfor a reason other than unsupported type, the error is logged at debug level and the vault is skipped without user-visible warning. This is intentional (fallback behavior) but could mask real config errors.
Verdict
PASS — No blocking issues. The medium UX gap (missing rename hint in vault_create) is a polish issue that doesn't affect correctness. The migration path is documented in the PR body, breaking changes are intentional, and the code handles edge cases appropriately.
There was a problem hiding this comment.
Review Summary
This PR cleanly moves AWS, Azure, and 1Password vault providers to extensions, reducing core dependencies while maintaining backward compatibility.
No blocking issues found.
Code Quality ✓
- TypeScript strict mode compliance - the only
anyusage (AnyOptions) is properly annotated withdeno-lint-ignore - Named exports used consistently
- AGPLv3 headers present in all modified files
- Clean separation of concerns
DDD Compliance ✓
VaultServiceremains a proper Domain Service (stateless operations)- Repository pattern used appropriately (
YamlVaultConfigRepository) - Clean encapsulation of migration logic in
RENAMED_VAULT_TYPES assertVaultProvider()provides good runtime validation for extension providers
Migration Path ✓
RENAMED_VAULT_TYPESmaps old names (aws,aws-sm,azure,azure-kv,1password) to new extension namesfromRepository()auto-remaps and logs deprecation warnings- Error messages updated to guide users to install extensions
Test Coverage ✓
vault_service_test.ts: Tests error handling, renamed type suggestions, mock vault, auto-remapping behaviorvault_types_test.ts: Verifies onlylocal_encryptionremains as built-invault_expression_test.ts: Updated for new error message format
Suggestions (non-blocking)
vault_create.tshas no dedicated unit tests for the command itself - this is a pre-existing gap, not introduced by this PR
LGTM - well-executed migration with proper backward compatibility.
Closes #665
Summary
Moves the
aws-sm,azure-kv, and1passwordvault providers from built-in types to extension vaults published at swamp.club. After this change, onlylocal_encryption(andmockfor testing) remain as built-in vault types. The three cloud/external vault providers are now independently versioned extensions that auto-resolve from the registry on first use.What changed
Removed from core:
aws_vault_provider.ts,azure_kv_vault_provider.ts,onepassword_vault_provider.tsand their test files (-1,545 lines)aws-sm,azure-kv,1passwordfromBUILT_IN_VAULT_TYPESinvault_types.ts— onlylocal_encryptionremainsVaultService.registerVault()@aws-sdk/client-secrets-manager,@azure/identity,@azure/keyvault-secretsfromdeno.jsondependenciesMigration path via
RENAMED_VAULT_TYPES:aws/aws-sm→@swamp/aws-smazure/azure-kv→@swamp/azure-kv1password→@swamp/1passwordWhen
VaultService.fromRepository()loads an existing vault config with an old type name, it remaps to the@swamp/*extension type and auto-resolves it from the registry (installed by PR #725's auto-resolution infrastructure).vault createsimplified:--region,--vault-url,--op-vault,--op-accountflags--config <json>for provider configurationresolveProviderConfig()only handleslocal_encryptionnowensureDefaultVaults()is now a no-op:AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_REGIONwere setError messages updated:
swamp extension pull @swamp/aws-sminstead of setting AWS env varsPublished extensions
The three vault providers have been published to swamp.club as:
@swamp/1password@2026.03.17.1— shells out toopCLI, no npm SDK deps@swamp/aws-sm@2026.03.17.1— uses@aws-sdk/client-secrets-manager@3.1010.0@swamp/azure-kv@2026.03.17.1— uses@azure/identity@4.13.0+@azure/keyvault-secrets@4.10.0Source lives at https://github.com/systeminit/swamp-extensions
User impact
Existing users with vault configs on disk
No action required. Existing
.swamp/vault/*.yamlfiles withtype: aws-sm,type: azure-kv, ortype: 1passwordcontinue to work. On first use, swamp will:@swamp/*extension typeCreating new vaults
The CLI syntax changes from dedicated flags to
--config <json>:Offline users
Users without registry access can manually install extensions by placing the
.tssource files inextensions/vaults/.Binary size
The compiled binary no longer includes the AWS SDK, Azure SDK, or 1Password provider code. These dependencies are now bundled into the extensions at publish time.
Known issues
extensions/models/directory doesn't exist for vault-only extensions (Auto-resolver fails when extensions/models/ directory does not exist for vault-only extensions #734)Verification
deno check— passesdeno lint— passesdeno fmt— passesdeno run test— 3138 passed, 0 faileddeno run compile— binary compiled successfullyopCLI check, aws-sm fails at credential check — both expected)🤖 Generated with Claude Code