Commit Graph

8527 Commits

Author SHA1 Message Date
RustFS d620ecfa5f fix(ecstore): enforce WORM delete and sync peer rebalance completion (#9710)
* fix(ecstore): enforce WORM lock before rebalance delete skip

Evaluate read-only Object Lock deletion admission on rebalancing and suspended pools before writer pool-lookup skipping or batch rebalance source-pool skipping so WORM-protected versions deterministically fail with PrefixAccessDenied (HTTP 403 AccessDenied) instead of SlowDown (HTTP 503), VersionNotFound (HTTP 204), or false batch Deleted entries.

Fixes rustfs/backlog#3383

* fix(ecstore): propagate terminal rebalance reload to peer nodes

Broadcast notification_sys.load_rebalance_meta_failures(false) after autonomous pool rebalance workers persist Completed or Failed terminal state, and merge same-run metadata reloads monotonically so peer nodes clear is_pool_rebalancing without clobbering active pool progress.
2026-11-29 10:38:49 +08:00
Chris An 9170a88dc8 fix(gateway): preserve Object Lock offset, enforce metadata listing SSE/metrics, and synthesize Host in early authorizer (#9705)
* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

* fix(gateway): align Object Lock offset, metadata listing SSE/metrics, and H2/H3 Host authz

Signed-off-by: Chris An <anzhengchao@gmail.com>

---------

Signed-off-by: Chris An <anzhengchao@gmail.com>
Co-authored-by: Hauser Zhi <housemecn@gmail.com>
2026-11-29 10:38:28 +08:00
Chris An 5a0bdfcf1c fix(security): harden RPC, proxies, egress DNS, and OIDC (#9682)
* fix(security): harden RPC, proxies, egress DNS, and OIDC

Harden internode RPC authentication/quotas, trusted-proxy allowlisting,
protocol IAM policy conditions, outbound DNS egress pinning, and OIDC
redirect and HTTPS enforcement:

- Trusted proxies: replace broad private/link-local peer trust in simple
  mode with the configured trusted-proxy allowlist (defaulting to
  loopback-only) and update proxy integration coverage.
- Protocol gateways & FTPS: populate standard IAM condition keys
  (SourceIp, SecureTransport, CurrentTime, EpochTime, UserAgent,
  Referer, principal metadata) in gateway authorization and replace the
  unchecked FTPS fallback IP parse with explicit connection context.
- Bucket listing RPC: fail closed with entry index diagnostics instead
  of silently dropping malformed BucketInfo entries on encode/decode.
- Internode RPC streams & replay cache: add framed HMAC-SHA256 response
  authentication with sequence/digest/EOF verification and
  post-verification endpoint pinning for read_file_stream and walk_dir,
  plus canonicalized per-peer entry and memory-budget replay cache
  isolation.
- Outbound DNS egress: unify storage/tier, remote S3 replication
  targets, on-demand migration HTTP, Azure Blob, GCS, Keystone, and OIDC
  outbound checks onto OutboundPolicy and connection-time
  OutboundDnsResolver (with redirect blocking on Keystone) to stop DNS
  rebinding to loopback/link-local/metadata targets.
- OIDC redirects & transport security: trust forwarded scheme/host only
  from verified trusted proxies, never reflect untrusted request headers
  into STS credential or logout redirects, and reject plaintext http://
  OIDC URLs for non-loopback hosts unless explicitly opted in via
  RUSTFS_IDENTITY_OPENID_ALLOW_INSECURE_TRANSPORT.

Refs: rustfs/backlog#1470, rustfs/backlog#1473, rustfs/backlog#1472, rustfs/backlog#1506

* fix(egress): restrict GCS endpoints and restore tier compatibility

* ci: tighten the GCS error-format baseline

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* test(ecstore): scope upload lock identity helper to its Linux test

* fix(oidc): preserve HTTPS in dynamic callbacks

* ci: allow cold builds to finish all fuzz binaries
2026-11-29 10:23:40 +08:00
Chris An 21fc821938 chore(deps): bump rustfs/gateway pin to b6007d13 (#9683)
* chore(deps): bump rustfs/gateway pin to b6007d13

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* test(ecstore): scope upload lock identity helper to its Linux test

* ci: allow cold builds to finish all fuzz binaries
2026-11-29 09:50:12 +08:00
Chris An e91d961f45 test(security): expand authz, OIDC, table LIST, and audit coverage (#9686)
* test(security): expand authz, OIDC, table LIST, and audit coverage

Add end-to-end, integration, and property-based security regression suites
closing in-repo RustFS test gaps across authorization, table-bucket LIST
isolation, OIDC web-identity federation, streaming SigV4 chunks, multipart
checksum algebra, and auth-failure audit delivery:

- Add table-bucket LIST isolation E2E tests across ListObjectsV2,
  ListObjectVersions, and ListMultipartUploads covering delimiter
  CommonPrefixes, opaque cursor confidentiality, cursor-attack rejection,
  and >1000-object all-hidden raw page traversal.
- Wire fast delete_authorization_test, table_list_isolation_test,
  oidc_web_identity_e2e_test, and auth_failure_audit_test cases into
  .config/nextest.toml e2e-smoke (updating e2e-smoke/e2e-full selection
  digests and raising security-smoke-floor to 29).
- Expand delete_authorization_test with anonymous force-delete / spoofed
  REPLICA denial and Object Lock (GOVERNANCE bypass, COMPLIANCE, Legal
  Hold) enforcement regressions.
- Add OIDC AssumeRoleWithWebIdentity E2E matrix (E2E-01..E2E-13, multi-
  audience, inline session-policy intersection) and rustfs-iam web-identity
  integration tests (tampered payload, alg=none, HS256 confusion,
  malformed/missing-iss tokens, OTHER_AUDIENCES, concurrent JWKS rotation,
  multi-provider routing, refresh_token flow, and iat/exp/nbf boundaries).
- Add signed aws-chunked truncated-terminator and reordered-chunk negative
  E2E tests (PutObject and UploadPart), multipart ETag-of-ETags and
  COMPOSITE/FULL_OBJECT checksum proptests in rustfs-rio and rustfs-ecstore,
  live audit webhook denial delivery tests (with honest characterization of
  gateway SignatureDoesNotMatch auditing), and fuzz/proptest + GHSA
  regression admission rules in AGENTS.md and adversarial-validation.md.

Refs: rustfs/backlog#2675, rustfs/backlog#2724, rustfs/backlog#1151

* test(security): bound listing checks and allow new audit events

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* test(ecstore): scope upload lock identity helper to its Linux test

* ci: allow cold builds to finish all fuzz binaries
2026-11-29 09:50:04 +08:00
Chris An c673245190 fix(helm): provide writable temporary storage for scanner restores (#9687)
* fix(helm): provide writable temporary storage for scanner restores

Paged usage checkpoints larger than 1 MiB need a temporary file during restore. Mount a disk-backed emptyDir at /tmp in each RustFS pod and honor existing mounts on upgrade.

Fixes #9672

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* test(ecstore): scope upload lock identity helper to its Linux test

* ci: allow cold builds to finish all fuzz binaries
2026-11-29 09:49:55 +08:00
Ramakrishna Chilaka 312e1bc6f6 perf(crypto): encrypt and decrypt stream_io fragments in place (#9733) 2026-11-29 09:49:47 +08:00
Ramakrishna Chilaka 39065bb10c perf(signer): avoid redundant string and vector allocations in SigV4 signing (#9728) 2026-11-29 09:49:39 +08:00
Ramakrishna Chilaka 9807dd884c perf(lock): eliminate redundant allocations, clock calls, and guard unregistrations (#9720)
* perf(lock): eliminate redundant allocations, clock calls, and guard unregistrations

* fix(lock): scope GlobalLockManager fast inherent helpers to crate
2026-11-29 09:49:30 +08:00
Ramakrishna Chilaka daf7d280d7 perf(ecstore): defer destination preflight on fused non-inline commits (#9716)
* perf(ecstore): defer destination preflight on fused non-inline commits

Extend deferred destination preflight to non-inline fused rename_data commits on Linux, skip descriptor-cache part path construction and invalidation when committing inline objects, and use io_get_object_open_path for staged multipart data directories on Linux.

* fix(ecstore): gate can_defer_dst_preflight with cfg(target_os = "linux")
2026-11-29 09:49:22 +08:00
Ildar Manzhikov 85aa1bb241 fix(ecstore): settle already-applied delete markers (#9688)
* fix(ecstore): settle already-applied delete markers

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): scope upload lock identity helper to its Linux test

(cherry picked from commit 72539d5991)

* ci: allow cold builds to finish all fuzz binaries

(cherry picked from commit 95e299b012)

---------

Co-authored-by: overtrue <anzhengchao@gmail.com>
2026-11-29 09:49:14 +08:00
唐小鸭 02981d3838 fix(sse): accept ARN-prefixed plain key names on SSE-KMS writes (#9679)
An SSE-KMS write whose x-amz-server-side-encryption-aws-kms-key-id header
carries a plain key name behind an AWS-style ARN prefix
(arn:aws:kms:<name>) failed with 400 KMS.NotFoundException, because the
whole header value was looked up as the key name. Bucket replication from
a source that sends key names in that form therefore left every SSE-KMS
object FAILED.

The request header is now reduced to <name> when the remainder after the
prefix is a non-empty name without ':' or '/'. Complete key and alias ARNs
keep further ':'-separated fields and are passed on unchanged. The
reduction runs on the request's own value before it is merged with a
bucket default and before the KMS authorization check, so PutObject,
CopyObject and CreateMultipartUpload authorize, seal and record one key
id. A bucket default KMSMasterKeyID is still used as configured.
2026-11-29 09:49:05 +08:00
Ramakrishna Chilaka 60766c0abf perf(sse): fast-path unencrypted metadata and static header lookups (#9729) 2026-11-29 09:48:57 +08:00
Ramakrishna Chilaka 6128dcadd4 perf(iam): avoid redundant UserIdentity clones in auth lookup and policy merge (#9727) 2026-11-29 09:48:49 +08:00
Ramakrishna Chilaka 486914b5cf perf(object-data-cache): intern null version id and precheck projected weight (#9722) 2026-11-29 09:48:40 +08:00
Ramakrishna Chilaka e1f497e1b1 perf(rio): avoid redundant checksum clones, buffer allocs, and stack zeroing (#9721) 2026-11-29 09:48:31 +08:00
Ramakrishna Chilaka b9ebd30782 perf(utils): avoid redundant hashing and allocations in metadata_compat (#9719)
Skip empty-map probes in get_str, get_consistent_value, contains_key_str, and remove_str, remove redundant pre-retain HashMap::remove calls on ASCII suffixes in remove_str, and avoid String allocations in internal_key_starts_with and both_keys.
2026-11-29 09:48:23 +08:00
Ramakrishna Chilaka 84dcdbe630 perf(filemeta): pre-size marshal buffers and MetaObject metadata maps (#9718)
Pre-size MetaObject::meta_sys and MetaObject::meta_user in From<FileInfo> for MetaObject to avoid HashMap table reallocations, and pre-size marshal_msg buffers on ObjectPartInfo, MetaObject, FileMetaVersion, and MetaDeleteMarker.
2026-11-29 09:48:14 +08:00
Ramakrishna Chilaka 21d8b0fad6 perf(ecstore): add uniform part-quorum fast path and reduce upload path allocs (#9717)
Add a uniform-quorum fast path in resolve_read_part_from_responses to avoid HashMap allocations when disks agree on part metadata, avoid intermediate String and Vec allocations in get_multipart_sha_dir and get_upload_id_dir, and use Arc<str> and in-place prepared_disks return in SetDisks::rename_part.
2026-11-29 09:48:06 +08:00
Ramakrishna Chilaka 09211806f3 perf(ecstore): scale GET metadata cache and share shuffled read metadata (#9715)
Increase DEFAULT_GET_OBJECT_METADATA_CACHE_MAX_ENTRIES to 32,768 and GET_OBJECT_METADATA_CACHE_FENCE_SHARDS to 16,384, precompute and share Arc-backed shuffled non-inline metadata on GetObjectMetadataCacheEntry across GET reader paths, and insert SUFFIX_ACTUAL_SIZE into FileInfo before cloning per-replica metadata in SetDisks::put_object.
2026-11-29 09:47:57 +08:00
Hauser Zhi 1171ac9be2 feat(ecstore): observe destination directory fsync batches (#9711)
Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:47:48 +08:00
Ramakrishna Chilaka 4a55a3f5cc perf(ecstore): deduplicate multipart commit checks and coalesce cleanup (#9691)
Scope has_clean_active_multipart_source to individual part numbers when checking part transactions and serialize unsettled_parts updates inside the part-transaction lock and SourceRW blocking closures.

Add has_active_multipart_source_matching so SetDisks::put_object_part can reuse the pre-commit upload head metadata in the commit stage when the upload commit guard is held, no size limit applies, and all active local drives match the cached upload data_dir and mod_time.

Coalesce empty <sha256> ancestor directory pruning into the same blocking operation as the multipart upload trash rename in LocalDisk::delete, reducing recursive multipart upload cleanup from two blocking-queue jobs per drive to one.
2026-11-29 09:47:38 +08:00
Ramakrishna Chilaka b1cdac7539 perf(ecstore): deduplicate multipart metadata path resolution and stamps (#9712)
Reuse validated bucket/upload paths and pre-rename FileStamps during multipart metadata writes, add an in-memory data_dir-bound precheck in LocalDisk::read_parts before acquiring DiskIoPermit, and skip unused part cleanup vector construction in SetDisks::complete_multipart_upload when can_skip_part_cleanup is true.

Co-authored-by: Hauser Zhi <housemecn@gmail.com>
2026-11-29 09:47:29 +08:00
Hauser Zhi fdacb7ae40 perf(quota): batch v1 ledger writes under contention (#9694)
* perf(quota): reuse the v1 ledger lock during admission

Use the fenced ledger read for both the stale reservation check and
quota admission. Drop the ledger lock while probing operation owners,
then reload before applying recovery. Correlate v1 ledger acquisitions
across request and detached commit tasks.

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* perf(quota): batch v1 commit markers and settlements

Share one fenced ledger load and durable save for pending mutations
on the same coordinator. Keep per-request acquisition budgets and
retain operation owners until persistence completes. Preserve isolated
mutation errors and the existing admission and crash boundaries.

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* perf(quota): batch v1 admissions through the ledger executor

Apply pending admissions against one fenced balance and acknowledge
them after the shared durable save. Keep independent recovery for
abandoned operations and avoid reporting a speculative hard-cap
denial after a failed write. Share immutable reservation data across
detached stages without copying object and ledger keys.

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* test(heal): wait for restored root completion handoff

Use the scheduler's test hook to wait for the terminal publication
attempt and active-task removal without polling against a five-second
wall-clock deadline. Verify the successful terminal receipt on disk
and that no pending recovery remains.

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

---------

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:47:21 +08:00
GatewayJ 2c46461ff9 fix(oidc): allow operator-configured outbound proxies in egress policy (#9709)
Separate operator-configured HTTP(S) forward-proxy resolution from direct target DNS filtering in `rustfs_utils::egress` and wire OIDC HTTP clients through `OutboundPolicy::configure_reqwest_client`. Target OIDC URLs are always validated up front, direct and `NO_PROXY`/loopback connections retain connection-time target DNS filtering, and matched `HTTP_PROXY`/`HTTPS_PROXY`/`ALL_PROXY` hops permit private, shared, and loopback proxy addresses while keeping metadata, link-local, unspecified, translation, and reserved addresses (plus SOCKS schemes) blocked fail-closed. `OutboundPolicyError` preserves its exact target-policy shape alongside orthogonal `OutboundClientError`, and proxy rejections identify the proxy configuration without emitting misleading `RUSTFS_OUTBOUND_ALLOW_ORIGINS` hints for the OIDC provider origin.

Fixes #9611
2026-11-29 09:47:13 +08:00
Hauser Zhi 70c48de27b perf(ecstore): reuse unfenced multipart disk state (#9708)
Move the shuffled disk vector into completion and avoid creating an
unused token table when the quota mutation fence is inactive.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:47:04 +08:00
Hauser Zhi b5d197dd44 perf(ecstore): join synchronous unary rename outcomes directly (#9702)
Collect direct unary results from the detached JoinSet. Preserve
streamed delivery for batch, early ACK, and publication-scoped
operations, with the existing rollback and deadline handling.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
Co-authored-by: overtrue <anzhengchao@gmail.com>
2026-11-29 09:46:56 +08:00
Hauser Zhi 16b449c61d feat(obs): trace slow synchronous rename slots (#9697)
Report the phase split and configured disk coordinates for a slow
direct unary slot. Reuse an available request trace ID across the
detached PUT commit without changing RPC metadata.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:35:00 +08:00
Hauser Zhi b5e69531dc feat(ecstore): opt in to higher parity for degraded PUTs (#9692)
* feat(ecstore): opt in to higher parity for degraded PUTs

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* fix(ecstore): count recovering drives in degraded PUT parity

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* test(storage): exercise recovery and late quorum loss

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* test(e2e): bound startup during degraded parity checks

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* perf(ecstore): streamline degraded PUT and writer setup

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

* perf(ecstore): avoid redundant PUT staging work

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>

---------

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:34:50 +08:00
Hauser Zhi de1aa2429c perf(ecstore): avoid redundant rename commit allocations (#9698)
Skip allocating empty scanner fence tables. Borrow the online disk
list for fully joined capacity accounting and borrow UTF-8 views for
local rename path validation.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:34:38 +08:00
Hauser Zhi f92a493d37 perf(ecstore): skip unused quota fence state on ordinary PUT (#9704)
Avoid an all-empty token table and gate tail release captures on an
active quota mutation fence. Preserve the existing fence finalizer
and cancellation handling.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-29 09:34:19 +08:00
Hauser Zhi 038af7dcaa perf(ecstore): reuse the synchronous rename disk snapshot (#9701)
Reuse the fanout disk vector after all producers join and write
quorum succeeds. Keep reuse ownership with the caller and drop it
before entering asynchronous rollback or recovery.

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-28 15:26:25 +00:00
Hauser Zhi 7eb34f2078 fix(iceberg): report duplicate warehouse parameters consistently (#9703)
Extract the warehouse validation fix from 5b32426529 and assert the exact error for repeated query parameters.

Co-authored-by: overtrue <anzhengchao@gmail.com>
Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: zhi22915 <qiuzgang@gmail.com>
Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
2026-11-28 15:08:42 +00:00
唐小鸭 3a7ceb350f fix(heal): converge past superseded overwrite backups (#9681)
An overwrite interrupted after publishing its metadata leaves the
replaced generation's backup, and its data directory, behind a live
successor. Delete recovery classified that residue as an ambiguous legacy
delete, so object heal failed before shard reconstruction on every retry
and the object stayed under-replicated.

A drive now reports a journal-less backup whose versions are all still
live, with the differing one replaced in place by a strictly newer
unversioned object. The report alone resolves nothing. Heal proceeds past
such residue only when the newest generation reached write quorum, and
discards the backups only once every drive holds identical live
metadata. The replaced parts are then reclaimed as plain orphan data
directories. Residue with delete evidence, versioned, tiered or
object-locked successors, and an uncommitted successor stay blocked.

Co-authored-by: hector <42570491+majinghe@users.noreply.github.com>
2026-11-28 13:54:16 +00:00
Chris An 97d30eaccf test(security): add fuzzing, rejection mutants, and obs fault tests (#9699)
* test(security): add fuzzing, rejection mutants, and obs fault tests

Add sigv4_request and notify_xml libFuzzer targets with seed corpora and
unit tests, wire fuzz.yml as a workflow_call security-input-gate in CI
with trusted changed-path selection, and add fixed rejection-branch
mutation verification in isolated workspaces.

Verify #[path] coverage attribution with canonical path merging in
coverage_per_crate.py, sanitize OTLP startup endpoint logging, and add
connect_logs lease/fault regressions, local fake-OTLP 401/500/refused/
timeout/redaction tests, and E2E observability export failure isolation
tests.

Refs: rustfs/backlog#2677, rustfs/backlog#2679

* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): run called validation gates and count wrapped coverage lines

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* ci: budget for cold instrumentation builds and validation rebuilds

* test(ecstore): scope upload lock identity helper to its Linux test

* test(ecstore): isolate namespace lock checks from runner disk latency

* test(ecstore): wait for inline source publication before reading a disk

* test(connect): isolate the durable receipt integration test
2026-11-28 13:47:56 +00:00
祈雨 bc990465e2 perf(policy): bound wildcard matching on adversarial inputs (#9486)
Co-authored-by: Kuromi <kuromiqiyu@gmail.com>
Co-authored-by: GatewayJ <835269233@qq.com>
Co-authored-by: Hauser Zhi <housemecn@gmail.com>
Co-authored-by: Chris An <anzhengchao@gmail.com>
2026-11-28 13:27:28 +00:00
Peter van Mourik bbf422e1ee fix(ecstore): remove staged heal data when the heal is dropped (#9591)
* fix(ecstore): remove staged heal data when the heal is dropped

A heal task that reaches its timeout, or is cancelled, has its storage heal future dropped in the middle of the data stage. The shards it had staged under its tmp prefix were only removed on the heal's own return paths, so a dropped heal left them on the outdated disks until the stale-tmp sweep a day later.

Add a guard that removes the staged prefix when the heal future is dropped during the data stage. It is disarmed once the heal has cleaned up itself and before the rename phase, so it never removes a prefix that is being renamed into place.

* test(ecstore): prove staged heal cleanup stops before the rename phase

Add a regression test for the disarm that precedes the rename phase: pause the physical rename of the first target, drop the heal future, and check that no staged-prefix removal was dispatched and that the detached rename still publishes a complete target. A test-only counter in the guard's Drop makes the dispatch observable.

The two tests share one fixture, and the staging test now also asserts exactly one dispatch.

* test(ecstore): gate heal rename test off Windows, observe publication

The rename test imports `prepared_publication_test_hooks`, which `disk/os.rs` compiles out on Windows, so the ecstore unit-test binary did not build there. Gate the test to the platforms that provide the hook, as the other users of the hook are.

The fixture removed the targets' shard directory and left their metadata head pointing at the data directory, so the wait for the detached rename was already satisfied before the rename ran. Start both targets without a metadata head, assert the paused target still has none while its rename is held, and wait for the head to appear before checking the data directory it names.

---------

Co-authored-by: Hauser Zhi <housemecn@gmail.com>
Co-authored-by: Chris An <anzhengchao@gmail.com>
2026-11-28 03:35:42 +00:00
Chris An 318150a496 fix: restore S3 test users and Iceberg warehouse error handling (#9700)
* fix(ci): stop sending deprecated policy field in s3-tests add-user

rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests.

Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py.

Refs: rustfs/backlog#1246

* fix(ci): fail S3 user provisioning on HTTP errors without logging responses

* fix(iceberg): reject repeated warehouses before validating bucket names

* test(ecstore): wait for relaxed writes on the foreground lane

* test(quota): isolate concurrent real-disk probes in CI

* test(ecstore): scope upload lock identity helper to its Linux test

* ci: allow cold builds to finish all fuzz binaries
2026-11-28 03:35:35 +00:00
Chris An 17808b9fe5 fix(heal): stop retrying committed deletes on generation conflicts (#9685) 2026-11-27 23:06:27 +08:00
Chris An c3f2636c6b fix(security): drop expired rsa 0.9.10 advisory exception (#9678)
openidconnect 4.1.0 is the only consumer of rsa 0.9.10 and has no
released rsa 0.10 build. Vendor that crate, retarget JWS verification
to rsa 0.10, and remove the exception that expired on 2026-07-31.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Chris An <overtrue@users.noreply.github.com>
2026-11-27 21:27:55 +08:00
Chris An 2e5e99a994 fix(admin): harden admin authz context, scoping, and input validation (#9677)
Propagate verified proxy transport/client context and request-scoped
server context slots across admin authentication and authorization,
including task-scoped IAM root credential lookup so multi-instance
embedded servers do not leak ambient credentials across server domains.

Fail closed with InvalidArgument on non-empty AddOrUpdateUserReq.policy
in both the add-user admin handler and IamSys::create_user, normalizing
empty policy strings to None before persistence and site-replication
hooks.

Wrap GetKmsStatusHandler authorization denials in KmsAdminAudit::gate_admin
using KmsAdminOperation::Status, apply bucket-scoped authorization
symmetrically across bucket quota write and read handlers, and restore the
guardrail comment documenting direct is_allowed evaluation in
service_account.rs.

Enable bucket and object resource matching for scoped admin actions
(SetBucketQuota, GetBucketTarget, SetBucketTarget, InspectData) in the
policy evaluator and wire resource-scoped authorization into replication
remote-target and inspect-data handlers. Align bulk access-key routes on
ListUsersAdminAction for cross-user queries and enforce strict S3 bucket
name validation on quota and table-catalog warehouse parameters.

Refs: rustfs/backlog#1469, rustfs/backlog#1246, rustfs/backlog#1886, rustfs/backlog#2526
2026-11-27 20:20:08 +08:00
Chris An f9a9aa75d5 test(bucket): align PutBucketPolicy audit status expectation with 204 (#9676) 2026-11-27 20:19:54 +08:00
Chris An b9d958ee82 fix(scanner): walk directories with an explicit stack (#9674)
Port the scanner folder walker from #9623 onto current main so nested
directory polls no longer grow the worker stack. Keep later main
behavior for object metadata, lifecycle, heal discovery, and child
errors.

Refs rustfs/backlog#3293

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Chris An <overtrue@users.noreply.github.com>
2026-11-27 19:15:57 +08:00
Chris An 365ef6d557 fix(swift): bound bodies, enforce quotas and default SSE/KMS authz (#9667)
Harden the Swift protocol layer across request body boundaries, storage
quotas, FormPost redirects, and server-side encryption:

- Bound control-plane and streaming request bodies at the HTTP frame and
  decompression boundaries (bulk-delete, bulk-extract tar/gzip/bzip2,
  FormPost multipart, SLO PUT) and cap bulk path/error/part/field counts.
- Enforce MAX_OBJECT_SIZE for unknown-length and mismatched-length object
  uploads via a contract-safe streaming byte-cap reader, reject negative or
  malformed Content-Length headers, and enforce container byte/count quotas
  across PUT, bulk extract, FormPost, SLO, DLO, and COPY with serialized
  in-flight reservations and immediate usage-overlay updates.
- Reject unauthenticated or expired FormPost requests with 401 without
  issuing a redirect, validate signed redirect schemes, restrict unsigned
  redirect_error targets to the signed redirect origin, and preserve binary
  upload payloads losslessly.
- Honor bucket default SSE-S3/SSE-KMS on Swift writes (failing closed on
  unreadable encryption config or missing Content-Length) and authorize
  kms:Decrypt before DEK unwrap on Swift GET and COPY.
- Fix an unconditional SessionContext import in dummy_storage.rs so
  rustfs-protocols compiles under both default and swift features.

Refs: rustfs/backlog#1471, rustfs/backlog#1474, rustfs/backlog#1473, rustfs/backlog#2702
2026-11-27 19:15:28 +08:00
Chris An 78486916d5 ci(security): gate advisories with time-bounded exception registry (#9663)
Add .config/advisory-exceptions.toml (schema_version=1) and scripts/security/check_advisories.py to enforce pinned cargo-deny (0.20.2), advisory-db freshness (<=24h verified cache fallback), bidirectional deny.toml alignment, 90-day max UTC validity windows, exact version scope matching, and PR base-diff approval checks.

Wire security-advisories into ci.yml (ALWAYS_JOBS, required-checks, alert-on-failure, PLAN_CONTRACT=10), align daily audit.yml while preserving all four cargo-deny categories, and register --self-test in make script-tests.

Historical RUSTSEC-2023-0071 (transitive rsa 0.9.10 via openidconnect 4.1.0; direct rsa upgraded to patched 0.10.0 in PR #9492) retains its expired 2026-07 review window and intentionally fails closed until maintainer risk acceptance or upstream upgrade lands.

Refs: rustfs/backlog#2668
2026-11-27 18:59:33 +08:00
Chris An c2b92cfb58 fix(gateway): harden post-cutover S3 auth, body limits, and isolation (#9660)
fix(gateway): harden post-cutover S3 auth, body limits, and context isolation

Address nine post-cutover parity and isolation regressions against rustfs/gateway:
- Keep expired STS sessions enabled in gateway-adapter so gateway returns 400 ExpiredToken (retiring c-cred-0020 ruling) while disabled/invalid STS and expired service accounts remain disabled.
- Remove pre-auth 20 MiB ControlBodyDigestService buffering from S3/gateway listeners, preserving console-listener route isolation via ConsoleListenerRouteService and post-auth SigV2 Content-MD5 checks on DeleteObjects and non-empty config PUTs.
- Stop copying unsigned wire x-amz-server-side-encryption* headers into PostObjectPolicyHeaders during preflight authorization.
- Source live_root() credentials and token signing key strictly from ServerContextSlot rather than process globals.
- Configure max_framed_upload_bytes(5 GiB) and upload_object_ceiling(5 GiB) on GatewayStack.
- Initialize S3 and ListObjects metrics on GatewayStack::assemble.
- Inject ServerContextSlot into NativeConsoleEdgeService request extensions.
- Scope ProtocolStorageClient is_owner and list_buckets IAM lookup to ServerContextSlot without breaking direct-write BucketGenerationGuard invariants.
- Wire verify_paths_double_encoded_under(TABLE_CATALOG_PREFIXES) in native admin, record 204 NO_CONTENT on PutBucketPolicy audit entries, and set explicit 500 status on HeadObject ErrMeta.
2026-11-27 18:59:13 +08:00
Chris An fbe7471ba6 docs(security,kms): add KMS version policy and close doc/compat gaps (#9661) 2026-11-27 17:29:38 +08:00
Chris An def2fb7e47 fix(storage,obs): bound read memory, log disk growth, and part staging (#9668) 2026-11-27 16:41:58 +08:00
Ramakrishna Chilaka d838137c3a perf(ecstore): reuse multipart part-txn lock handles and pre-rename stamps (#9666) 2026-11-27 06:14:01 +00:00
Chris An 52377c1478 ci(security): pin cache-cargo-install-action v3.0.8 for sha pinning (#9662)
Update taiki-e/cache-cargo-install-action in .github/workflows/ci.yml to v3.0.8 (9ee83daaa7b96a6fab930949ecf1122bba04a389), which pins its nested actions/cache reference to commit SHA 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 (v6.1.0).

This removes the sole unpinned nested composite action across all 39 unique third-party actions in the repository and unblocks enabling GitHub repository sha_pinning_required.

Refs: rustfs/backlog#1602
2026-11-27 01:51:12 +00:00