Skip to content

Unable to list secrets at the root of a KV2 secrets engine #255

@RyanW8

Description

@RyanW8

Expected Behavior

The KvV2List function should return secrets & folders at the root of the secret engine when path is empty.

Current Behavior

Throws a 404 error.

Failure Information

We're running Vault enterprises and are utilizing enterprise namespaces.

vault-client-go: v1.19.0
vault: v1.15.4
Vault Enterprises with namespaces enabled/being used

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Setup Vault client & try and list secrets at the root
	client, err := vault.New(
		vault.WithAddress(config.VAULT_ADDR),
		vault.WithRequestTimeout(30*time.Second))
	if err != nil {
		return nil, err
	}
	err = client.SetNamespace("<your_namespace>")
	if err != nil {
		return nil, err
	}
	resp, err := client.Auth.JwtLogin(
		context.TODO(), schema.JwtLoginRequest{
                        Jwt: "<your_jwt_here>",
			Role: "<your_role>",
		}, vault.WithMountPath("<mount_path>"))
	if err := client.SetToken(resp.Auth.ClientToken); err != nil {
		return nil, err
	}
       resp, err := client.Secrets.KvV2List(ctx, "", vault.WithMountPath("<your_mount_path>")) // This throws an error

...

Additional Information

Error thrown:

{"level":"fatal","ts":1710409697.041736,"caller":"vault-secret-expiry-notifier/main.go:36","msg":"404 Not Found: no handler for route \"<vault_namespace>/<secret_engine_mount_path>/metadata/\". route entry not found.","stacktrace":"main.main\n\t/Users/R713887/Documents/vault-secret-expiry-notifier/main.go:36\nruntime.main\n\t/usr/local/jpmc/go-1.21.5/src/runtime/proc.go:267"}

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