You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c2a4bc
Browse filesBrowse the repository at this point in the historyBrowse files
feat(objectstore): add DSSE-KMS support and unify S3 sse configuration
Follow-up to #57623 (SSE-KMS). Adds a single `sse` objectstore argument
(none/sse-s3/sse-c/sse-kms/sse-kms-dsse) so DSSE-KMS, encryption context,
and S3 Bucket Keys can be configured without ambiguous or silently
conflicting combinations of booleans. `sse_c_key` and `sse_kms_enabled`
remain as deprecated aliases so existing configs keep working unchanged.
Conflicting sse* arguments resolve deterministically instead of throwing:
sse_c_key + sse_kms_enabled both set falls back to SSE-C, matching the
behaviour released in Nextcloud 34, and an explicit `sse` argument always
overrides the deprecated keys, including `'sse' => ''` as an explicit
opt-out. Every resolution is logged once via getConnection(), with a
warning on any SSE-C usage. sse_kms_bucket_key with sse-kms-dsse is a
warning rather than an exception: S3 accepts the request and simply does
not apply the bucket key.
Encryption headers are now split by request type. Write requests keep
getServerSideEncryptionParameters(); requests that don't create an object
(GetObject, HeadObject, ListParts, UploadPart, CompleteMultipartUpload,
the source side of a copy) use getReadServerSideEncryptionParameters(),
which only carries the SSE-C customer key and is gated on the resolved
mode rather than the raw `sse_c_key` argument.
Adds S3ServerSideEncryptionTest for parsing, precedence and logging, and
S3EncryptionModesLiveTest, an opt-in (NC_TEST_S3_KMS_KEY_ID) mode matrix
and cross-mode read suite against a real AWS bucket and KMS key.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5
Assisted-by: ClaudeCode:claude-sonnet-5-5
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
if ($hasLegacySseC && $mode !== S3EncryptionMode::SseC) {
382
+
$this->encryptionWarnings[] = "Ignoring the 'sse_c_key' objectstore argument: 'sse' is explicitly set to '{$mode->value}'.";
383
+
}
384
+
if ($hasLegacySseKms && !$mode->isKms()) {
385
+
$this->encryptionWarnings[] = "Ignoring the 'sse_kms_enabled' objectstore argument: 'sse' is explicitly set to '{$mode->value}'.";
386
+
}
387
+
} elseif ($hasLegacySseC || $hasLegacySseKms) {
388
+
if ($hasLegacySseC && $hasLegacySseKms) {
389
+
// This is the Nextcloud 34 behaviour: SSE-C silently took precedence over
390
+
// SSE-KMS whenever both were configured. Kept for backward compatibility,
391
+
// but no longer silent.
392
+
$this->encryptionWarnings[] = "Both 'sse_c_key' and 'sse_kms_enabled' are set; 'sse_c_key' (SSE-C) takes precedence, as it did in Nextcloud 34. Set the 'sse' objectstore argument to select a single encryption mode explicitly.";
// which is why this also requires managing and distributing the key yourself.
407
+
$this->encryptionWarnings[] = "SSE-C ('sse' => 'sse-c') is deprecated since Nextcloud 34: Amazon S3 disabled SSE-C by default for new buckets in April 2026, and it requires you to manage the encryption key yourself. Use 'sse' => 'sse-kms' or 'sse-kms-dsse' instead, which let AWS KMS manage the key.";
408
+
if (empty($params['sse_c_key'])) {
409
+
// Unlike a merely redundant option, this cannot be resolved: silently falling
410
+
// back to no encryption would defeat an explicit request for SSE-C.
411
+
thrownew \Exception("The 'sse' objectstore argument is set to 'sse-c' but no 'sse_c_key' is configured.");
if (!is_string($contextKey) || !is_string($contextValue)) {
432
+
thrownew \Exception("The 'sse_kms_encryption_context' objectstore argument must be an array of string key-value pairs.");
433
+
}
434
+
}
435
+
if (!$mode->isKms()) {
436
+
$this->encryptionWarnings[] = "Ignoring the 'sse_kms_encryption_context' objectstore argument: it only applies when 'sse' is 'sse-kms' or 'sse-kms-dsse'.";
0 commit comments