hclsyntax: Impose an upper limit on a refined prefix in TemplateExpr#617
Conversation
There is no limit to the length of string prefixes produced by template expressions, so in rare cases they may return a refined unknown string has too long a prefix. The cty's msgpack decoder limits the size of an acceptable refinements to 1 kiB, so such a value cannot be handled and an error occurs. This change limits the length of prefixes to 128 B, so overly long prefixes are no longer an issue in most cases.
|
Thanks for this fix, @wata727! I'm going to merge this now, but I expect we'll wait to tag a new HCL release and upgrade Terraform's dependency for now because the first Terraform release including refinements is not due for a while yet and we'll probably find some other quirks of this new functionality we'll also want to patch before release, and so hopefully we can bundle them together into a single HCL release if so. I have also spent a little time thinking about how to solve this more generally in (Based on my research so far, the most significant benefits I anticipated with this feature were making |
Fixes #616
There is no limit to the length of string prefixes produced by template expressions, so in rare cases they may return a refined unknown string has too long a prefix.
The
cty's msgpack decoder limits the size of an acceptable refinements to 1 kiB, so such a value cannot be handled and an error occurs.This change limits the length of prefixes to 128 B, so overly long prefixes are no longer an issue in most cases.