-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
A Bad Key error can occur when trying to overwrite an existing object when metadata with local metadata.
For example:
// Write an empty object with a kmsKeyName.
Blob blob = storage.create(blobInfo, Storage.BlobTargetOption.kmsKeyName(kmsKeyName))
// Using blob that already has metadata received from Storage API to create a writer.
WriteChannel writer = blob.writer();
// The following will error with the following error:
// {
// "message": "Bad Cloud KMS crypto key: projects/project-id/locations/us/keyRings/lab1/cryptoKeys/annie-test-key/cryptoKeyVersions/1",
// "domain": "global",
// "reason": "invalid"
// }
writer.write(ByteBuffer.wrap(content, 0, content.length));
The recommended change is if kmsKeyName is defined in object metadata is to remove it the resource id contains:
/cryptoKeyVersions/..
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.