mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(cloudwatch): decompress gzip JSON PutMetricData bodies The AWS CLI and the SDKs that speak JSON 1.0 to CloudWatch gzip a PutMetricData body of 10 KiB or more and send Content-Encoding: gzip. AwsJsonController binds the body as a String, so Floci read the compressed bytes as text and every such request failed with HTTP 400 SerializationException. The metrics were never stored. Add a reader interceptor that decompresses that one operation's body when the controller reads it. It runs after every request filter, so the signature is still verified over the compressed bytes the client signed, and IAM still decides the request from X-Amz-Target first, which is sound because nothing in that decision comes from the body. The decompressed body is bounded by the decoder the CBOR protocol already uses: past 10 MiB it returns HTTP 413 PayloadTooLargeException, and a body that cannot be decompressed returns HTTP 400 InvalidRequestException, both in the controller's JSON error format. A name binding keeps the interceptor on AwsJsonController alone, so every other resource reads its body as before. In the native image a global reader interceptor breaks the tag endpoints that resources inherit from AbstractTagsController, because Quarkus REST then looks their methods up reflectively. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(cloudwatch): publish a compressed metric batch through boto3 botocore gzips a PutMetricData body of 10 KiB or more, and with the pinned boto3 it calls CloudWatch over JSON 1.0. The Python compatibility suite only ever sent a handful of datums, so it never sent a compressed request. Send a 100-datum batch, check that botocore sent it as JSON 1.0 with Content-Encoding: gzip, and check that all 100 metrics are listed afterwards. Checking the content type keeps the test from passing through the CBOR path, which already decompressed gzip, should a later botocore prefer CBOR. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * chore(cloudwatch): reuse signed IAM test users --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>