hashicorp / vault-plugin-secrets-azure

Vault Azure Secrets plugin
Mozilla Public License 2.0
26 stars 19 forks source link

Changes User-Agent header generation #93

Closed austingebauer closed 2 years ago

austingebauer commented 2 years ago

Overview

This PR changes User-Agent header generation to rely on the result of PluginEnv(). This will allow the plugin to correctly determine version information when running as builtin or external to Vault. Currently, the version information may not be correct if running as an external plugin.

Additionally, this fixes usage attribution to include the missing pid- prefix per Azure documentation.

Testing

I've verified that the result of PluginEnv() is correct using Vault oss and enterprise. If VersionMetadata is not empty, we can assume the build is enterprise.

See the version format from various Vault builds:

# Format
Vault v<Version>-<VersionPrerelease>+<VersionMetadata> (<Revision>)

# OSS
$ vault version
Vault v1.10.0 (7738ec5d0d6f5bf94a809ee0f6ff0142cfa525a6)

# Enterprise
$ vault version
Vault v1.10.0+ent (d71d7710888891761ce43ec4e5f9d9fdeff31d8e)

# OSS Release Candidate
$ vault version
Vault v1.10.0-rc1 (3c389362c05c41a014dac7ad9aed393c8f69b125)

# Enterprise Release Candidate
$ vault version
Vault v1.10.0-rc1+ent (0886b5e08b93d4a5e140e11717934aa4042e7d3f)

# OSS Dev
$ vault version
Vault v1.11.0-dev1 ('aed9514c21481603bd8f04ea14e4717189c7df36')

# Enterprise Dev
$ vault version
Vault v1.11.0-dev1+prem ('410cf4829e685cf8ce9624795bc3fab96692111b')

Additional testing will be done to ensure that the GUIDs work as expected for attribution.