Skip to content

Bug: kubernetesLogin uses {{kubernetesPath}} mustache variable but it's not passed, causing /auth//login path in v0.10.10 #300

@suchismitagoswami1994

Description

@suchismitagoswami1994

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

  1. Use node-vault v0.10.10.
  2. Attempt a Kubernetes login using vault.kubernetesLogin({role: 'my-role', jwt: 'my-jwt'}) without manually specifying kubernetesPath.
  3. 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

  • node-vault: 0.10.10

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions