Skip to content

bug (go api): Sys.Capabilities* methods don't match API spec #31376

@lrstanley

Description

@lrstanley

Describe the bug
It looks as though the Sys.Capabilities* related Go API methods only apply against 1 path; however, it looks as though the API moving forward expects paths as an array. This currently works as the API is backwards compatible; however, the methods no longer align with the API.

func (c *Sys) CapabilitiesSelf(path string) ([]string, error)
func (c *Sys) CapabilitiesSelfWithContext(ctx context.Context, path string) ([]string, error)
func (c *Sys) Capabilities(token, path string) ([]string, error)
func (c *Sys) CapabilitiesWithContext(ctx context.Context, token, path string) ([]string, error)
func (c *Sys) CapabilitiesAccessor(accessor, path string) ([]string, error)
func (c *Sys) CapabilitiesAccessorWithContext(ctx context.Context, accessor, path string) ([]string, error)

To Reproduce
n/a: https://github.com/hashicorp/vault/blob/v1.20.1/api/sys_capabilities.go

Expected behavior
I would expect the Go API methods to match that which is expected of the API. Spec example (for /sys/capabilities-self): https://developer.hashicorp.com/vault/api-docs/system/capabilities-self#sample-payload

Environment:

  • Vault Server Version (retrieve with vault status): n/a (current main, and v1.20.1 tag)
  • Vault CLI Version (retrieve with vault version): n/a
  • Server Operating System/Architecture: n/a

Additional context

Not sure if it's typical to break the client API module to keep it in sync with the API. If so, this would be a breaking change to correct it; otherwise, you'd have to maintain additional methods for all of the highlighted functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUsed to indicate a potential bugcore/api

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions