mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-27 14:27:10 +00:00
3a5742c5fd
* feat(policy): support s3:if-none-match and s3:if-match condition keys Bucket, IAM, and STS session policies that enforce conditional writes with s3:if-none-match or s3:if-match were rejected with "invalid key name". Accept both keys and populate them from the If-None-Match and If-Match request headers. A blank header is left out of the condition values because the write ignores it, so it cannot satisfy a Null check for a write that runs unconditionally. * fix(policy): classify conditional write keys as request-derived s3:if-match and s3:if-none-match are filled from request headers, but is_server_derived() reported them as server-derived because their names lack the x-amz- prefix. Add an explicit arm so header input is never refused for these keys if they join COMMON_KEYS. * fix(s3): reject non-wildcard If-None-Match on writes S3 accepts If-None-Match on PutObject, CopyObject and CompleteMultipartUpload only as "*" and answers other values with 501 NotImplemented. RustFS compared such a value as an ETag, so a write with If-None-Match: "<other etag>" overwrote the key while satisfying a policy that requires s3:if-none-match. Reject ETag values in the three handlers before any I/O. The store-level check now treats any non-blank If-None-Match as create-only, so a caller that skips the handler check cannot weaken the precondition. Drop the CompleteMultipartUpload ETag pre-check that the rejection supersedes. * test: tighten conditional write policy coverage Pin trimming and the non-UTF-8 case in the condition values, and drop the auth test that re-ran policy evaluation already covered by the policy crate. Run the three policy e2e scenarios on one server, assert that ETag If-None-Match cannot overwrite under a Null: false policy and that CompleteMultipartUpload with If-None-Match: * returns 412. Share the AssumeRole response parser through common.rs. * test(ecstore): isolate manual delete recovery from workers Stop fixture background services before seeding recovery journals so the explicit recovery pass owns the decisions its assertions inspect. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * fix(s3): enforce request-derived conditional write guards Validate raw If-None-Match headers as well as DTO fields so POST form uploads cannot skip rejection of unsupported ETag preconditions. Derive conditional policy keys after identity claims and clear colliding claims when the actual request has no usable precondition. Align multipart and pinned Ceph regressions with wildcard-only writes, retaining If-Match, object-content, version and delete-marker assertions. Document that 501 is the implementation's unsupported-value response. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * perf(s3): eliminate conditional write request copies Borrow request headers during policy condition collection and exclude conditional keys at the identity-claim boundary instead of inserting and removing them. Preserve existing aliases and multivalue header behavior. Move the CompleteMultipartUpload input out of its request, compare strong ETags by reference, and remove the ETag If-None-Match branch made unreachable by the write guard. Keep both form/HTTP input checks and storage commit preconditions intact. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * test(s3): align ignored conditional PUT and COPY cases Use If-None-Match: * for the existing-object 412 regressions and assert 501 for matching and nonmatching ETag values. Cover both header-only callers and parsed DTO-plus-header requests in the serial ILM fixtures. Check object bytes and live version counts after each rejected operation. Keep the existing test names and ignored-test lane selection unchanged. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> --------- Co-authored-by: overtrue <anzhengchao@gmail.com> Co-authored-by: Hauser <housemecn@gmail.com> Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com>