-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
KVMaxValueSize should not be enforced on entire txn endpoint data #6767
Comments
@VasuCigareddy I agree that something seems up with using the content length here for a number of reasons. As for the combined kv size check after the initial content length check, that is because the first check is more of a preliminary check. The content coming in will be JSON encoded whereas when this data makes it into Raft it will be msgpack encoded and thus much smaller. We do the preliminary check at all as an attempt to prevent decoding requests which we know will get thrown out. With that being said, that initial checks value probably does need updating to account for the datas reduction in size after decoding. |
Hi @mkeeler Lines 108 to 114 in 2dfa10a
About "combined kv size check" - why to check the size of all KVs if the limit is applied only for 1 KV? Or we misunderstand the meaning of KVMaxValueSize ? consul/agent/config/runtime.go Lines 802 to 806 in 5e1c6e9
|
@mkeeler, I would expect the content-length check to be KV endpoint does the exact same check for single KV PUT, so I would expect Lines 177 to 182 in 89158c7
And same for Lines 117 to 120 in 2dfa10a
|
Looked at this again and I agree that Maybe this is useful: https://golang.org/pkg/net/http/#MaxBytesReader. Any thoughts? |
Thanks @VasuCigareddy for the very detailed description! After digging into the #7388 adds configurable Please reach out if you have any followup concerns on the approach |
Overview of the Issue
txn
endpoint is used for service,node and check transactions along with KV. But in the code the entire 'content-length' header is checked against KVMaxValueSize which is probably incorrect?consul/agent/txn_endpoint.go
Lines 69 to 78 in 2dfa10a
And if
KVMaxValueSize
is for single/individual KV size, why check for combined KV size in txn endpoint?consul/agent/txn_endpoint.go
Lines 254 to 261 in 2dfa10a
Reproduction Steps
Steps to reproduce this issue, eg:
Follow the example here and create a txn payload size greater than 512KB (Not KV, but all ops)
https://www.consul.io/api/txn.html
You can also reproduce the issue by sending http payload to txn endpoint with 60KV and each KV with 9KB data.
Use Consul as Vault storage backend and store big secret(KV) with size 200KB data - In this case (at least in our environment), the vault was adding roughly 300KB data to txn endpoint so the whole data to txn endpoint is crossing 512KB which because of
content-length
header breaks/errors out.Consul info for both Client and Server
Client info
Server info
Operating system and Environment details
OS: CentOS Linux release 7.6.1810 (Core)
The text was updated successfully, but these errors were encountered: