oracleobjectstorage: fix SSE-C server-side copies

Set the OCI source SSE-C request headers when using a customer key.
Server-side copies need these headers to decrypt the source object, in
addition to the existing headers that encrypt the destination.
This commit is contained in:
tomaszni
2026-09-08 17:18:00 +01:00
committed by GitHub
parent 89fc14059e
commit 3eee2c0dd2
2 changed files with 28 additions and 0 deletions
+3
View File
@@ -115,11 +115,14 @@ func useBYOKCopyObject(fs *Fs, request *objectstorage.CopyObjectRequest) {
} }
if fs.opt.SSECustomerAlgorithm != "" { if fs.opt.SSECustomerAlgorithm != "" {
request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm) request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
request.OpcSourceSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
} }
if fs.opt.SSECustomerKey != "" { if fs.opt.SSECustomerKey != "" {
request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey) request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey)
request.OpcSourceSseCustomerKey = new(fs.opt.SSECustomerKey)
} }
if fs.opt.SSECustomerKeySha256 != "" { if fs.opt.SSECustomerKeySha256 != "" {
request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256) request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
request.OpcSourceSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
} }
} }
+25
View File
@@ -0,0 +1,25 @@
//go:build !plan9 && !solaris && !js
package oracleobjectstorage
import (
"testing"
"github.com/oracle/oci-go-sdk/v65/objectstorage"
"github.com/stretchr/testify/assert"
)
func TestUseBYOKCopyObject(t *testing.T) {
f := &Fs{opt: Options{
SSECustomerAlgorithm: "AES256",
SSECustomerKey: "customer-key",
SSECustomerKeySha256: "customer-key-sha256",
}}
req := &objectstorage.CopyObjectRequest{}
useBYOKCopyObject(f, req)
assert.Equal(t, &f.opt.SSECustomerAlgorithm, req.OpcSourceSseCustomerAlgorithm)
assert.Equal(t, &f.opt.SSECustomerKey, req.OpcSourceSseCustomerKey)
assert.Equal(t, &f.opt.SSECustomerKeySha256, req.OpcSourceSseCustomerKeySha256)
}