Repository navigation
fix(storage): format sign-blob output fields - #16720
nidhiii-27 wants to merge 2 commits into
Conversation
SignBlobRequest and SignBlobResponse stream insertion operators now format base64_encoded_blob and signed_blob as [censored], and AsyncAccessTokenGeneratorLogging::SignBlob formats payload and signed_blob with [censored]. Other formatted fields (service_account, delegates, name, and key_id), HTTP response parsing, and signing behavior remain unchanged. Updated google/cloud/storage/internal/sign_blob_requests_test.cc and google/cloud/internal/minimal_iam_credentials_stub_test.cc to verify the formatted output. [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces censoring for sensitive fields in SignBlob requests and responses to prevent leaking payloads and signed blobs in logs. Specifically, it replaces the generic LogWrapper with manual logging in MinimalIamCredentialsStub::SignBlob and updates the stream operators for SignBlobRequest and SignBlobResponse to output [censored] for sensitive fields. Corresponding unit tests have been updated and added to verify this behavior. I have no additional feedback to provide as the changes are correct and follow the repository's style guidelines.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16720 +/- ##
========================================
Coverage 92.78% 92.79%
========================================
Files 2277 2277
Lines 228147 228265 +118
========================================
+ Hits 211696 211828 +132
+ Misses 16451 16437 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kalragauri
left a comment
There was a problem hiding this comment.
A few additional findings:
- When
"auth"logging is enabled,Client::SignBlobImplalso invokesLoggingCredentials::SignBlob, which currently formatsstring_to_signwithDebugString(...)rather than[censored]. That path runs both for local signing and before falling back to the IAMSignBlobRPC. Should we formatstring_to_signas[censored]there as well (in this PR or a follow-up) so all sign-blob log entries are consistent? - With
"http"logging enabled,RestStub::SignBlobstill logs the first 128 bytes of the JSON request and response bodies throughDebugOutDataandDebugInData. Bothiam_rest_client_and theRestContextmerged inCurlRestClient::Postcurrently retain"http". Is disabling"http"logging foriam_rest_client_planned for a follow-up PR, or should it be handled here? LoggingStub::SignBlobis the main caller of the updatedSignBlobRequestandSignBlobResponsestream operators, butlogging_stub_test.ccdoes not currently coverSignBlob. Consider adding aSignBlobtest there verifying the logged[censored]fields and that the returnedSignBlobResponseis unchanged.
LoggingCredentials::SignBlob formats string_to_sign as [censored], and RestStub builds iam_rest_client_ and the SignBlob request context through a logging-component filter that preserves other options and request headers. Signing behavior, storage_rest_client_ configuration, and all other storage operations remain unchanged. Added and updated unit tests in oauth2_logging_credentials_test.cc, minimal_iam_credentials_stub_test.cc, logging_stub_test.cc, and rest/stub_test.cc. [Generated-by: AI]
|
Re: feedback from @kalragauri Done — addressed all three items in commit
Co-authored by AI Agent |
SignBlobRequest and SignBlobResponse stream insertion operators, AsyncAccessTokenGeneratorLogging::SignBlob, and LoggingCredentials::SignBlob format blob payload and signed-blob fields as [censored], and RestStub builds iam_rest_client_ and the SignBlob request context through a logging-component filter that preserves other options and request headers. Other formatted fields (service_account, delegates, name, key_id, and signing_service_account), storage_rest_client_ configuration, HTTP response parsing, and signing behavior remain unchanged. Updated and added unit tests in google/cloud/storage/internal/sign_blob_requests_test.cc, google/cloud/internal/minimal_iam_credentials_stub_test.cc, google/cloud/internal/oauth2_logging_credentials_test.cc, google/cloud/storage/internal/logging_stub_test.cc, and google/cloud/storage/internal/rest/stub_test.cc.