Vault — Dependencies#
Module info#
- Module:
github.com/hashicorp/vault - Go version: go 1.26.1
- Direct dependencies: 210
- Indirect dependencies: 336 (total unique module/version pairs in go.sum: ~965)
- Replace directives: 7 (5 for in-repo submodules; 2 for upstream bug workarounds)
Dependency categories#
Core HashiCorp ecosystem#
Vault is built almost entirely on HashiCorp’s own library stack. These are foundational:
| Package | Purpose |
|---|---|
hashicorp/cli | CLI framework (HashiCorp fork of mitchellh/cli; not cobra) |
hashicorp/go-hclog | Structured, leveled logger used everywhere in Vault |
hashicorp/hcl + hashicorp/hcl/v2 | HCL1 (legacy config) and HCL2 (modern config parsing) |
hashicorp/errwrap + go-multierror | Error wrapping and aggregation primitives |
hashicorp/go-memdb | In-memory database with indexing, used for cluster state |
hashicorp/go-immutable-radix | Radix tree for policy/path routing |
hashicorp/golang-lru + v2 | LRU cache (token cache, lease cache) |
hashicorp/go-retryablehttp + go-cleanhttp | Resilient HTTP clients |
hashicorp/go-secure-stdlib/* | ~14 micro-packages for secrets-safe utilities (mlock, tlsutil, parseutil, strutil, nonceutil, permitpool, etc.) |
hashicorp/go-sockaddr | IP/CIDR manipulation for listener and access policy |
hashicorp/go-uuid, go-version | UUID generation and semver comparison |
hashicorp/go-bexpr | Boolean expression evaluator for filter queries |
hashicorp/go-discover | Multi-cloud service auto-discovery for cluster join |
hashicorp/eventlogger | Audit event pipeline framework |
hashicorp/cap + cap/ldap | Capabilities library for OIDC/JWT/LDAP flows |
Consensus / High-Availability Storage#
Vault’s integrated storage (Raft mode) is the default HA backend since Vault 1.4:
| Package | Purpose |
|---|---|
hashicorp/raft | Core Raft consensus implementation |
hashicorp/raft-autopilot | Automated peer management for Raft clusters |
hashicorp/raft-boltdb/v2 | BoltDB-backed stable store for Raft log |
hashicorp/raft-wal | Write-ahead log for Raft (newer WAL storage) |
hashicorp/raft-snapshot | Raft snapshot management |
hashicorp/go-raftchunking | Chunked log entries for large Raft writes |
go.etcd.io/bbolt | BoltDB (embedded B-tree KV store for integrated storage) |
Plugin System#
Vault’s plugin architecture is explicit in go.mod — all built-in plugins are imported as direct module dependencies even though they run as separate processes via go-plugin:
| Package | Purpose |
|---|---|
hashicorp/go-plugin | gRPC-based plugin RPC framework |
hashicorp/vault-plugin-auth-{alicloud,azure,cf,gcp,jwt,kerberos,kubernetes,oci} | 8 external auth method plugins |
hashicorp/vault-plugin-database-{couchbase,elasticsearch,mongodbatlas,redis,redis-elasticache,snowflake} | 6 database secret engine plugins |
hashicorp/vault-plugin-secrets-{ad,alicloud,azure,gcp,gcpkms,kubernetes,kv,mongodbatlas,openldap,terraform} | 10 secret engine plugins |
hashicorp/vault-testing-stepwise | Vault-specific framework for step-based plugin acceptance tests |
hashicorp/vault/api + vault/sdk | In-tree submodules (via replace); SDK is the plugin contract |
Key Management / Encryption#
Vault’s seal/unseal and transit engine depend on a layered wrapping abstraction:
| Package | Purpose |
|---|---|
hashicorp/go-kms-wrapping/v2 | Envelope encryption abstraction (the “seal” interface) |
go-kms-wrapping/wrappers/aead/v2 | AEAD software seal |
go-kms-wrapping/wrappers/awskms/v2 | AWS KMS auto-unseal |
go-kms-wrapping/wrappers/azurekeyvault/v2 | Azure Key Vault auto-unseal |
go-kms-wrapping/wrappers/gcpckms/v2 | GCP CKMS auto-unseal |
go-kms-wrapping/wrappers/alicloudkms/v2 | Alibaba Cloud KMS auto-unseal |
go-kms-wrapping/wrappers/ocikms/v2 | Oracle OCI KMS auto-unseal |
go-kms-wrapping/wrappers/transit/v2 | Vault Transit engine as external seal (chained Vault) |
hashicorp/go-hmac-drbg | HMAC-based Deterministic Random Bit Generator (NIST SP 800-90A) |
tink-crypto/tink-go/v2 | Google Tink AEAD for Transit engine |
ProtonMail/go-crypto + gopenpgp/v3 | PGP operations for SSH secrets engine and GPG key management |
golang.org/x/crypto | Extended crypto: scrypt, bcrypt, ed25519, X25519, AES-GCM |
Cloud SDKs#
Cloud coverage is one of Vault’s defining dependency characteristics — every major cloud needs auth methods and secret engines:
| Cloud | Packages |
|---|---|
| AWS | aws/aws-sdk-go (v1, primary), aws-sdk-go-v2/config + service packages (ec2, ecs, s3, sts, rds) |
| Azure | Azure/azure-sdk-for-go/sdk/azcore, azidentity; legacy Azure/go-autorest/*; azure-storage-blob-go |
| GCP | cloud.google.com/go/storage, /spanner, /monitoring, /cloudsqlconn; google.golang.org/api |
| Alibaba | aliyun/alibaba-cloud-sdk-go, aliyun-oss-go-sdk |
| Oracle | oracle/oci-go-sdk |
| Triton (Joyent) | joyent/triton-go |
Storage Backends#
Vault supports ~10 different physical storage backends; each requires its own client library:
| Backend | Package |
|---|---|
| PostgreSQL | jackc/pgx/v4 |
| MySQL | go-sql-driver/mysql |
| SQL Server | denisenkom/go-mssqldb |
| SAP HANA | SAP/go-hdb |
| CockroachDB | cockroachdb/cockroach-go/v2 |
| Cassandra | gocql/gocql |
| MongoDB | go.mongodb.org/mongo-driver |
| Aerospike | aerospike/aerospike-client-go/v8 |
| InfluxDB | influxdata/influxdb1-client |
| etcd v2/v3 | go.etcd.io/etcd/client/v2, /v3 |
| ZooKeeper | go-zookeeper/zk |
| FoundationDB | apple/foundationdb/bindings/go |
| Spanner | cloud.google.com/go/spanner |
| RabbitMQ | michaelklishin/rabbit-hole/v2 |
| Swift (OpenStack) | ncw/swift |
Authentication Protocol Libraries#
Auth methods require low-level protocol libraries not covered by cloud SDKs:
| Protocol | Package |
|---|---|
| LDAP | go-ldap/ldap/v3 |
| Kerberos | jcmturner/gokrb5/v8 |
| RADIUS | layeh.com/radius |
| JWT/OIDC | golang-jwt/jwt/v4, MicahParks/jwkset, MicahParks/keyfunc/v3, go-jose/go-jose/v3 |
| TOTP/OTP | pquerna/otp |
| Duo MFA | duosecurity/duo_api_golang |
| Okta | okta/okta-sdk-golang/v5, chrismalek/oktasdk-go (legacy) |
| SPIFFE/SPIRE | spiffe/go-spiffe/v2 (indirect, via CF auth) |
| Certificate Transparency | google/certificate-transparency-go |
Networking / Transport#
| Package | Purpose |
|---|---|
google.golang.org/grpc | gRPC for plugin RPC, HCP communication, etcd |
google.golang.org/protobuf | Protobuf serialization |
hashicorp/consul/api | Consul service registration and storage backend |
miekg/dns | Low-level DNS for service discovery |
pires/go-proxyproto | HAProxy PROXY protocol support |
coder/websocket | WebSocket support |
hashicorp/go-plugin (see above) | net/rpc + gRPC plugin transport |
Observability#
| Package | Purpose |
|---|---|
prometheus/client_golang | Prometheus metrics exposition |
go.opentelemetry.io/otel + sdk + trace | OpenTelemetry tracing (added in recent versions) |
armon/go-metrics | HashiCorp metrics abstraction (aggregates to prometheus, statsd, circonus, datadog) |
google/go-metrics-stackdriver | Google Cloud Monitoring backend for go-metrics |
HCP (HashiCorp Cloud Platform)#
| Package | Purpose |
|---|---|
hashicorp/hcp-sdk-go | HCP management API client |
hashicorp/hcp-link | Vault-HCP connectivity layer |
hashicorp/hcp-scada-provider | SCADA tunnel for HCP management plane |
hashicorp/vault-hcp-lib | Vault-specific HCP helper library |
Testing#
| Package | Purpose |
|---|---|
stretchr/testify | Assertions and test suites (de facto standard) |
ory/dockertest/v3 | Docker container lifecycle for integration tests |
hashicorp/vault-testing-stepwise | Vault-specific step-based acceptance test framework |
google/go-cmp | Deep value comparison with options |
go-test/deep | Deep equality checking with helpful diffs |
sasha-s/go-deadlock | Lock deadlock detection in tests |
Other Notable#
| Package | Purpose |
|---|---|
mitchellh/mapstructure | Struct ↔ map decoding (config, API request binding) |
patrickmn/go-cache | Simple in-memory TTL cache |
gammazero/workerpool | Bounded goroutine worker pool |
sethvargo/go-limiter | Rate limiting |
robfig/cron/v3 | Cron scheduling for background jobs |
oklog/run | Process group management (actor model) |
posener/complete | Shell tab completion for the CLI |
shirou/gopsutil/v3 | System stats (memory lock checks) |
hashicorp/nomad/api | Nomad integration for auth method |
go-git/go-git/v5 | Git operations for some secrets workflows |
Stdlib reliance#
Vault leans heavily on stdlib for its core plumbing. In the vault/ core package alone:
context— 162 usages (request lifecycle, cancellation, deadline propagation)fmt— 127 (error formatting, debug output)time— 92 (lease TTLs, token expiry, TOTP windows)sync— 61 (mutexes, RWMutex, WaitGroup, Once across cluster state)encoding/json— 30 (HTTP API serialization)net/http— 27 (HTTP server and client)crypto/*(tls, x509, rand, sha256, hmac) — 25+ (TLS configuration, certificate handling, HMAC seals)
The stdlib crypto packages are treated as authoritative for anything not requiring cloud-KMS integration. Third-party crypto (tink, ProtonMail, x/crypto) is additive rather than replacement.
Shared dependencies#
Dependencies shared with other projects in the analysis set (Consul P12, and broadly across HashiCorp tools):
| Dependency | Also used by |
|---|---|
hashicorp/go-hclog | Consul, Nomad, Terraform, nearly all HashiCorp tools |
hashicorp/go-memdb | Consul (for the local state store) |
hashicorp/go-immutable-radix | Consul (routing tree) |
armon/go-metrics | Consul, Nomad (metrics abstraction layer) |
hashicorp/raft | Consul (raft consensus for server peers) |
hashicorp/go-plugin | Terraform (provider RPC), Packer |
hashicorp/hcl/v2 | Terraform (primary config language) |
go.etcd.io/bbolt | Consul (BoltDB backend) |
stretchr/testify | Consul and virtually every large Go project in the set |
google.golang.org/grpc | Consul (xDS gRPC), most cloud-native projects |
mitchellh/mapstructure | Consul, Terraform, Nomad (universal config decoder) |
hashicorp/consul/api | Vault imports Consul both for service registration and as a storage backend |
Vendoring#
Vault does not vendor. The module cache (via GOMODCACHE / GOPROXY) is relied upon at build time. Given the 210+ direct dependencies, vendoring the full tree would be impractical to maintain. The CI/CD pipeline uses a module proxy (likely proxy.golang.org or an internal proxy). The 7 replace directives serve two purposes:
- In-tree submodule development:
vault/api,vault/api/auth/*, andvault/sdkare developed in the same repository but published as separate modules.replaceallows them to be tested together before release without a publish step. - Upstream bug workarounds: The
github.com/99designs/keyring→github.com/Jeffail/keyringreplace is explicitly documented — keyring has a zombiedbus-daemonbug triggered transitively viagosnowflake. Thesignedxmlreplace pins a moov-io fork.
Notable dependency decisions#
HashiCorp’s internal library stack vs. community alternatives: Vault uses hashicorp/cli instead of cobra, hashicorp/go-hclog instead of zap or logrus, and hashicorp/hcl instead of viper. This is a deliberate HashiCorp philosophy — own your toolchain. This creates tight coupling within the HashiCorp ecosystem but avoids external breakage.
Dual AWS SDK versions: Both aws-sdk-go (v1) and aws-sdk-go-v2/config appear as direct dependencies. V1 powers legacy components (IAM auth, S3 backend) that have not been migrated; v2 is used for newer services (RDS IAM auth). The coexistence adds ~3MB of binary bloat and is a known tech debt item common to large AWS-dependent Go projects.
All plugins compiled in: Unlike a true dynamic plugin system, Vault’s built-in plugins are compiled into the main binary as direct Go imports (the same binary is then extracted and re-executed as a subprocess by go-plugin). This means the main module’s go.mod accumulates the transitive dependencies of every built-in plugin — explaining much of the 210-dep count. A microservices or separately-compiled plugin model would dramatically reduce the core module’s dependency footprint.
KMS wrapping abstraction: The go-kms-wrapping family (7 wrappers) is a textbook dependency inversion: Vault’s seal subsystem depends on an interface (Wrapper), and each cloud KMS is a separate module satisfying that interface. This lets users avoid compiling in all cloud SDKs — but the current monorepo approach imports all of them anyway.
No Viper for configuration: Despite Viper being almost ubiquitous in Go CLIs, Vault uses hashicorp/hcl directly for its configuration files and hashicorp/go-secure-stdlib/parseutil for individual values. This is intentional: HCL provides richer syntax and clearer error messages for operator configuration than TOML/YAML-based Viper.
pkg/errors present but fading: github.com/pkg/errors appears as a direct dependency (used in some older packages), while newer code uses fmt.Errorf with %w. This mixed usage is typical of a codebase that predates Go 1.13 error wrapping but is gradually migrating.