-
Notifications
You must be signed in to change notification settings - Fork 4.6k
VAULT-32657 deprecate duplicate attributes in HCL configs and policies #30386
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
Merged
Merged
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
60e5753
upgrade hcl dependency on api pkg
bosouza 9501cc6
upgrade hcl dependency in vault and sdk pkgs
bosouza 91d8a46
upgrade hcl dependency in vault and sdk pkgs
bosouza c2e11d6
add CLI warnings to commands that take a config
bosouza 7484d18
ignore duplicates on ParseKMSes function
bosouza e29d148
Extend policy parsing functions and warn on policy store
bosouza b91c99c
Add warning on policy fmt with duplicate attributes
bosouza 22bd1a4
Add warnings when creating/updating policy with duplicate HCL attrs
bosouza f48560d
Add log warning when switchedGetPolicy finds duplicate attrs
bosouza c79bc6a
Print log warnings when token inline policy has duplicate attrs
bosouza b58ee1f
add changelog and deprecation notice
bosouza 8354b4d
add missing copywrite notice
bosouza 10a3ea4
Merge branch 'main' into bosouza-deprecate-dup-attr
bosouza 34257cc
fix copy-paste mistake
bosouza 4a08a11
Fix manual parsing of telemetry field in SharedConfig
bosouza 690ef94
Fix linter complaints
bosouza 999fb98
Merge remote-tracking branch 'origin/bosouza-deprecate-dup-attr' into…
bosouza 0067e12
Update command/base_predict.go
bosouza 548b95e
address review
bosouza 9341702
merge main
bosouza 6c27923
remove copywrite headers
bosouza 3baa944
re-add copywrite headers
bosouza cc2613d
make fmt
bosouza 28874cc
Merge branch 'main' into bosouza-deprecate-dup-attr
bosouza fd7190d
Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx
bosouza 230c01e
Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx
bosouza 16c70fe
Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx
bosouza 8d89915
undo changes to deprecation.mdx
bosouza e9b514d
remove deprecation doc
bosouza f9a249f
Merge branch 'main' into bosouza-deprecate-dup-attr
bosouza 22a2f0d
merge main
bosouza 49d1ed4
Merge branch 'main' into bosouza-deprecate-dup-attr
bosouza 7a503c1
fix conflict with changes from main
bosouza 7e60f7c
Merge branch 'main' into bosouza-deprecate-dup-attr
bosouza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) HashiCorp, Inc. | ||
| // SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| package cliconfig | ||
|
|
||
| import ( | ||
| "strings" | ||
|
|
||
| "github.com/hashicorp/hcl" | ||
| "github.com/hashicorp/hcl/hcl/ast" | ||
| hclParser "github.com/hashicorp/hcl/hcl/parser" | ||
| ) | ||
|
|
||
| // parseAndCheckForDuplicateHclAttributes parses the input JSON/HCL file and if it is HCL it also checks | ||
| // for duplicate keys in the HCL file, allowing callers to handle the issue accordingly. In a future release we'll | ||
| // change the behavior to treat duplicate keys as an error and eventually remove this helper altogether. | ||
| // TODO (HCL_DUP_KEYS_DEPRECATION): remove once not used anymore | ||
| func parseAndCheckForDuplicateHclAttributes(input string) (res *ast.File, duplicate bool, err error) { | ||
| res, err = hcl.Parse(input) | ||
| if err != nil && strings.Contains(err.Error(), "Each argument can only be defined once") { | ||
| duplicate = true | ||
| res, err = hclParser.ParseDontErrorOnDuplicateKeys([]byte(input)) | ||
| } | ||
| return res, duplicate, err | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) HashiCorp, Inc. | ||
| // SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| package api | ||
|
|
||
| import ( | ||
| "strings" | ||
|
|
||
| "github.com/hashicorp/hcl" | ||
| "github.com/hashicorp/hcl/hcl/ast" | ||
| hclParser "github.com/hashicorp/hcl/hcl/parser" | ||
| ) | ||
|
|
||
| // parseAndCheckForDuplicateHclAttributes parses the input JSON/HCL file and if it is HCL it also checks | ||
| // for duplicate keys in the HCL file, allowing callers to handle the issue accordingly. In a future release we'll | ||
| // change the behavior to treat duplicate keys as an error and eventually remove this helper altogether. | ||
| // TODO (HCL_DUP_KEYS_DEPRECATION): remove once not used anymore | ||
| func parseAndCheckForDuplicateHclAttributes(input string) (res *ast.File, duplicate bool, err error) { | ||
| res, err = hcl.Parse(input) | ||
| if err != nil && strings.Contains(err.Error(), "Each argument can only be defined once") { | ||
| duplicate = true | ||
| res, err = hclParser.ParseDontErrorOnDuplicateKeys([]byte(input)) | ||
| } | ||
| return res, duplicate, err | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| vault_addr="http://127.0.0.1:8200" | ||
| vault_addr="http://127.0.0.1:8201" | ||
| ssh_mount_point="ssh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ```release-note:deprecation | ||
| core: deprecate duplicate attributes in HCL configuration files and policy definitions | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.