Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vault path-help for selected paths with bad regexps #18571

Merged
merged 7 commits into from
Jun 30, 2023

Conversation

maxb
Copy link
Contributor

@maxb maxb commented Dec 29, 2022

Describe the bug
When a Vault API path has been defined with a regex that requires a final slash, the vault path-help command is unable to retrieve help for it.

Underlying cause
Vault's code automatically appends a trailing slash on to all paths used for ListOperations, but removes a trailing slash for all other operations, including HelpOperations. In order for a path pattern to match both ListOperation and HelpOperation, it must accept both the presence and absence of a trailing slash.

To Reproduce, or test the fix

  1. Start a Vault dev server
  2. Run vault path-help auth/token/accessors/
  3. See an unsupported path error

Expected behavior
Help message displayed as expected.

Fix
Update the few path regex patterns that fall into this trap to end with /? instead of /.

Update a comment to explain why.

maxb added 3 commits December 29, 2022 09:08
See the comment being added in `sdk/framework/path.go` for the
explanation of why this change is needed.
@maxb
Copy link
Contributor Author

maxb commented Apr 27, 2023

Hi @hsimon-hashicorp @miagilepner,

Apologies for the direct @-ing - I wasn't sure if there was any better contact method, so I just picked some people I have seen triage community submissions in the past.

I have quite a few open Vault PRs that have been sitting around for a while, so I picked this one - one of my smaller, hopefully easier to review ones - in which to ask: Is there anything I can do to make these easier for HashiCorp engineers to review and merge?

@hghaf099
Copy link
Contributor

hghaf099 commented May 5, 2023

@maxb I will be reviewing this PR. Thanks for putting it together. It looks great from the first glance. I just need to confirm the changes to the sudo paths internally.

Copy link
Contributor

@averche averche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me. I've tried out the steps to reproduce the issue and the fix and both work! Thanks again for contributing, @maxb!

I'll let @hghaf099 confirm the sudo path logic and merge the PR.

@maxb
Copy link
Contributor Author

maxb commented Jun 15, 2023

@maxb I will be reviewing this PR. Thanks for putting it together. It looks great from the first glance. I just need to confirm the changes to the sudo paths internally.

@hghaf099 Please let me know if there is any evidence I can gather and add to this PR to assist with this process?

It would be great to get it in before its 6-month anniversary, and then I can move on to trying to attract a HashiCorp sponsor to some of my other open PRs.

Copy link
Contributor

@hghaf099 hghaf099 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

api/plugin_helpers.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants