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:

PackagePurpose
hashicorp/cliCLI framework (HashiCorp fork of mitchellh/cli; not cobra)
hashicorp/go-hclogStructured, leveled logger used everywhere in Vault
hashicorp/hcl + hashicorp/hcl/v2HCL1 (legacy config) and HCL2 (modern config parsing)
hashicorp/errwrap + go-multierrorError wrapping and aggregation primitives
hashicorp/go-memdbIn-memory database with indexing, used for cluster state
hashicorp/go-immutable-radixRadix tree for policy/path routing
hashicorp/golang-lru + v2LRU cache (token cache, lease cache)
hashicorp/go-retryablehttp + go-cleanhttpResilient HTTP clients
hashicorp/go-secure-stdlib/*~14 micro-packages for secrets-safe utilities (mlock, tlsutil, parseutil, strutil, nonceutil, permitpool, etc.)
hashicorp/go-sockaddrIP/CIDR manipulation for listener and access policy
hashicorp/go-uuid, go-versionUUID generation and semver comparison
hashicorp/go-bexprBoolean expression evaluator for filter queries
hashicorp/go-discoverMulti-cloud service auto-discovery for cluster join
hashicorp/eventloggerAudit event pipeline framework
hashicorp/cap + cap/ldapCapabilities 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:

PackagePurpose
hashicorp/raftCore Raft consensus implementation
hashicorp/raft-autopilotAutomated peer management for Raft clusters
hashicorp/raft-boltdb/v2BoltDB-backed stable store for Raft log
hashicorp/raft-walWrite-ahead log for Raft (newer WAL storage)
hashicorp/raft-snapshotRaft snapshot management
hashicorp/go-raftchunkingChunked log entries for large Raft writes
go.etcd.io/bboltBoltDB (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:

PackagePurpose
hashicorp/go-plugingRPC-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-stepwiseVault-specific framework for step-based plugin acceptance tests
hashicorp/vault/api + vault/sdkIn-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:

PackagePurpose
hashicorp/go-kms-wrapping/v2Envelope encryption abstraction (the “seal” interface)
go-kms-wrapping/wrappers/aead/v2AEAD software seal
go-kms-wrapping/wrappers/awskms/v2AWS KMS auto-unseal
go-kms-wrapping/wrappers/azurekeyvault/v2Azure Key Vault auto-unseal
go-kms-wrapping/wrappers/gcpckms/v2GCP CKMS auto-unseal
go-kms-wrapping/wrappers/alicloudkms/v2Alibaba Cloud KMS auto-unseal
go-kms-wrapping/wrappers/ocikms/v2Oracle OCI KMS auto-unseal
go-kms-wrapping/wrappers/transit/v2Vault Transit engine as external seal (chained Vault)
hashicorp/go-hmac-drbgHMAC-based Deterministic Random Bit Generator (NIST SP 800-90A)
tink-crypto/tink-go/v2Google Tink AEAD for Transit engine
ProtonMail/go-crypto + gopenpgp/v3PGP operations for SSH secrets engine and GPG key management
golang.org/x/cryptoExtended 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:

CloudPackages
AWSaws/aws-sdk-go (v1, primary), aws-sdk-go-v2/config + service packages (ec2, ecs, s3, sts, rds)
AzureAzure/azure-sdk-for-go/sdk/azcore, azidentity; legacy Azure/go-autorest/*; azure-storage-blob-go
GCPcloud.google.com/go/storage, /spanner, /monitoring, /cloudsqlconn; google.golang.org/api
Alibabaaliyun/alibaba-cloud-sdk-go, aliyun-oss-go-sdk
Oracleoracle/oci-go-sdk
Triton (Joyent)joyent/triton-go

Storage Backends#

Vault supports ~10 different physical storage backends; each requires its own client library:

BackendPackage
PostgreSQLjackc/pgx/v4
MySQLgo-sql-driver/mysql
SQL Serverdenisenkom/go-mssqldb
SAP HANASAP/go-hdb
CockroachDBcockroachdb/cockroach-go/v2
Cassandragocql/gocql
MongoDBgo.mongodb.org/mongo-driver
Aerospikeaerospike/aerospike-client-go/v8
InfluxDBinfluxdata/influxdb1-client
etcd v2/v3go.etcd.io/etcd/client/v2, /v3
ZooKeepergo-zookeeper/zk
FoundationDBapple/foundationdb/bindings/go
Spannercloud.google.com/go/spanner
RabbitMQmichaelklishin/rabbit-hole/v2
Swift (OpenStack)ncw/swift

Authentication Protocol Libraries#

Auth methods require low-level protocol libraries not covered by cloud SDKs:

ProtocolPackage
LDAPgo-ldap/ldap/v3
Kerberosjcmturner/gokrb5/v8
RADIUSlayeh.com/radius
JWT/OIDCgolang-jwt/jwt/v4, MicahParks/jwkset, MicahParks/keyfunc/v3, go-jose/go-jose/v3
TOTP/OTPpquerna/otp
Duo MFAduosecurity/duo_api_golang
Oktaokta/okta-sdk-golang/v5, chrismalek/oktasdk-go (legacy)
SPIFFE/SPIREspiffe/go-spiffe/v2 (indirect, via CF auth)
Certificate Transparencygoogle/certificate-transparency-go

Networking / Transport#

PackagePurpose
google.golang.org/grpcgRPC for plugin RPC, HCP communication, etcd
google.golang.org/protobufProtobuf serialization
hashicorp/consul/apiConsul service registration and storage backend
miekg/dnsLow-level DNS for service discovery
pires/go-proxyprotoHAProxy PROXY protocol support
coder/websocketWebSocket support
hashicorp/go-plugin (see above)net/rpc + gRPC plugin transport

Observability#

PackagePurpose
prometheus/client_golangPrometheus metrics exposition
go.opentelemetry.io/otel + sdk + traceOpenTelemetry tracing (added in recent versions)
armon/go-metricsHashiCorp metrics abstraction (aggregates to prometheus, statsd, circonus, datadog)
google/go-metrics-stackdriverGoogle Cloud Monitoring backend for go-metrics

HCP (HashiCorp Cloud Platform)#

PackagePurpose
hashicorp/hcp-sdk-goHCP management API client
hashicorp/hcp-linkVault-HCP connectivity layer
hashicorp/hcp-scada-providerSCADA tunnel for HCP management plane
hashicorp/vault-hcp-libVault-specific HCP helper library

Testing#

PackagePurpose
stretchr/testifyAssertions and test suites (de facto standard)
ory/dockertest/v3Docker container lifecycle for integration tests
hashicorp/vault-testing-stepwiseVault-specific step-based acceptance test framework
google/go-cmpDeep value comparison with options
go-test/deepDeep equality checking with helpful diffs
sasha-s/go-deadlockLock deadlock detection in tests

Other Notable#

PackagePurpose
mitchellh/mapstructureStruct ↔ map decoding (config, API request binding)
patrickmn/go-cacheSimple in-memory TTL cache
gammazero/workerpoolBounded goroutine worker pool
sethvargo/go-limiterRate limiting
robfig/cron/v3Cron scheduling for background jobs
oklog/runProcess group management (actor model)
posener/completeShell tab completion for the CLI
shirou/gopsutil/v3System stats (memory lock checks)
hashicorp/nomad/apiNomad integration for auth method
go-git/go-git/v5Git 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):

DependencyAlso used by
hashicorp/go-hclogConsul, Nomad, Terraform, nearly all HashiCorp tools
hashicorp/go-memdbConsul (for the local state store)
hashicorp/go-immutable-radixConsul (routing tree)
armon/go-metricsConsul, Nomad (metrics abstraction layer)
hashicorp/raftConsul (raft consensus for server peers)
hashicorp/go-pluginTerraform (provider RPC), Packer
hashicorp/hcl/v2Terraform (primary config language)
go.etcd.io/bboltConsul (BoltDB backend)
stretchr/testifyConsul and virtually every large Go project in the set
google.golang.org/grpcConsul (xDS gRPC), most cloud-native projects
mitchellh/mapstructureConsul, Terraform, Nomad (universal config decoder)
hashicorp/consul/apiVault 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:

  1. In-tree submodule development: vault/api, vault/api/auth/*, and vault/sdk are developed in the same repository but published as separate modules. replace allows them to be tested together before release without a publish step.
  2. Upstream bug workarounds: The github.com/99designs/keyringgithub.com/Jeffail/keyring replace is explicitly documented — keyring has a zombie dbus-daemon bug triggered transitively via gosnowflake. The signedxml replace 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.