Skip to content

Validate Couchbase request lengths before serialization - #3770

Open
songgaoye wants to merge 1 commit into
apache:masterfrom
songgaoye:fix/couchbase-request-lengths
Open

songgaoye wants to merge 1 commit into
apache:masterfrom
songgaoye:fix/couchbase-request-lengths

Conversation

@songgaoye

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve

Problem Summary:

Couchbase request builders can narrow key, bucket, and body lengths to the
protocol's 16-bit and 32-bit fields while appending the full input. Oversized
inputs can produce malformed frames and desynchronize the connection.

What is changed and the side effects?

Changed:

  • Validate key, bucket, body, and SASL authentication payload lengths before
    serialization.
  • Reject oversized collection-aware requests before looking up collection
    metadata.
  • Return a length-specific error from the high-level request path.
  • Add tests for protocol length boundaries and for preserving the request
    buffer and pipeline count after rejection.

Side effects:

  • Performance effects: Adds constant-time length checks before request
    construction. The impact has not been benchmarked.

  • Breaking backward compatibility: Requests exceeding protocol length limits
    now fail instead of producing malformed frames.


Check List:

  • Built brpc_couchbase_unittest and passed all 8 CouchbaseUnitTest tests.
  • Added length-boundary and oversized-request regression tests.
  • Couchbase server integration tests were not run.
  • Please follow Contributor Covenant Code of Conduct.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant