8000 fix: kinesis CBOR blob handling by simonrw · Pull Request #11220 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

fix: kinesis CBOR blob handling #11220

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

Merged
merged 4 commits into from
Jul 18, 2024
Merged

Conversation

simonrw
Copy link
Contributor
@simonrw simonrw commented Jul 16, 2024

Motivation

A report from a customer showed that a round trip of data through a Kinesis stream from LocalStack did not preserve the data content.

For example:

  • PutRecord in Kinesis stream, "test data"
  • GetRecords from kinesis stream, convert 1st record to String, which turns out different from "test data": ��-u�Z

They were using the Java SDK. When testing on AWS, a GetRecords request returns the message body (decoded as a String) of "test data" correctly.

Since this is exercised via the Java SDK, it is the handling of the CBOR format that it as fault. It turned out that we did not parse CBOR blobs correctly.

  • fix CBOR timestamp parsing #11133 made some changes to the CBOR parsing to do with timestamps milliseconds vs seconds.
  • As part of this change, the BaseJSONRequestParser._parse_blob method was removed.
  • This meant that blob data types (like plain strings) were parsed using the RequestParser._parse_blob method, which incorrectly base64-decoded the value.
  • This PR also updated tests/unit/aws/protocol/test_parser.py::test_json_cbor_blob_parsing to test this incorrect behaviour.

Changes

This PR reverts the removal of BaseJSONRequestParser._parse_blob and updates the relevant test accordingly.

@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label Jul 16, 2024
@simonrw simonrw self-assigned this Jul 16, 2024
Copy link
github-actions bot commented Jul 16, 2024

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   3m 25s ⏱️
404 tests 352 ✅  52 💤 0 ❌
808 runs  704 ✅ 104 💤 0 ❌

Results for commit e380b77.

♻️ This comment has been updated with latest results.

Copy link
github-actions bot commented Jul 16, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 34m 37s ⏱️ +36s
3 207 tests +1  2 805 ✅ +1  402 💤 ±0  0 ❌ ±0 
3 209 runs  +1  2 805 ✅ +1  404 💤 ±0  0 ❌ ±0 

Results for commit e380b77. ± Comparison against base commit 94cb37f.

♻️ This comment has been updated with latest results.

@simonrw simonrw force-pushed the fix/kinesis-cbor-blob-handling branch from 85fc90a to ae6fa28 Compare July 17, 2024 16:13
@simonrw simonrw marked this pull request as ready for review July 17, 2024 16:13
@simonrw simonrw requested review from alexrashed and thrau as code owners July 17, 2024 16:13
Copy link
Member
@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for digging into this issue (which is quite tedious due to the lack of CBOR support in botocore)!
And I'm sorry I introduced this regression with the last iteration of the CBOR support... In retrospect I can't really tell what lead me to the conclusion that the CBOR content needs to be parsed as base64 too... 😅
The changeset looks good, and your analysis was great and thorough! 💯

@simonrw simonrw merged commit 33db530 into master Jul 18, 2024
39 checks passed
@simonrw simonrw deleted the fix/kinesis-cbor-blob-handling branch July 18, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0