-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add limit to JSON nesting depth #31069
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
Conversation
Build Results: |
helper/json/complex_json.go
Outdated
"strings" | ||
) | ||
|
||
func GenerateComplexJSON(depth int) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this being used. Seems like a great function to use in unit tests.
sdk/helper/jsonutil/json.go
Outdated
} | ||
|
||
// This function avoids building the full map in memory, suitable for very deep JSON. | ||
func calculateMaxDepthStreaming(jsonReader io.Reader) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may be able to benefit from writing unit tests that use both generated JSON data and known challenging JSON data. That' s not to say the function is wrong, I don't think it is, rather to say it can't hurt to be sure.
1f938e6
to
c32da58
Compare
CI Results: |
6316e2e
to
7719c10
Compare
7719c10
to
70a50cd
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Description
Add limit to JSON nesting depth
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.