Repository navigation
Description
What's missing
Server-side encryption is unmodelled across the S3 plugin. grep -rn 'ServerSideEncryption' --include='*.go' . returns 0 hits at 0335ea6. Concretely:
x-amz-server-side-encryption,x-amz-server-side-encryption-aws-kms-key-id, andx-amz-server-side-encryption-bucket-key-enabledare not captured onPutObject,CreateMultipartUpload, orCopyObject, and not echoed onGetObject/HeadObject.- No
PutBucketEncryption/GetBucketEncryption/DeleteBucketEncryption, so there is no default to apply to a request that names none. - Nothing rejects the invalid combinations S3 rejects with a 400.
Why it matters to a consumer
ObjectFS just landed SSE support (SSE-S3, SSE-KMS, bucket keys) as a fix for an audit finding where the config file claimed encryption at rest and no header was ever sent. The tests for it can only assert what the request carried, because with SSE unmodelled an object written with the header reads back byte-identical to one written without it. So:
- asserting on the object's bytes passes with no header sent;
- asserting on the SDK input struct only checks the arithmetic of the line that filled it in;
- only the recorded request can fail for the right reason.
That works — we added request-header capture to our harness for it — but it pins a weaker property than we want. "The request asked for encryption" is one inference away from "the object is encrypted," and it is exactly the inference the original defect made. Modelling SSE would let the assertion be on the stored object, which is the claim that actually matters.
The specific behaviours we would exercise, in rough priority order:
1. Record and echo (the load-bearing one). Store the three headers on write; return x-amz-server-side-encryption (and the key ID / bucket-key flag when applicable) on GetObject and HeadObject. This alone turns every one of our request assertions into a stored-object assertion.
2. CopyObject does not inherit the source's encryption. This is the sharpest real-world case and the one we found two live bugs behind. S3 encrypts the destination according to the request; a copy that names nothing gets the bucket default, not the source's encryption. So an in-place CopyObject for a metadata change, or an automatic storage-tier transition, silently moves an SSE-KMS object off the customer managed key. Same asymmetry family as the MetadataDirective behaviour already documented in s3_copy_metadata.go:73.
3. Multipart records it on the create only. CreateMultipartUpload carries the encryption for the upload as a whole; UploadPart restating it is rejected. CompleteMultipartUpload should surface it on the assembled object. Given S3SystemMetadata is already embedded in both S3Object and S3MultipartUpload precisely so the two write paths cannot disagree (#406), this may fall out naturally — though the resolution rules differ enough that it may want its own struct rather than joining that family, in the way Content-Type and the storage class deliberately stayed out.
4. Bucket default encryption, so a request naming nothing resolves to the bucket's setting rather than to absent. This is what makes "off" testable as distinct from "unencrypted" — S3 has applied SSE-S3 to all new objects unconditionally since January 2023, so a real bucket never stores an object with no encryption at all.
5. The 400s. Each is a combination a caller can produce and currently gets silent success for:
x-amz-server-side-encryption-aws-kms-key-idsent withAES256→InvalidArgumentx-amz-server-side-encryption-bucket-key-enabledwithoutaws:kms→InvalidArgument- an unrecognized algorithm token →
InvalidArgument UploadPartcarrying encryption headers → 400
Fidelity notes
No real cryptography is needed or wanted — recording and echoing the headers is the whole of it, the same treatment S3SystemMetadata gives its four. Two details that would matter to us:
- The KMS key ID should round-trip verbatim. KMS accepts four forms (key ARN, alias ARN,
alias/name, bare UUID) and real S3 echoes back the resolved key ARN, not what was sent. Verbatim is the more useful default for an emulator — it lets a consumer assert the exact string their config produced — but if resolution is ever modelled, note that the difference is observable and our tests currently assert the sent form. x-amz-server-side-encryption: AES256should be echoed for SSE-S3; SSE-KMS echoesaws:kmsplus the key ID header, and the bucket-key header only when it was enabled.
SSE-C (x-amz-server-side-encryption-customer-*) is not something we need — ObjectFS does not implement it — so it seems reasonable to leave out unless another consumer wants it.
Happy to test against a branch.
Activity
scttfrdmn commentedon Aug 2, 2026
Thanks — the framing here is unusually useful, particularly the point that asserting on the
request is "one inference away from 'the object is encrypted,' and it is exactly the
inference the original defect made." That is the argument for doing this, and it also
determines how it splits.
Split in two, along your own priority order:
on write, echo them on
GetObject/HeadObject, KMS key ID verbatim, no cryptography.CopyObjectnot inheriting, multipart on thecreate only, bucket defaults, and the four 400s. Not milestoned yet; it wants a design
pass first.
Why the echo half is the one that ships first. It is the item that changes what your
tests can assert, and it is the only item that needs nothing else to be true. Items 2–5 are
all resolution rules over the fields item 1 stores — copy semantics, multipart
precedence, bucket defaults, and validation of combinations — and they interact with each
other, so designing them piecemeal risks a resolution order that has to be unpicked later.
Item 1 interacts with none of them. So it ships now and turns your request-header assertions
into stored-object assertions immediately, which is the property you actually asked for.
Your KMS key ID note is taken, and substrate will deliberately diverge from S3 here. You
are right that real S3 echoes the resolved key ARN rather than the string sent. Substrate
will echo it verbatim, because it lets you assert the exact string your config produced
— the assertion you are trying to make — and it is recorded in #492 as a documented
divergence rather than a simplification, with the note that it must be revisited if key
resolution is ever modelled. Flagging that your tests assert the sent form was the useful
detail; without it, verbatim would have looked like an oversight to a later reader.
One interaction worth watching, since it spans the split: #492 requires that an object
written with no SSE headers echoes none, so "no header sent" stays observable. Your item 4
is right that a real bucket never stores an unencrypted object, so #493's bucket-default work
changes that criterion. It is called out in both issues so the change is deliberate rather
than a side effect.
CopyObjectnot inheriting is the one I would most want your eyes on when it lands — thein-place-copy-for-metadata case moving an object off a customer managed key is the kind of
thing that is obvious once stated and invisible otherwise. Taking you up on the offer to
test against a branch for #492.
SSE-C stays out of scope in both, per your note.
scttfrdmn commentedon Sep 20, 2026
Left unmilestoned deliberately in the roadmap pass that assigned the other 84 open issues to v0.121.0–v0.127.0.
This is one of three S3 server-side-encryption issues — with #493 (SSE resolution across CopyObject, multipart, bucket defaults and the invalid-combination 400s) and #507 (the
emailAddressgrantee) — and they are one coherent feature needing a single design pass, not three independent defects. #507 already carriesstatus: needs-design.They get a milestone together once that pass is done. Splitting them across releases would mean deciding the SSE model three times.
scttfrdmn commentedon Nov 15, 2026
Closing as delivered: all five behaviours this asked for shipped, through the two issues it was split into on 2026-08-02.
InvalidArgument/400.SSE-C stays out of scope, as suggested here. The 2026-09-20 note held this back so it could be designed together with #493 and #507. #493 is now done, and #507 stands on its own.