VAULT-32657 prevent duplicate keys in HCL files#29862
Closed
bosouza wants to merge 11 commits into
Closed
Conversation
|
CI Results: failed ❌
|
📄 Content ChecksUpdated: Mon, 24 Mar 2025 15:27:21 GMT Found 4 error(s)
|
| Position | Description | Rule |
|---|---|---|
1:1-1:1 |
Document does not have a page_title key in its frontmatter. Add a page_title key at the top of the document. |
ensure-valid-frontmatter |
1:1-1:1 |
Document does not have a description key in its frontmatter. Add a description key at the top of the document. |
ensure-valid-frontmatter |
1:1-1:1 |
This file is not present in the nav data file at data/docs-nav-data.json. Either add a path that maps to this file in the nav data or remove the file. If you want the page to exist but not be linked in the navigation, add a hidden property to the associated nav node. |
no-unlinked-pages |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Turns out the simple breaking change approach proposed in this PR is not acceptable, we'll instead need to use the deprecation process to ensure users have time to adapt without disrupting updates, especially regarding automated policy definitions that would all break with this change if using duplicate attributes. Also, the work here was not completed
As discussed in hashicorp/hcl#35, HCL has allowed duplicate keys where the last one "wins", which has been flagged as a security risk. A fix preventing duplicate keys in HCL was added in hashicorp/hcl#704, and additional methods for preserving the old behavior came in hashicorp/hcl#707.
This PR upgrades all HCL dependencies to the fixed version, which effectively introduces a breaking change where all HCL files accepted by Vault that might have previously worked fine containing duplicate keys will now fail to be parsed, erroring out the operation. This is a comprehensive list of affected features:
vaultCLI commands:$HOME/.vaultHCL file withtoken_helperfield-configHCL file passed tovault operator migratecommand-configHCL file passed tovault agentcommand-configHCL file passed tovault proxycommand-configHCL file passed tovault operator diagnosecommand-configHCL file passed tovault servercommand/sys/policies/password/:namecannot have duplicate fields anymore/sys/policies/password/:name/generate)TODO only if you're a HashiCorp employee
backport/label that matches the desired release branch. Note that in the CE repo, the latest release branch will look likebackport/x.x.x, but older release branches will bebackport/ent/x.x.x+ent.of a public function, even if that change is in a CE file, double check that
applying the patch for this PR to the ENT repo and running tests doesn't
break any tests. Sometimes ENT only tests rely on public functions in CE
files.
in the PR description, commit message, or branch name.
description. Also, make sure the changelog is in this PR, not in your ENT PR.