-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ceph: fix SignatureDoesNotMatch by using correct secret key when create bucket #11115
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
base: main
Are you sure you want to change the base?
ceph: fix SignatureDoesNotMatch by using correct secret key when create bucket #11115
Conversation
Ensure bucket.getSecretKey() is used when building the S3 client. Previously, only getAccessKey() was passed for both key and secret, causing V4 signature validation failures during operations such as bucket creation and policy updates.
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes SignatureDoesNotMatch errors by ensuring the AWS S3 client is initialized with the correct secret key in CephObjectStoreDriverImpl.
- Replaced the second credential parameter in
getS3Client
calls frombucket.getAccessKey()
tobucket.getSecretKey()
. - Applied this correction across policy, versioning, and encryption bucket operations.
Comments suppressed due to low confidence (1)
plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java:196
- Add unit or integration tests to confirm that
getS3Client
is invoked with the correctsecretKey
parameter, ensuring Signature V4 operations succeed against Ceph RGW.
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey()); | ||
client.setBucketPolicy(new SetBucketPolicyRequest(bucket.getName(), policyConfig)); | ||
} | ||
|
||
@Override | ||
public BucketPolicy getBucketPolicy(BucketTO bucket, long storeId) { | ||
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey()); | ||
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey()); | ||
return client.getBucketPolicy(new GetBucketPolicyRequest(bucket.getName())); | ||
} | ||
|
||
@Override | ||
public void deleteBucketPolicy(BucketTO bucket, long storeId) { | ||
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey()); | ||
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the repeated getS3Client
initialization into a private helper method to reduce duplication and improve readability across bucket operations.
Copilot uses AI. Check for mistakes.
@jeanvetorello , of you want this fix on an LTS version, rebase it on one of the older release-branches, please. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11115 +/- ##
=========================================
Coverage 16.57% 16.57%
Complexity 13968 13968
=========================================
Files 5743 5743
Lines 510494 510494
Branches 62075 62075
=========================================
+ Hits 84617 84622 +5
+ Misses 416415 416409 -6
- Partials 9462 9463 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLGTM
Description
This PR fixes an issue in the
CephObjectStoreDriverImpl
where the AWS S3 client was incorrectly initialized using the access key in place of both the access and secret key. This causedSignatureDoesNotMatch
errors during bucket operations such as creation and policy updates when interacting with Ceph RGW using Signature V4.Fix:
Replaced incorrect usage: