Skip to content

Conversation

@jcborras
Copy link

@jcborras jcborras commented Nov 25, 2025

Prevents case sensitive ETag header names.
Fixes #11201

Testing
YAML config includes an S3 output stage to an S3 compatible service, and an HTTP input stage which we will use for testing:

  inputs:
  - name: http
    listen: "0.0.0.0"
    port: 9880
    tag_key: log_tag_key  # the value of this attribute defines the event tag
  outputs:
  - name: s3
    log_level: trace
    match: '*'
    bucket: logs
    endpoint: REDACTED
    region: US
    json_date_format: iso8601
    json_date_key: ts
    part_size: 1M
    preserve_data_ordering: true
    profile: jcb-tester
    s3_key_format: /fluent-bit-logs/$TAG/%Y/%m/%d/%H
    use_put_object: false

To generate a large file to upload use the following script:

 for i in $(seq 128) ; do
   JSON="{\"log_tag_key\":\"log_tag\",\"msg\":\"This is my message\", \"ts\": \"$(date --utc --iso-8601=seconds)\", \"data\": \"$(dd if=/dev/random bs=1024 count=16 2> /dev/null | base64 --wrap=0)\" }" ;
   curl  --request POST --header "content-type: application/json" --data "$JSON" http://localhost:9880 ;
  done

Before we can approve your change; please submit the following in a comment:

  • Debug log output from testing the change
[2025/11/25 17:26:14.114997595] [ info] [output:s3:s3.0] UploadPart http status=200
[2025/11/25 17:26:14.115815938] [ info] [output:s3:s3.0] Successfully uploaded part #2 for /fluent-bit-logs/log_tag/2025/11/25/15, UploadId=AQAAAZq7nyPECHRyrbgGQ4S40hGAHSFeUEDbras, ETag=541c2b1cff8aafd05c8bc47144e001b8
[2025/11/25 17:26:14.117334902] [debug] [output:s3:s3.0] Successfully persisted upload data, UploadId=AQAAAZq7nyPECHRyrbgGQ4S40hGAHSFeUEDbras

Valgrind report:

==551332== 
==551332== HEAP SUMMARY:
==551332==     in use at exit: 0 bytes in 0 blocks
==551332==   total heap usage: 457,215 allocs, 457,215 frees, 695,242,903 bytes allocated
==551332== 
==551332== All heap blocks were freed -- no leaks are possible
==551332== 
==551332== For lists of detected and suppressed errors, rerun with: -s
==551332== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Backporting

Not required.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed S3 multipart upload header detection to be case-insensitive, improving compatibility with responses that use varying header casing and enhancing overall reliability of multipart upload operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@jcborras jcborras requested a review from a team as a code owner November 25, 2025 15:25
@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

Walkthrough

The get_etag function in the S3 multipart upload handler now performs case-insensitive searching for the ETag header using strcasestr() instead of strstr(), ensuring compatibility with S3-compatible services that return headers in lowercase, as permitted by RFC 9110.

Changes

Cohort / File(s) Summary
ETag header search case-insensitivity
plugins/out_s3/s3_multipart.c
Changed header lookup from strstr() to strcasestr() in get_etag() function to enable case-insensitive matching of ETag header name

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single-function modification with straightforward logic change
  • Consider verifying strcasestr() availability on target platforms (GNU extension, may require compatibility layer on non-glibc systems)

Poem

🐰 A header that whispered in lowercase before,

Now heard loud and clear, case matters no more!

RFC's blessing, Postel's law reigns,

ETag searches through compatible domains! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: making the ETag header search case-insensitive in S3 multipart uploads, addressing RFC 9100 compliance.
Linked Issues check ✅ Passed The code change replaces strstr with strcasestr for case-insensitive ETag header matching, directly addressing the RFC 9100 violation and multipart upload failures described in issue #11201.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the get_etag function in s3_multipart.c, replacing case-sensitive with case-insensitive header search, remaining within the bounds of issue #11201 requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS S3 Output stage: violation of Postel's Law and/or RFC9100 when handling the ETag HTTP header

1 participant