Repository navigation
Description
Split from #475, which asked for server-side encryption across the whole S3 plugin. This
is the shippable unit: item 1 of that issue's own priority order, and the one the
reporter identified as load-bearing. The rest is #493.
What
Record the three SSE request headers on write and echo them on read. No cryptography —
recording and echoing is the whole of it, the same treatment S3SystemMetadata already
gives its four fields.
- Capture on
PutObject:x-amz-server-side-encryption,
x-amz-server-side-encryption-aws-kms-key-id,
x-amz-server-side-encryption-bucket-key-enabled. - Echo on
GetObjectandHeadObject:AES256for SSE-S3;aws:kmsplus the key ID
header for SSE-KMS; the bucket-key header only when it was enabled. - The KMS key ID round-trips verbatim.
Why this half, on its own
With SSE unmodelled, an object written with the header reads back byte-identical to one
written without it, so a consumer can only assert on what the request carried. #475
explains why that is weaker than it looks: asserting on the object's bytes passes with no
header sent, and asserting on the SDK input struct only checks the line that filled it in.
Recording and echoing turns every one of those request assertions into a stored-object
assertion, which is the claim that actually matters — and it does so without needing any
of the resolution rules, defaults, or validation that make up the rest of #475.
That is also why it splits cleanly: nothing here depends on bucket defaults, copy
semantics, or the error cases. Those interact with each other and are worth designing
together; this does not interact with them at all.
On the key ID, deliberately diverging
Real S3 echoes back the resolved key ARN, not the string that was sent — KMS accepts
four forms (key ARN, alias ARN, alias/name, bare UUID). Substrate should echo it
verbatim, because it lets a consumer assert the exact string their config produced,
which is the assertion they are actually trying to make. #475's reporter confirms their
tests assert the sent form.
This is a documented divergence, not an oversight, and it goes in docs/services.md
beside the behaviour: if key resolution is ever modelled, the difference is observable and
this decision has to be revisited.
Acceptance criteria
-
PutObjectwithx-amz-server-side-encryption: AES256→GetObjectand
HeadObjectechoAES256. -
aws:kmswith a key ID → both echo the algorithm and the key ID, verbatim, for all
four KMS ID forms. - The bucket-key header is echoed only when it was sent enabled — absent, not
false, otherwise. - An object written with no SSE headers echoes none, so "no header sent" stays
distinguishable from "header sent". (Note that a real bucket never stores an
unencrypted object — S3 has applied SSE-S3 unconditionally since January 2023 — but
modelling that default is S3: SSE resolution — CopyObject, multipart, bucket defaults, and the invalid-combination 400s #493's item, and doing it here would remove the
distinction this criterion exists to preserve.) - The values survive a state round-trip, so an object stored before this existed reads
back with no SSE rather than a fabricated default. -
docs/services.mddocuments what is recorded, that no cryptography is performed, and
the verbatim-key-ID divergence.
SSE-C (x-amz-server-side-encryption-customer-*) is out of scope; #475's reporter does not
need it.
Activity
feat(s3): record the server-side-encryption headers and echo them (#492…
scttfrdmn commentedon Aug 2, 2026
Shipped in
ee413b0(#506), in v0.87.0. Recording and echoing only — no cryptography, which is the whole of what the split intended.S3ServerSideEncryption(Algorithm,KMSKeyID,BucketKeyEnabled) is embedded inS3ObjectbesideS3SystemMetadata, and in the multipart-upload record as well even though multipart resolution is #493's. That last part is deliberate:S3SystemMetadataexists precisely so the family is declared once and the two write paths cannot drift, and adding the field twice differently later is the failure that pattern prevents.PutObjectcapturesx-amz-server-side-encryption,x-amz-server-side-encryption-aws-kms-key-idandx-amz-server-side-encryption-bucket-key-enabled;GetObjectandHeadObjectecho them throughobjectResponseHeaders, which is already the single place both operations build headers and already emits optional headers only when set — so the echo is one edit, not two handlers.The KMS key ID round-trips verbatim, and that is a stated divergence rather than a shortcut. Real S3 echoes the resolved key ARN; substrate echoes what was sent. The reason is that the sent string is what a consumer's config produced and what their assertion names — #475's reporter confirmed their tests assert the sent form, and resolving
alias/mineto an ARN substrate invented would break an assertion that is correct about the caller's own intent. It is documented beside the field the ways3_copy_metadata.godocuments itsMetadataDirectiveasymmetry, and asserted for a bare UUID, analias/nameand a full key ARN. If it ever needs to resolve, #493 is where that decision goes.The bucket-key header is echoed only when it was enabled, since an absent header and an explicit
falseare different observations. An object written with no SSE headers reads back with none — the regression guard on every existing object. And the stored object is asserted directly from state, not only through a header round-trip, so the assertion is about storage rather than echo plumbing.Out of scope and named in
docs/services.md, all in #493: bucket default encryption,CopyObjectinheritance, multipart resolution, and the four invalid-combination 400s. Nothing here depends on any of them, which is what made the split clean.chore(release): v0.87.0 (#515)
fix(#493): S3 resolves encryption from the request then the bucket de…