Copilot commented on code in PR #3770:
URL: https://github.com/apache/brpc/pull/3770#discussion_r4656136328
##########
src/brpc/couchbase.cpp:
##########
@@ -456,6 +458,9 @@ bool
CouchbaseOperations::CouchbaseRequest::selectBucketRequest(
DEBUG_PRINT("Empty bucket name");
return false;
}
+ if (!ValidCouchbaseRequestLengths(bucket_name.size(), 0, 0, 0)) {
+ return false;
+ }
Review Comment:
This new rejection path is not propagated through
`CouchbaseOperations::selectBucket`: when `selectBucketRequest` returns false,
`selectBucket()` only sets `result.success` and `result.value`, leaving
`error_message` empty and `status_code` indeterminate. An oversized bucket
therefore looks like an unexplained failure and can expose an uninitialized
status code to callers. Please set a deterministic length-specific error/status
in the high-level failure branch (or return the request error).
##########
src/brpc/couchbase.cpp:
##########
@@ -567,6 +572,9 @@ bool
CouchbaseOperations::CouchbaseRequest::authenticateRequest(
DEBUG_PRINT("Empty username or password");
return false;
}
+ if (!policy::ValidCouchbaseAuthLengths(username.size(), password.size())) {
+ return false;
+ }
Review Comment:
The new oversized-credential failure is also swallowed by `authenticateAll`:
its `authenticateRequest(...) == false` branch sets only `result.success`, so
`authenticate()` returns an empty error message and an uninitialized
`status_code` for this input. Please propagate a deterministic length-specific
error (and initialize the other failure fields) from this high-level path, as
is done for oversized document requests in `sendRequest`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]