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

address various issues with the output-policy flag #19160

Merged
merged 15 commits into from
Feb 21, 2023

Conversation

lursu
Copy link
Collaborator

@lursu lursu commented Feb 13, 2023

Addressing various issues called out by this sustaining issue, some are not going to be fixed by this PR but rather in a longer term follow up initiative to change how we handle the policy building.
For now though we will address the following which were tested locally:

  1. Update the error message when trying to generate a policy for kvV2 where /data/ is not properly contained in the path provided.

  2. Capture the list url param that is passed on list commands since a lists HTTP Verb is GET instead of LIST.

  3. Since we have aggressive and decentralized path sanitization for all command requests, we needed to change the sudo path regex for paths with a trailing /. The change is to make the trailing / optional since it is technically correct to have it but every command removes the users input before we could check the path.

@lursu lursu added the devex Developer Experience label Feb 13, 2023
@lursu lursu added this to the triaged milestone Feb 13, 2023
@lursu lursu requested a review from digivava February 13, 2023 14:28
@lursu lursu changed the title update error message and properly handle list requests address various issues with the output-policy flag Feb 13, 2023
@lursu lursu marked this pull request as ready for review February 14, 2023 18:39
@lursu lursu requested review from danielehc and averche February 14, 2023 19:43
changelog/13106.txt Outdated Show resolved Hide resolved
api/output_policy.go Outdated Show resolved Hide resolved
api/output_policy.go Show resolved Hide resolved
api/output_policy.go Outdated Show resolved Hide resolved
if d.params.Has(listKey) {
isList, err := strconv.ParseBool(d.params.Get(listKey))
if err != nil {
return "", err
Copy link
Contributor

Choose a reason for hiding this comment

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

This error could probably be improved with some context. Alternatively you can simply check for strings.Lower(d.params.Get("list")) == "true" or something similar

command/kv_helpers.go Outdated Show resolved Hide resolved
@lursu lursu requested review from digivava and averche February 15, 2023 18:03
api/output_policy_test.go Show resolved Hide resolved
api/output_policy.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@digivava digivava left a comment

Choose a reason for hiding this comment

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

Tested it with make dev and it seems to be working well! Thanks a bunch for handling these cases.

@lursu lursu merged commit a5fb552 into main Feb 21, 2023
@lursu lursu deleted the VAULT-13106/address_issues_with_output-policy_flag branch February 21, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devex Developer Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants