Summary
In version 0.10.10, the kubernetesLogin command uses a mustache template for its path: /auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login. However, the kubernetesPath variable is not passed to the template context (it is present only on the client object, not in the args), resulting in an incomplete path like /auth//login instead of the expected /auth/kubernetes/login.
To reproduce
- Use node-vault v0.10.10.
- Attempt a Kubernetes login using
vault.kubernetesLogin({role: 'my-role', jwt: 'my-jwt'}) without manually specifying kubernetesPath.
- The resulting path for the API request is
/auth//login (missing the mount point).
Code reference
In src/commands.js:
path: '/auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login'
In src/index.js, only user args are passed to mustache, not client.kubernetesPath.
Expected behavior
The library should supply kubernetesPath correctly in the template context, defaulting to 'kubernetes', so the POST goes to /auth/kubernetes/login unless overridden.
Actual behavior
Unless kubernetesPath is manually passed, path renders as /auth//login due to missing template context.
Workaround
Pass kubernetesPath: 'kubernetes' explicitly in the login args when using v0.10.10:
vault.kubernetesLogin({role: 'my-role', jwt: 'my-jwt', kubernetesPath: 'kubernetes'})
Fix
This was fixed in v0.12.0 by correctly passing the context for mustache rendering, so upgrading resolves the issue.
Version
Additional context
- The documentation should mention this as a known bug affecting v0.10.10 and related versions, with advice for users to upgrade or use the workaround above.
Summary
In version 0.10.10, the
kubernetesLogincommand uses a mustache template for its path:/auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login. However, thekubernetesPathvariable is not passed to the template context (it is present only on the client object, not in the args), resulting in an incomplete path like/auth//logininstead of the expected/auth/kubernetes/login.To reproduce
vault.kubernetesLogin({role: 'my-role', jwt: 'my-jwt'})without manually specifyingkubernetesPath./auth//login(missing the mount point).Code reference
In
src/commands.js:path: '/auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login'In
src/index.js, only user args are passed to mustache, notclient.kubernetesPath.Expected behavior
The library should supply
kubernetesPathcorrectly in the template context, defaulting to 'kubernetes', so the POST goes to/auth/kubernetes/loginunless overridden.Actual behavior
Unless
kubernetesPathis manually passed, path renders as/auth//logindue to missing template context.Workaround
Pass
kubernetesPath: 'kubernetes'explicitly in the login args when using v0.10.10:Fix
This was fixed in v0.12.0 by correctly passing the context for mustache rendering, so upgrading resolves the issue.
Version
Additional context