Skip to content

fix(s3): stop storing and returning the server-side encryption header - #14990

Merged
abnegate merged 3 commits into
mainfrom
fix/s3-sse-header
Oct 27, 2026
Merged

abnegate merged 3 commits into
mainfrom
fix/s3-sse-header

Conversation

@abnegate

Copy link
Copy Markdown
Member

What does this PR do?

The S3 gateway stored the x-amz-server-side-encryption request header as object metadata and returned it on PutObject, GetObject and HeadObject responses, including for copied and multipart objects. Buckets served through the gateway require Appwrite encryption to be disabled and objects are stored as sent, so the response header reported encryption that was not applied.

Other x-amz-* request headers the gateway does not implement (storage class, tagging, ACL grants, object lock) are accepted and ignored, so the encryption header now follows the same rule: requests that send it still succeed, the value is no longer stored, and responses omit the header, which is how S3 reports that no server-side encryption was applied. The header is also dropped from the exposed CORS headers.

Test Plan

  • New E2E test S3CustomServerTest::testPutObjectServerSideEncryptionNotReported sends x-amz-server-side-encryption: AES256 on a PutObject, a copy with REPLACE metadata and a multipart upload, and asserts the header is absent on the PUT, GET and HEAD responses.
  • The local Docker stack was unavailable, so this E2E test relies on CI. Red/green was not run locally. Without the source change the test fails on the first assertArrayNotHasKey('x-amz-server-side-encryption', ...) because the PUT response echoes the header.
  • Pint, PHPStan and the Rector dry run pass on the changed files.

Related PRs and Issues

  • Code scanning alert 4374

🤖 Generated with Claude Code

The gateway stored the x-amz-server-side-encryption request header as
object metadata and returned it on PutObject, GetObject and HeadObject,
including for multipart and copied objects. Gateway buckets require
Appwrite encryption to be disabled and objects are stored as sent, so
the response header reported encryption that was not applied.

Other x-amz-* request headers the gateway does not implement (storage
class, tagging, ACL grants, object lock) are accepted and ignored, so
the encryption header now follows the same rule. Requests that send it
still succeed, and responses omit the header, which is how S3 reports
that no server-side encryption was applied.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@luxor-code-review

luxor-code-review Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 S3 docs still advertise removed SSE header (index.markdoc) — The PR removes all x-amz-server-side-encryption handling from the S3 gateway — capture in requestObjectMetadata (src/Appwrite/Platform/Modules/S3/Http/S3/Base.php), the PUT response echo (Create.php), the GET/HEAD echo (Get.php), and the CORS exposure (Init.php) — with a new e2e test asserting the header is never reported.

The change strips server-side-encryption header handling from the S3 proxy layer and pins the new contract with e2e assertions. Verification found the removal consistent across source and tests, with only stale documentation left behind.

Files Change
src/Appwrite/Platform/Modules/S3/Http/* Drops x-amz-server-side-encryption from header allowlists and response handling in init, base, create, and get actions.
tests/e2e/Services/Storage/S3CustomServerTest.php Updates e2e expectations to assert the SSE header is no longer emitted on PUT/GET/HEAD/copy/multipart responses.

Reviewed commit: 78b4643

@ghost

ghost commented Oct 27, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The S3 gateway no longer stores or returns x-amz-server-side-encryption, and it no longer exposes the header through CORS. The storage documentation now describes the header as accepted but ignored, and an E2E test covers PutObject, GetObject, HeadObject, copy, and multipart flows.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 6
File Change
apps/console/src/content/docs/products/storage/s3/index.markdoc Documents that server-side encryption is unsupported and the request header is ignored.
src/Appwrite/Platform/Modules/S3/Http/Init.php Removes the encryption header from the CORS expose list.
src/Appwrite/Platform/Modules/S3/Http/S3/Base.php Stops adding the encryption header to persisted object metadata.
src/Appwrite/Platform/Modules/S3/Http/S3/Create.php Stops returning the encryption header on PutObject responses.
src/Appwrite/Platform/Modules/S3/Http/S3/Get.php Stops returning the encryption header on GetObject and HeadObject responses.
tests/e2e/Services/Storage/S3CustomServerTest.php Adds E2E coverage for ignored encryption headers across object, copy, and multipart operations.

Reviewed 3db7c54 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/s3-sse-header (after).

Metric Before After Change
🚀 Requests/sec 159.58 154.78 ⚪ -3%
⏱️ Latency P50 108.24 ms 111.25 ms ⚪ +2.8%
⏱️ Latency P95 258.58 ms 264.08 ms ⚪ +2.1%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 111.25 264.08 10,146 154.78 +5.5
Account 218.9 400.62 534 8.83 +16.85
TablesDB 107.26 202.83 5,518 87.68 +4.59
Storage 102.1 244.76 2,670 44.07 +11.18
Functions 155.07 299.09 1,424 24.19 +1.89

Top API waits (after)

API request Max wait (ms)
account.name.update 543.25
functions.delete 536.63
tokens.files.create 507.9
functions.variables.update 504.62
account.prefs.update 491.46

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@14990

commit: 3db7c54

@abnegate

Copy link
Copy Markdown
Member Author

@hansi-codes review

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@abnegate
abnegate merged commit 9599f6f into main Oct 27, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant