Feat: add bucket encryption enforcement configuration#2718
Feat: add bucket encryption enforcement configuration#2718thiyaguk09 wants to merge 6 commits intomainfrom
Conversation
Implement support for GoogleManaged, CustomerManaged, and CustomerSupplied encryption enforcement configurations in BucketMetadata. This allows buckets to restrict object creation based on encryption types. - Update BucketMetadata interface with new enforcement config fields - Add unit tests for metadata parsing, patching, and serialization - Include JSDoc examples for configuring CMEK-only enforcement
Adds comprehensive code samples and system tests to verify Google-managed, Customer-managed, and Customer-supplied encryption enforcement logic. - Add setBucketEncryptionEnforcementConfig.js sample - Add getBucketEncryptionEnforcementConfig.js sample - Add removeAllBucketEncryptionEnforcementConfig.js sample - Add system tests to verify CLI output and backend metadata state - Ensure server-side effectiveTime is correctly captured and displayed
|
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
| * // Enforce CMEK-only encryption for new objects. | ||
| * // This blocks Google-Managed and Customer-Supplied keys. | ||
| * //- | ||
| * bucket.setMetadata({ |
There was a problem hiding this comment.
Is the encryption property replaced entirely during a PATCH request? To me it does not appear to add deep-merge logic, If a user updates an enforcement setting using this example, any existing defaultKmsKeyName will be deleted unless they manually include it in the object.
There was a problem hiding this comment.
Can you also look into the tests related to this code?
There was a problem hiding this comment.
I’ll take a look at this and let you know soon.
There was a problem hiding this comment.
@v-pratap You're right that the library performs a shallow patch. However, I’ve verified via a new integration test that the Cloud Storage API handles the deep merge on the backend.
When sending a patch with only enforcement settings, the API correctly retains the existing defaultKmsKeyName. I have added an integration test (should retain defaultKmsKeyName when updating enforcement settings independently) to confirm this behavior and prevent any future regressions. Since the backend manages this strategically, additional merge logic in the client isn't required.
Adds integration to verify that encryption enforcement configurations are correctly handled during bucket metadata updates. Confirms that `defaultKmsKeyName` is retained during partial updates via server-side strategic merge.
Description
Impact
Testing
Additional Information
Checklist
Fixes #🦕