mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-03 06:36:35 +00:00
ebafdec9beb35a342cd47f669accfbeeb5f2fc75
273 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6b014ec215 |
feat(capacity): read usage directly on dedicated mounts (#9840)
* feat(capacity): read usage directly on dedicated mounts Allow operators of dedicated filesystems to use block usage for background capacity estimates. Reuse the existing blocking scan and cache update paths so a successful probe establishes the per-disk baseline. Refs: rustfs/rustfs#9837 Refs: rustfs/backlog#3399 Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * refactor(capacity): verify whole mounts before reading usage Share mount eligibility across a refresh and read allocated blocks through the checked directory descriptor. Rebuild a complete per-disk baseline when the local disk set changes. Refs: rustfs/rustfs#9837 Refs: rustfs/backlog#3399 Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * fix(capacity): discard stale topology on bounded refresh Reconcile a scheduled full refresh against the topology it scanned. Represent baseline completeness with the per-disk map and compute aggregate totals in one pass. Refs: rustfs/rustfs#9837 Refs: rustfs/backlog#3399 Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * fix(capacity): restrict direct reads to isolated filesystem types Use the filesystem type from the existing descriptor-based statfs call to keep shared-pool accounting out of the direct mount path. Cover directory fallback and symlinked mount roots. Refs: rustfs/rustfs#9837 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> |
||
|
|
fc3a216725 |
fix(ecstore,sse): close m-compatible interop gaps and rename feature (#9684)
* fix(ecstore,sse): close rio-v2 interop gaps on imported drive sets
A rio-v2 build that takes over a drive set written in the compatible format could not start once a KMS was configured, and several object reads and writes disagreed with what the other server stores or expects.
- Startup: the IAM migration now opens KMS-sealed IAM records. The record path is part of the key context, so the migration callback receives it, and the context text is escaped the way it was sealed.
- GET of a single-part encrypted object: whether an object holds one cipher stream per part is read from the marker the object records, not guessed from the ETag length. A sealed ETag is longer than an MD5 and sent these objects down the per-part path, which failed authentication.
- ETag: a sealed ETag is opened for GET and HEAD responses.
- HEAD: the public SSE headers are derived from the stored sealing metadata, and the KMS key id is answered in ARN form on GET and HEAD.
- Content length: an object sealed under an object key records no plaintext size when it is a single-part upload; the size is derived from the stored size of its parts.
- Compression: the compression and actual-size keys are also written in the casing the other server looks up.
- User metadata is stored under the x-amz-meta- prefix so it comes back as user metadata on both sides. Keys starting with "internal-" keep their bare form, because the prefixed form falls into a namespace reads hide.
- Replication: the metadata comparison skips the prefixed user metadata, which the target's HEAD answers without the prefix and which therefore never compared equal.
- ListObjectVersions and the metadata listing extension report the plaintext size of encrypted and compressed versions. This is the only intended behaviour change in a default build.
Three differences stay as they are: the other server cannot read SSE-S3 objects this build writes, listings do not open sealed ETags, and an SSE-KMS write is refused when only a static master key is configured.
Each fix has a regression test that fails without it.
* build: rename cargo feature rio-v2 to m-compatible
The feature selects the stored layout a build reads and writes, not a version of the stream crate, so it is named after that. The rename covers the feature key in every crate that forwards it, all cfg attributes, the CI job ids, names and artifacts, the CI gate and its tests, the validation scripts, the compat compose build argument, the debug launch configuration and the documentation.
The crate rustfs-rio-v2, its path and module name, the tests named after that reader implementation, and the backend_name() strings are unchanged. There is no alias: a build that passed --features rio-v2 must pass --features m-compatible.
No behaviour change in either build.
* refactor(ecstore,sse): select the build variant at one point per module
The m-compatible feature was tested at about 220 places, most of them inside function bodies. Each area that differs between the two builds now has a pair of modules exporting the same functions, and one place that picks between them, so call sites no longer name the build.
- ecstore: io_support/rio.rs selects rio/{native,m_compatible}.rs for the stream readers and writers, the compression scheme and index encoding, and the write-side encryptors. object_api/readers.rs selects readers/{native,m_compatible}.rs for range plans, the multipart layout, plaintext sizes that are not recorded, empty parts and the decompressed stream.
- sse: the sealed-ETag branch moves out of core/read.rs into core/keying/, where this crate keeps its build-specific code, and decrypt_kms_sealed_config is exported in both builds.
- utils: the four checks in metadata_compat.rs become one predicate.
- Tests that exist in only one build move to tests/native.rs and tests/m_compatible.rs child modules, gated once where they are declared. The set of test names is unchanged apart from one rename.
The attribute now appears 95 times; in ecstore it is left on the two selection points and on tests. crates/ecstore/AGENTS.md records the convention.
scripts/error-other-format-baseline.txt changes because that ratchet counts per file: 11 existing call sites moved from object_api/readers.rs (19 to 8) into the new readers/m_compatible.rs (11). The total stays at 564.
No behaviour change in either build. docs/architecture/minio-file-format-compat.md gains a table of where the variant lives and a corrected statement of what a default build can read.
* fix(s3): compare read preconditions with the answered ETag
A HEAD or GET of an object whose stored ETag is sealed answers with the ETag clients were shown for it, but If-Match and If-None-Match were still compared with the stored form. A client sending back the ETag HEAD answered with got 412 for If-Match and no 304 for If-None-Match.
- HEAD and GET compare the ETag conditions with the ETag the response carries, and a 304 carries that ETag.
- The storage layer ends a conditional read on the stored ETag before a body is opened, and cannot await the answered one. For a stored ETag in sealed form it no longer ends the read on an ETag condition and leaves the decision to the request layer. Without this a matching If-Match ended the read with no body to answer with.
- A default build stores no sealed ETag: the form test is constant false there and its behaviour is unchanged.
Tests: a round trip on a real store takes the ETag from HEAD and sends it back to GET and HEAD as If-Match and If-None-Match, and sends the stored form to show it matches nothing; unit tests cover the precondition helper, the storage-layer decision and the form test in both builds. With either half of the fix switched off the round trip fails.
* fix(s3): compare copy-source conditions with the answered ETag
x-amz-copy-source-if-match and x-amz-copy-source-if-none-match on CopyObject and UploadPartCopy were compared with the stored ETag of the source. For a source whose stored ETag is sealed that is not the ETag a read answers with, so the ETag from HEAD was refused with 412.
Both compare the ETag a read of the source answers with, as GET and HEAD do since the previous commit. It is resolved after the source's key authorization and only when the request names an ETag. A default build stores no sealed ETag and is unchanged.
Tests: on a real store, a customer-key source with a sealed stored ETag is copied with the ETag from HEAD as copy-source-if-match through both operations; the stored form as if-match and the answered ETag as if-none-match are refused. The fixture is shared with the read round trip. With either call site switched back the test fails.
* fix(s3): answer a date-conditioned GET 304 with the answered ETag
A GET that carried only If-Modified-Since resolved no answered ETag, because the lookup was limited to requests naming an ETag, and its 304 fell back to the stored ETag. For an object whose stored ETag is sealed the 304 then carried a different validator than HEAD answers with.
GET resolves the answered ETag for every conditional request, so a 304 carries it whichever condition produced it. HEAD already did. An unconditional GET still skips the lookup, and a default build stores no sealed ETag and is unchanged.
Tests: the sealed-ETag round trip takes Last-Modified from HEAD, sends it back as If-Modified-Since to GET and HEAD, and requires the 304 of both to carry the ETag HEAD answered with. With the lookup limited to ETag conditions again, the GET half fails.
---------
Co-authored-by: overtrue <anzhengchao@gmail.com>
|
||
|
|
8a5fd2c260 | perf(utils): avoid string allocations in header classifiers and path helpers (#9723) | ||
|
|
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 |
||
|
|
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. |
||
|
|
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 |
||
|
|
ac6253cf38 |
fix(policy,s3select,rpc): harden policy, S3 Select, and RPC auth (#9640)
* fix(policy): scope NotAction Allow to named action families Confine Allow statements built from NotAction to the action families named in their exclusion list so S3 NotAction policies on wildcard or bucket resources cannot implicitly grant admin, STS, or KMS actions. Fail closed when both Action and NotAction are empty, preserve explicit Deny + NotAction reach across all action families, and preserve explicit admin NotAction coverage for sibling admin actions. Refs: rustfs/backlog#3321 * fix(policy,utils): eliminate exponential wildcard matching Replace recursive backtracking in wildcard matching (rustfs-policy and rustfs-utils) with iterative O(name.len())-space dynamic programming that collapses consecutive '*' wildcards and preserves allocation-free fast paths for literal and single-'*' patterns. Also cap versioning ExcludedPrefixes count (100) and byte length (1024) in validate_bucket_versioning_update as defense in depth. Refs: rustfs/backlog#3318 * fix(policy): prefer parent over raw sub for aws:userid variable Share a single resolve_userid_values helper between VariableResolver::resolve and resolve_multiple that prefers the issuer-scoped parent claim over raw sub, aligning the ${aws:userid} policy variable with the aws:userid condition key derived in auth facts while retaining sub as a fallback when parent is absent. Refs: rustfs/backlog#3339 * fix(policy): treat anonymous-matching principals as public Add Principal::is_public() matching either '*' or the empty anonymous account '' through the same wildcard matcher used during request authorization, and switch execute_put_bucket_policy and execute_get_bucket_policy_status to use it so empty and leading-'?' principals cannot bypass BlockPublicPolicy or evade public status classification. Refs: rustfs/backlog#3357 * fix(s3select): restrict SQL functions to an explicit allowlist Replace unfiltered DataFusion default scalar, aggregate, and window UDF registration in SimpleFunctionMetadataManager with an explicit S3 Select allowlist, register allowlisted scalar aliases directly, and remove the session scalar-function fallback from MetadataProvider::get_function_meta. Wrap retained expanding scalar functions (concat, concat_ws, to_char) and any manually registered count-sized functions (repeat, lpad, rpad) with a pre-allocation result-size guard that also re-wraps scalar UDFs produced during expression simplification. Refs: rustfs/backlog#3317 * fix(s3select): bound SQL operator and nesting depth at parse Add BoundedRustFsDialect enforcing a per-parse infix/postfix operator budget (MAX_SELECT_OPERATORS) via Dialect::parse_infix returning ParserError::RecursionLimitExceeded, and wire it into both ExtParser::parse_sql and legacy_json_source_from_input. Also bound set-operation keyword counts before parsing (preventing deeply nested SetExpr chains from overflowing on drop) and bound nested field-access chains during statement preparation. Refs: rustfs/backlog#3319 * fix(s3select): bound uncompressed record sizes and decoding Apply RecordSizeTracker (MAX_SELECT_RECORD_BYTES) across uncompressed plain, ScanRange, and ScanRange header reads in EcObjectStore, recognizing CR, LF, and CRLF line endings for default CSV inputs without a custom RecordDelimiter. Bound session batch sizes and disable batch coalescing for CSV and JSON Lines, replace DataFusion's unbounded stock listing table scan with a byte-bounded, memory-pool-accounted DelimitedSelectTable, keep multi-record JSON Lines schema sampling within the session memory pool budget, and add a StreamFilterOutput physical optimizer rule so FilterExec streams filtered batches without re-coalescing. Refs: rustfs/backlog#3348 * fix(rpc): gate gRPC boot-epoch proofs on verified signatures Stop computing and attaching secret-keyed boot-epoch, replay-cache, and msgpack capability response proofs before gRPC authentication runs in RpcRequestPathService::call. Gate proof generation on an RpcSignatureVerified request marker raised by check_auth only after the internode HMAC signature has verified, including post-HMAC rejections (stale boot epoch, replay-scope retries, replay detection, and replay-cache/background admission resource exhaustion) required for cluster recovery. Verify the method-bound v2 HMAC signature before returning replay_scope_required in verify_tonic_rpc_signature_with_policy so unsigned, legacy-only, or forged callers never trigger a post-HMAC rejection reason or consume replay-cache capacity. Refs: rustfs/backlog#3326 * fix(keystone): namespace parent_user by Keystone user ID Set Credentials.parent_user in KeystoneAuthProvider::keystone_token_to_credentials to the namespaced Keystone identity (keystone:<user_id>, matching access_key) instead of the bare Keystone username. This prevents an external Keystone username from colliding with a local IAM user or the root access key in service-account ownership checks and the is-admin handler while keeping the username available in Credentials.name and claims["keystone_username"]. Update the keystone unit tests and HTTP/3 external stack test expectations, and add regression coverage verifying colliding usernames are never placed in parent_user. Refs: rustfs/backlog#3362 --------- Co-authored-by: Hauser Zhi <housemecn@gmail.com> |
||
|
|
2e9e206d02 |
fix(ecstore): reject startup without a local endpoint (#9638)
* fix(ecstore): reject startup without a local endpoint Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * perf(ecstore): resolve startup DNS once per host Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * fix(ecstore): reject zero-port storage endpoints Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * fix(ecstore): bound startup DNS by the topology deadline Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * fix(server): exit promptly after a startup DNS timeout Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * perf(ecstore): skip unused endpoint identity scans Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * fix(log-analyzer): track startup DNS failures Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> * test(ecstore): preserve fresh copy-heal upload initiation Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> --------- Signed-off-by: Hauser Zhi <housemecn@gmail.com> Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> Co-authored-by: qunjiazhu <qunjiazhu@gmail.com> Co-authored-by: Chris An <anzhengchao@gmail.com> |
||
|
|
9a65ac95f7 |
fix(ecstore): bound compressed GetObject range reads (#9639)
* fix(ecstore): bound compressed GetObject range reads Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * chore(ci): tighten compressed reader error ratchet Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(ecstore): stream object ranges directly to callers Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(ecstore): decode compression indexes without reframing Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(rio): reuse verified plaintext block buffers Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * test(server): count SSE-C warnings without collecting Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * test(admin): distinguish explicit and implicit IAM denials 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> |
||
|
|
ed6f9cbdc4 | fix(authz,ecstore,protocols): harden S3 authz, WORM, storage & protocols (#9646) | ||
|
|
47e27180f2 |
feat(signer): support optional FIPS signing for S3 SigV4 (#9219)
* feat(signer): support optional FIPS signing for S3 SigV4 * test(signer): verify AWS-LC services used by SigV4 hashing --------- Co-authored-by: Chris An <anzhengchao@gmail.com> |
||
|
|
a984f42b0b |
fix(replication): stop re-sending existing objects every scan cycle (#9412)
* fix(replication): stop re-sending existing objects every scan cycle Existing objects on a site-replication source were re-queued and re-sent on every scanner cycle, so the replica kept rewriting the same versions and its reported bucket size grew while the object count stayed flat. Two defects combined: - The per-target resync stamp was computed by the worker but never written back to the source object, so the resync decision kept returning "replicate" for every object older than the reset date. The status writeback now persists the stamp under both internal metadata prefixes, and a successful full-object send of an existing object is stamped as well. - The target HEAD only reported the tag count, so the tag comparison always saw a difference for tagged objects and fell back to a full re-send. The replication HEAD now sends x-amz-tagging-directive: ACCESS and the server answers with the tag set under the same authorization as the tag count. Targets that do not return the tag set still compare as different, which costs one extra send instead of a loop. Also drop replicate_all_stat_options, which built the directive but was never passed to the HEAD call. Refs #9354 * test(replication): use relative paths in the resync stamp test |
||
|
|
05554bee00 |
chore(deps): clean up unused dependency declarations (#9411)
Move test helpers to dev-dependencies and clean unused build requirements and workspace metadata. Use profiling compatibility entrypoints for probe-free crates and verify the application's hotpath, allocation, and CPU feature graphs. Validate the affected libraries, FTPS/SFTP test targets, and 1729 existing library tests. Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> |
||
|
|
eca95f2973 |
perf(ecstore): erasure read path for large GETs (#9304)
Lands the contributor's pull requests #9302 (opt-in lockless KV cache buckets), #9303 (per-bucket XXH3 ETags; MD5 off the request task) and #9304 (erasure read path for large GETs) as one change, because #9304 was stacked on the other two. Maintainer changes on top of the contributed work: - Merged main. crates/ecstore/src/erasure/coding/bitrot.rs: kept the PR's verify_chunked_frame/append_chunked_data restructuring and routed its hash-mismatch log through main's throttled log_hash_mismatch. - rustfs/src/app/multipart_usecase.rs: took main's per-operation split and re-applied the PR's changes in place: multipart_etag_algorithm and its test in the parent module, the XXH3 pin in create.rs, the stage timer and from_stream_with_etag in upload_part.rs. - Reworded one doc comment in crates/config/src/constants/object.rs that spelled an ecstore import path, which the architecture migration guard counts as a direct import. - fix(config): made the MD5 offload opt-in. Each offloaded upload holds one blocking-pool thread until its body ends, and that pool also serves disk I/O, so many concurrent large uploads could starve disk writes. The default threshold is now 0 (disabled); operators enable it with RUSTFS_OBJECT_ETAG_MD5_OFFLOAD_MIN_BYTES (for example 8388608). |
||
|
|
0f904a170e |
fix(clippy): satisfy lints introduced in Rust 1.100 (#9377)
* fix(clippy): satisfy lints introduced in Rust 1.100 * fix(clippy): cover Linux-only and feature-gated Rust 1.100 lints Restore the StorageError clone grouping check in the migration test, assert collection lengths before the rewritten test loops, and fix the needless_bool in the Linux-only heal readiness test and the redundant_clone in the swift formpost path. |
||
|
|
78325ce491 |
fix(s3-client): retry transient remote S3 requests (#9361)
Signed-off-by: zjuncal <naclzju@outlook.com> |
||
|
|
1b3c477f05 |
fix(ecstore): bound bitrot and remote disk failure logs (#9328)
* fix(ecstore): bound bitrot and remote disk failure logs A failing drive logs one error per shard block of every read it serves, and an unreachable peer logs one warning per in-flight operation. Neither had a rate limit, so a degraded drive or peer could produce log volume at the speed of the failing I/O. The three bitrot read failures (short shard, hash mismatch, read error) and the two remote disk failures (timeout, network-like error) now log at most once per five seconds and report how many events were suppressed. The remote disk throttles belong to each disk handle, so one noisy peer cannot hide another peer's first warning. Error results, health marking and the per-operation counters are unchanged. * fix(ecstore): bound reader retirement warnings in the decoder A slow shard reader is retired once per stripe of every read it lags on, and a parity reader that cannot be aligned is retired with a warning each time. Both lines name only a shard index. They now log at most once per five seconds with the number suppressed; the retirement itself and the error recorded for the shard are unchanged. |
||
|
|
31e1e42ad7 |
refactor: land the s3s decoupling groundwork on main (#9276)
Lands gateway/integration on main: the guard rails and the domain decoupling for replacing s3s with rustfs/gateway (rustfs/backlog#2734, Phase 0 and Phase 1). The S3 edge is still s3s and no wire behaviour change is intended. - Guard rails: lower-only s3s footprint baseline and edge allow-list, per-crate test-count floor, 39 byte-level goldens for the persisted bucket-config XML families, a two-server differential harness over all 73 S3 operations, a JUnit differ, and a reference-parity lane against the sha256-pinned 1.0.5 binary. - Owned types: rustfs-s3-types (S3Error, S3ErrorCode, Body), RequestEnvelope, AuthzFacts. - Engine crates off s3s: ecstore, lifecycle, replication, scanner, protocols, s3select, s3-client, rpc. - Admin: error types moved; 300 of 314 Operation impls take the owned AdminRequest. - Server: the s3s-compat tower layers grouped under server/legacy_compat; RUSTFS_S3_STACK=legacy|gateway selector, where gateway refuses to start until the gateway edge exists. Fixes made on the branch that change ecstore and heal behaviour are listed in the pull request description. The per-commit history stays on gateway/integration. |
||
|
|
50707a610c |
test(utils,rio,checksums): add checksum SIMD equivalence and bench UTs (#9217)
Add unaligned-boundary SIMD vs scalar equivalence unit tests and on-demand (#[ignore]) utility-level throughput microbenchmarks across rustfs-utils, rustfs-rio, and rustfs-checksums: - crates/utils/src/hash.rs: verify HighwayHasher SIMD (AVX2/SSE4.1/NEON) against highway::PortableHash scalar reference and contiguous hash_encode vs odd-chunked hash_encode_slices across unaligned tail boundaries; provide on-demand throughput microbenchmark. - crates/rio/src/checksum.rs: verify SIMD-accelerated CRC32, CRC32C, and CRC64_NVME against bitwise scalar reference implementations across vector tail boundaries and measure utility-level throughput across all 10 BASE_CHECKSUM_TYPES. - crates/checksums/src/lib.rs: verify streaming chunked update + finalize + headers() against one-shot digests across all 9 ChecksumAlgorithm variants for unaligned chunk and payload sizes, plus on-demand throughput microbenchmark. |
||
|
|
d6210ac17b |
fix(s3,ecstore,table-catalog): bound work driven by client input (#9172)
* fix(ecstore,heal,select): bound storage-layer work driven by client input Scan findings in the erasure store, heal, file metadata and S3 Select layers, grouped because they share the disk walk, the multipart staging area, delete recovery and the select snapshot lease: - Multipart: upload ids are canonicalized before they name a staging path or a lock key (backlog#3027); trailing-slash keys are encoded like every other handler (backlog#3055); unlisted parts are removed at completion (backlog#3106); per-bucket uploads are found through a signed per-disk index instead of a scan of the shared staging area (backlog#3121); encrypted part ETags carry a per-upload secret so a write-only user cannot confirm plaintext guesses (backlog#3044). - Delete and recovery: recovery walks are bounded per request (backlog#3038); a delete marker on a key whose xl.meta path is a directory, and sidecar names used as child keys, no longer wedge the journal (backlog#3035, backlog#3105); over-quota PUTs no longer list the bucket under the ledger lock (backlog#3128). - Listing: scan_dir sends metadata without inline data (backlog#3052), counts delete markers against max-keys (backlog#3108), and rejects a marker that carries the cursor tag (backlog#3059). - Heal: bucket metadata and heal records live in separate namespaces so DeleteBucket cannot erase a drive rebuild (backlog#3039), a deleted bucket is skipped instead of failing the rebuild (backlog#3040), and directory objects are encoded on readback (backlog#3061). - Restore and tiering: RestoreObject preserves tags and the version's modification time (backlog#3073, backlog#3074); Snowball transport headers are not forwarded to the tier (backlog#3090); an epoch modification time round-trips through xl.meta (backlog#3063). - Locks: PutObject takes its bucket locks after the body is staged (backlog#3131); SelectObjectContent releases its namespace locks once the snapshot is taken (backlog#3132). - RPC and peers: the v3 signature check consumes the v2 nonce (backlog#3129); a bucket-metadata reload timeout no longer marks the peer offline (backlog#3124); replication target requests carry an operation deadline (backlog#3102); the scanner resumes its interrupted wait after a lifecycle write (backlog#3118). - S3 Select: bounded schema inference, column cap and budgeted CSV batches, Parquet dictionary bounds and pre-planner projection checks (backlog#3075, backlog#3076, backlog#3077, backlog#3078). * test(e2e): seed legacy duplicate bucket tags offline for the OPA contract * fix(s3): authorize what handlers store and bound request-driven work Scan findings in the S3 request layer (access hooks, object use cases, HTTP server layers), grouped because they share the authorization condition builder, the PutObject admission path and the response layers. Builds on the storage-layer batch for the bounded recovery and multipart APIs it calls. Authorization and policy conditions: - copy source is percent-decoded and version-canonical before the s3:x-amz-copy-source condition (backlog#3135); CopyObject authorizes the tag set it copies (backlog#3034); HeadObject with the replication check header still authorizes s3:GetObject (backlog#3047); the x-rustfs-source-version-id header feeds s3:versionid (backlog#3072); recursive force-delete with a REPLICA header authorizes every descendant as a delete (backlog#3070); include-deleted listings require s3:ListBucketVersions (backlog#3099); the metadata listing route keeps table isolation and uses the same prefix it authorizes (backlog#3053, backlog#3054); If-Match probing needs read permission (backlog#3097); Object Lambda checks s3:GetObjectVersion (backlog#3058); replication proxy fallback keeps ExistingObjectTag denies (backlog#3089); HeadObject returns lock and tag headers only with permission (backlog#3113); IPv4 clients on the dual-stack listener match IPv4 SourceIp conditions (backlog#3049); bucket policies are parsed once and cached (backlog#3032); keystone: access keys no longer verify with an empty secret (backlog#3043). Admission and resource bounds: - GetObject releases disk-read permits when the client stops reading (backlog#3023); PutObject takes buffer and foreground admission only after body bytes arrive and bounds the wait (backlog#3031, backlog#3084); xl.meta size is bounded on the write path (backlog#3100); XML compat layers stream instead of buffering whole bodies (backlog#3094); tier GETs stream the remote body (backlog#3046); on-demand migration pulls release permits on unread GETs (backlog#3110); SSE-KMS key policy covers UploadPart and completion (backlog#3130); MinIO admin decryption runs Argon2id off the async worker (backlog#3024). Input validation and leaks: - replication headers are validated (source ETag shape, original size) (backlog#3092, backlog#3093); control characters in keys and lifecycle rule IDs are rejected (backlog#3101, backlog#3117); Snowball member mtime needs s3:ReplicateObject (backlog#3083); DeleteObjects checks Content-MD5 and admin/STS reject SigV2 replays with altered query or body (backlog#3037, backlog#3026); request logs redact presigned queries and handler spans skip credentials (backlog#3068, backlog#3107); SSE-C listings and completions withhold plaintext metadata and checksums (backlog#3120, backlog#3050); CORS resolves the bucket like s3s does (backlog#3104); PutBucketTagging rejects duplicate keys (backlog#3126); notifications fire after a client disconnect (backlog#3127); ListenNotification streams re-check access (backlog#3119). * fix(api): drop imports left unused by the base merge * test(s3): move the KMS multipart denial test to the app layer The test drives app-layer multipart use cases, so it belongs with them; living in the SSE module it imported app code from the infra layer and failed the layer dependency guard. The SSE test helpers it borrows are exposed through the storage and app facades. * fix(s3): keep the SSE-C key fingerprint on keyless multipart completion The backlog#3050 fix withheld both the plaintext checksums and the customer-key MD5 header from a CompleteMultipartUpload that did not present the key. The checksums are a digest of the plaintext and stay hidden; the key MD5 identifies the key only, and the S3 conformance suite (test_copy_part_enc) expects it on a keyless completion, so it is echoed again. * fix(tier): stream GET bodies and document replication budgets * fix(ecstore,s3): keep the multipart index and cold fill off disk lifetimes Two lifecycle regressions surfaced once the storage and request batches ran together against main: - The multipart index owner cloned the disk's pinned publication root and bootstrapped on a task of its own. That kept the mount alive past the last LocalDisk owner (the disk lifecycle allows exactly three holders of the root FD) and left a stray task behind, which the local-disk and read-repair tests detect. The owner now keeps only the root path and reopens it for identity checks, and the bootstrap scan rides the disk's existing cleanup task, where stopping the disk abandons it and a reconnect resumes it. - The disk-read admission wrapper defers releasing its permit until an in-flight read completes, so a cancelled client cannot widen disk concurrency. The cold-fill producer, however, drops a read it has already classified as stalled when its deadline fires, and that permit stayed pinned for the lifetime of the stuck read. The producer now abandons the admission explicitly on timeout. * test(ecstore): pass the index owner to the Linux cleanup-loop test * fix(s3): release cold-fill admission after watchdog handoff * fix(s3,ecstore): close the round-1 adversarial review findings Adversarial review of the combined request- and storage-layer batch found fixes that fell short of their issues, two behaviour regressions for legitimate clients and several unrequested costs: - backlog#3038: a bulk DeleteObjects reserved the whole per-disk inspection allowance up front for every key in flight and exhausted the 16 Mi request budget on any set wider than eight drives, failing healthy keys with SlowDown. Calls are now admitted while budget remains and charged for the entries they actually visited. Object-scoped discovery charges plain child keys at one entry per 64 names instead of one each, so deleting a missing key that names a folder prefix completes instead of answering 503 forever while a hostile prefix stays bounded. A peer still on the previous binary is reported as an unsupported participant, the repository's rolling-upgrade contract, instead of as a budget verdict. - backlog#3037/#3026: a SigV2 configuration PUT without Content-MD5 was still replayable with another body; it is refused with MissingContentMD5 while SigV4 keeps the optional-MD5 contract. - backlog#3072: DeleteObject now resolves x-rustfs-source-version-id before authorization like PUT and COPY, so a replica delete cannot remove a version the policy never saw. - backlog#3121: the multipart index no longer fsyncs a marker and four directories per multipart metadata write (it is rebuilt on every start), and ListMultipartUploads discovers roots concurrently. - backlog#3077: Parquet SelectObjectContent decodes budget-sized batches instead of one row per batch. - backlog#3031: a full upload buffer pool hands out an unpooled buffer instead of refusing the upload; the progress floor already bounds stalls. - backlog#3023: the GET disk-read idle cut-off is configurable (RUSTFS_GET_DISK_READ_IDLE_TIMEOUT_SECS, default 120 s) so a paused client is not truncated after 30 s. - backlog#3075: JSON Lines schema inference keeps the sample collected at the 4 MiB bound instead of failing the query. - backlog#3024: compat admin decryption queues briefly for a slot instead of refusing the third concurrent request. - backlog#3113: HEAD skips its permission probes for the bucket owner. - backlog#3117: control characters in a lifecycle rule ID are rejected on PutBucketLifecycle as well. The lock-crate publication FIFO serves backlog#3111 and moves to the table-catalog PR. Also fixed: a lossy admin error message, an unused s3-client function, two unused test-util features, a duplicated key validation, the s3s footprint baseline, and a stale log event name in the reverse-proxy runbook. The ODM multipart write-back test runs on the large test stack like its sibling. * fix(table-catalog): bound maintenance work and isolate table namespaces (#9174) * fix(table-catalog): bound maintenance work and isolate table namespaces Scan findings in the Iceberg table catalog: - Metadata maintenance deleted every unreferenced *.metadata.json in a table's directory without checking whether a renamed table in another namespace still owned those files (backlog#3060); it now resolves the owning table through the directory index before deleting. - Manifest lists and manifests were decoded with the embedded Avro writer schema and no recursion depth limit; a self-referencing record schema overflowed the stack (backlog#3080). Schemas are validated for depth before decoding. - Compaction decoded every input Parquet file into Arrow batches held in memory; a decompression bomb OOM-killed the server (backlog#3085). Row groups are streamed through a byte budget and oversized inputs are refused. - An S3 request for a key outside an indexed table prefix listed the bucket's whole namespaces/ catalog prefix and failed once it held more than 4096 objects (backlog#3086); a per-bucket directory index answers index misses without the listing. - The maintenance planner read whole orphan files to obtain their modification time (backlog#3087); it reads metadata only. - A client disconnect between persisting active_rename_id and clearing it left the bucket's catalog entry locked at 503 (backlog#3088); the rename runs detached from the request future and clears the flag on every exit. - Table commits held the bucket publication fence until publication, starving every object write (backlog#3111); commits now hold it under a deadline and object writes are admitted between commits. The directory index is managed through three new admin routes under {warehouse}/catalog/directory, registered in the admin route policy. The durable-strong store is left as is (its snapshot partitioning for backlog#3109 and the strong-path deadline are not ported): that backing is being retired separately, so the new tests cover the object backing. * fix(table-catalog): close the review gaps in the scan-fix batch Adversarial review of the table-catalog batch found the fixes narrower than the issues they close and two cost regressions: - backlog#3085: the compaction footer check bounded nothing a page header could not override; parquet sizes its page buffers from the header. Walk every column chunk's page headers (Thrift compact, no decompression) and hold each page and the chunk total to the budget before decoding. The stored-input budget is per rewrite group, so a multi-group job no longer fails after writing earlier outputs. - backlog#3086: the default index-miss scan still counted maintenance reports toward its 4096-object limit; only table entries count now, and the listing itself is bounded to 64 pages. The directory index remains an optional accelerator. - backlog#3111: a create wrote its metadata file under the fence as the first durable mutation, which disarmed the deadline before the unbounded registration inventory. The write precedes publication now. The deadline gets its own knob (RUSTFS_TABLE_CATALOG_PUBLICATION_PREPARATION_TIMEOUT_SECS, default 30 s, never below the lock-acquire timeout) instead of reusing the 5 s lock timeout, and the ownership inventory reads entries concurrently. - Directory candidates are written only while a directory exists; the backfill covers earlier entries. A directory on the migration-fence path is reported as a conflict instead of a parse error. - Dead test hooks, a stale comment and the support-matrix text that did not match the code are removed or corrected. * fix(select): preserve complete samples and Parquet batch limits * fix(s3,ecstore): close the round-2 adversarial review findings DeleteObject resolved x-rustfs-source-version-id for authorization on every request while storage consumes it only for a REPLICA request, so a non-replica caller with s3:DeleteObjectVersion could trigger a plain delete of the current version. The hook now resolves the header under the same predicate as storage, and the regression test covers the non-replica case. HEAD no longer skips its permission probes for the bucket owner; an explicit bucket-policy Deny on the metadata actions binds the owner too. Multipart index pages verify each root against the staging area and prune markers whose staging root is gone, under the marker's own lease with a re-check, so the per-drive index stays proportional to live uploads instead of every key ever multipart-initiated on the drive. SigV2 configuration PUTs that declare an empty body need no Content-MD5: there is no body to replay. The minimum-progress floor stays independent of RUSTFS_HTTP_REQUEST_BODY_READ_TIMEOUT; the knob's documentation now says so instead of claiming 0 disables it. The quota bootstrap window (503 until the background scan publishes the ledger) is kept, because ledger admission must not come from scanner reporting; the compatibility matrix now documents it. The S3 compatibility matrix gains a section for the client-visible validation bounds, and the drive-timeout tuning guide tabulates RUSTFS_GET_DISK_READ_IDLE_TIMEOUT_SECS. * fix(lock): queue table-bucket publication writers fairly Table commits take the bucket publication fence as a write lock; under a stream of commits the lock's try-and-retry acquisition let a new commit jump ahead of object writers that had been waiting longer, which is part of what starved them (backlog#3111). Requests for the publication lock path now take a FIFO ticket per shard: a waiter is admitted only when it is at the head of the queue, cancelled waiters release their turn, and batch acquisitions join the same queue. Other lock paths are unchanged. This moved here from the request-layer batch, where no cited issue covered it; it serves the table-catalog issue this PR closes. * fix(table-catalog): close the round-2 adversarial review findings Parquet page-header walker: read the size fields by field id as parquet does, accepting I16/I32/I64 wire kinds and rejecting any other kind, so a header encoding uncompressed_page_size as I64 can no longer bypass the budget while parquet allocates it. Bound every list, set and map count by the bytes remaining in the chunk, and reject bool collection elements (parquet skips them with zero width, so either width would desynchronize the two parsers); this removes the 2^63-iteration spin on LIST<BOOL>. Start each column-chunk walk at the dictionary page offset whenever the footer declares one, exactly as parquet's byte_range does, instead of min(dictionary, data). Footer pre-walk: before parquet decodes a footer, walk FileMetaData with the hardened cursor and charge the declared row_groups count times the RowGroupMetaData size to the decode budget, because parquet 59 reserves that Vec before reading one element. Preparation deadline: clamp the RUSTFS_TABLE_CATALOG_PUBLICATION_PREPARATION_TIMEOUT_SECS knob to 86,400 seconds so Instant + Duration cannot overflow. Index-miss scan: after each listing page, jump the cursor past the maintenance subtree the page ended in, and allow one extra page per table entry already listed, so job-report history scales with the catalog while a report flood under one table stays bounded. Migration fence: read the fence-path object once and decide from its stored kind whether it is directory state or a fence. Expired or failed create: remove the initial metadata file when the registration fails before any catalog write may have begun; nothing else references it. Correct the comment and support matrix that claimed maintenance reclaims it. Tests cover each walker divergence, the footer row-group reservation, the deadline ceiling, the paging budget for honest catalogs and for a report flood, and the removal of the unpublished metadata file. * test(admin): register the catalog directory routes in the route matrix The table-catalog batch added GET, POST and DELETE {warehouse}/catalog/directory on both the Iceberg and the compat admin prefixes without listing them in the admin route matrix, so test_admin_route_matrix_matches_registered_routes failed on CI. * fix(s3,ecstore): close the round-3 adversarial review findings Multipart index pages now treat the cursor as the last examined marker rather than the last root, so a page that pruned a stale marker still validates and ListMultipartUploads keeps using the index. A marker is written before its staging root is published, so pruning spares markers younger than a five-minute grace period and an existing marker is touched on every new upload; the prune re-checks both under the marker lease. Bounded delete-recovery inspection rides the durable-mutation lane like the unbounded path instead of the one-worker foreground lane. The on-demand-migration inline body budget scales with the object size (at least 64 KiB/s) instead of a flat 120 s. The control-body digest service honors RUSTFS_HTTP_REQUEST_BODY_READ_TIMEOUT=0 as "no inactivity timeout" like every other reader of that knob. Quota reconciliation throttle objects are deleted together with a retired generation's ledger, so bucket turnover leaves no residue. The PUT guard test shim is gone; tests call the shared guard. Bounded DiskAPI defaults answer MethodNotAllowed like their siblings. Stale budget docs, an unreachable CSV arm, an always-Some limit parameter, commented-out constants and a misplaced doc comment are cleaned up; weak test assertions name the expected error; lifecycle rule-ID control characters gain a test. The compatibility matrix records the CopyObject tag-copy permission, the exact SigV2 empty-body predicate, replica and migration writes of control-character keys, and the SigV2 DeleteObjects digest rule. * fix(table-catalog,heal): close the round-3 review findings A. Pack compaction rewrite groups to min(max-rewrite-bytes-per-job, TABLE_COMPACTION_MAX_STORED_BYTES), reject an over-ceiling group before any output is written, and name the ceiling in the commit-path errors; document the effective cap in the support matrix and scheduler runbook. B. Keep TaskCancelled/TaskTimeout classification on replacement passes: the namespace verification runs only for completed or storage-failed passes, in the erasure healer and the task bucket prepass. C. Compare the replacement bucket pass per bucket: a recorded identity that is gone or replaced still errors or restarts the pass, buckets created mid-pass are appended to the identities, pending_buckets and a persisted positional order without rewinding progress or the checkpoint; verification ignores additions. D. Read the migration-fence object once in the object-backed write permit and dispatch on its kind. E. Drop the strong store's copy of maintenance_cleanup_roots. F. Remove the unused test hooks fail_put_prefix, corrupt_put_prefix and pause_after_metadata; make compact_parquet_data_files and PublicationTicket.state private. G. Document the body-revision identity, the legacy revalidation budget and its HTTP 503 in the support matrix. H. Define HEAL_REPLACEMENT_RECOVERY_DIR once in ecstore and consume it from heal through the storage_api facade. * fix(ecstore): cap the index pages one disk may answer Pruned multipart index pages may carry few roots, so the page cursor no longer bounds how many pages a peer can make a listing fetch. Cut a disk off after 4096 pages (about one million examined markers) so it contributes no coverage and the listing falls back to the staging scan. * fix(ecstore,table-catalog): close the round-4 adversarial review findings Multipart index markers dated in the future (a backwards clock step between recording a marker and publishing its staging root) were judged old and could be pruned while their upload was in flight; a future-dated marker is now kept. The marker touch on EEXIST is best effort, so a filesystem that refuses to set times no longer fails the upload commit. Pruning runs on the durable-mutation lane instead of the one-worker foreground lane. Quota reconciliation keeps one throttle object per bucket incarnation (a quota revision change replaces it instead of orphaning the previous revision's object), the retirement cleanup deletes it ahead of the ledger and also when the ledger is already gone, and a scan the retirement already refused writes nothing back. Bounded DiskAPI defaults answer UnsupportedDisk, the verdict the aggregate gives a peer without the protocol. The compaction ceiling pre-check runs over every rewrite group before any output is written, and the worker's ceiling error no longer names a placeholder group. Docs: the inline on-demand-migration client budget, the protocol-2 downgrade conflict of replacement passes, the exact footprint numbers. |
||
|
|
cc08e0d11b |
feat(fips): route internode RPC HMAC through aws-lc-rs FIPS (#9137)
* feat(fips): route internode RPC HMAC through aws-lc-rs FIPS * Revise KMS cryptographic compliance details Updated the KMS cryptographic compliance documentation to reflect changes in HMAC authentication and added details about the internode RPC HMAC authentication. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com> --------- Signed-off-by: Hauser Zhi <housemecn@gmail.com> Co-authored-by: Hauser Zhi <housemecn@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> |
||
|
|
d429c6f792 | perf(ecstore,rio,utils): accelerate MD5 ETag hashing and SWAR disk path checks (#9110) | ||
|
|
07b7d4fc18 |
fix(s3): preserve legacy plaintext multipart ETags in listings (#8900)
* fix(s3): preserve legacy plaintext multipart ETags in listings Use stored object encryption markers for keyless LIST classification and rebuild persistent snapshots that discarded plaintext multipart ETags. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * perf(s3): classify listing encryption metadata without allocations Use fixed SSE header matching with the historical Unicode fallback. Fuse encrypted ETag proof validation into one metadata pass and clone snapshot ETags only after visibility filtering. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> --------- Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> |
||
|
|
5778384b68 |
chore(deps): refresh ICU and profiling dependencies (#8820)
Update Pyroscope to 2.1.4 and compatible ICU, yoke, and zerovec crates. Cover normalized Unicode hostnames and loopback rejection in egress tests. Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> |
||
|
|
f1a0263ab1 | perf(utils,filemeta): vectorize path and metadata key hot loops with SWAR (#8806) | ||
|
|
2253ba9009 |
fix(tier): restore private endpoints and forced config removal (#8725)
* fix(tier): restore private endpoints and forced config removal * test(tier): align proof failure with force semantics |
||
|
|
668bc7a4ba | test(utils): cover mixed-case metadata alias conflicts (#8651) | ||
|
|
9946c67b53 |
perf(filemeta): avoid clones and redundant map scans in into_fileinfo (#8647)
FileMetaShallowVersion::into_fileinfo and to_fileinfo_with_part_checksums previously decoded an owned FileMetaVersion and then converted it via shared reference (&self), cloning meta_user, meta_sys, part_etags, and part_indices before dropping the temporary FileMetaVersion and scanning the metadata map up to 10 times for optional internal suffixes. Additionally, metadata_compat helpers (get_str, contains_key_str, remove_str, get_consistent_value) allocated two temporary heap Strings via both_keys(suffix) on every absent-key fallback. - Replace both_keys(suffix) in case-insensitive fallback scans with allocation-free prefix+suffix slice matching. - Add consuming into_fileinfo_with_part_checksums on FileMetaVersion and MetaObject to move decoded part vectors and metadata maps in place. - Fold transition-version metadata formatting and optional suffix presence detection into the single meta_sys pass, and skip target_delete_marker_versions in get_internal_replication_state when no delete-marker version keys are present. |
||
|
|
b40f1e5fab |
fix(utils): harden Win32 volume probes and flag Windows network drives (#8631)
* fix(utils): NUL-terminate and extend paths passed to Win32 volume APIs `get_volume_name` returned the volume root truncated at its NUL and the result was then passed to `GetVolumeInformationW` as a PCWSTR, an out-of-bounds read. The disk-space and volume APIs also received the caller's raw path, so they failed beyond MAX_PATH, and a UNC share root lacked the trailing backslash these APIs require. - Wrap every Win32 path in a NUL-terminated `WidePath` that rejects interior NULs; volume roots returned by `GetVolumePathNameW` keep their terminator. - Convert inputs to the extended-length `\\?\` / `\\?\UNC\` form after `GetFullPathNameW` normalization, and give directory queries a trailing backslash. - Query `GetDiskFreeSpaceW` and `GetVolumeInformationW` on the volume root as documented; size buffers to the documented MAX_PATH + 1 or the input length. - Report Win32 error codes instead of raw HRESULTs so `ErrorKind` matches `std::fs`. - Keep volume ids in their conventional `C:\` / `\\server\share\` form. Add Windows-only `os::` tests for long directories, UNC share roots and non-empty fstype, and run them in the Windows filesystem workflow. * fix(utils): report Windows network volumes to the fs guard Windows names the server's filesystem (usually NTFS) for SMB shares, so the startup unsupported-filesystem guard, which matches fstype names such as cifs or smb2, never fired for UNC paths or mapped drives. - Add `DiskInfo::remote`. On Windows it is set when the directory handle answers `FileRemoteProtocolInfo` (only network redirectors do, and the handle follows symlinks and junctions to their target) or the volume root's `GetDriveTypeW` is `DRIVE_REMOTE`. Unix keeps it false because the client fstype already names network mounts. - Treat remote volumes as unsupported in the startup guard and label them "<fstype> on network share". - Cover UNC shares, paths beyond MAX_PATH below a share, a directory symlink to a share and a `net use` mapped drive with Windows-only `os::` tests that skip when `\\localhost\<drive>$` is unreachable; the Windows filesystem workflow maps the drive before running them. * chore(deps): replace yanked inout 0.2.3 with 0.2.4 cargo-deny's advisories check rejects the yanked inout 0.2.3 that main's lockfile pins, failing every open PR. Lockfile-only patch bump. * fix(utils): detect network targets from the final NT path On the Windows runner, a directory symlink to \\localhost\C$ was reported as local: FileRemoteProtocolInfo did not identify it, and the volume root of the link is a fixed drive. Also treat a handle whose final NT path (GetFinalPathNameByHandleW with VOLUME_NAME_NT) lies under \Device\Mup\ as remote; the Multiple UNC Provider fronts every UNC and mapped-drive target. The tests now assert the handle probe on its own for local and share paths and report both signals when it disagrees. --------- Co-authored-by: overtrue <anzhengchao@gmail.com> |
||
|
|
276cb24e26 |
fix(ecstore): share cache and lock identity across Windows key aliases (#8635)
* fix(ecstore): share metadata cache identity across Windows key aliases Windows disks treat `\` as a path separator and `path_join_buf` drops the empty segments that leaves, so `a\b`, `a\\b`, `\a\b` and `a\b\` all address the xl.meta of `a/b`. The GetObject metadata cache keyed and hashed the raw spelling, so DELETE `a\b` retired nothing cached for `a/b`: GET/HEAD `a/b` kept returning the deleted object for up to the 2s cache TTL. Fold the object name into the same segment form the disk resolves to before computing the cache hash, key and lookup key. Off Windows the name stays verbatim and borrowed, so `\` remains an ordinary key byte. * fix(ecstore): serialize Windows backslash key aliases on one namespace lock Windows disks treat `\` as a path separator and drop the empty segments it leaves, so `a\b`, `a\\b`, `\a\b` and `a\b\` all address the xl.meta of `a/b`. Namespace locks keyed the raw spelling, so writes, deletes and heals through different spellings ran concurrently on one xl.meta and a read-modify-write in rename_data could drop a version. Fold the object name into its disk identity (rustfs_utils::path:: object_name_disk_identity, a no-op off Windows) wherever a namespace lock key is formed: - SetDisks::new_ns_lock, which every object lock path goes through; - the batch delete lock request and its dedup/lookups, which build ObjectKeys directly. Two consumers compared lock identities by spelling and follow along: - WriteCommitGuard records the folded key from the lock resource, so matching a borrowed guard now folds the target name too; - CopyObject holds the source read guard until EOF on streaming reads. `a\b\` -> `a/b` is not a same-object copy by path_join_buf, but shares one lock, so it now takes the self-copy lock instead of waiting on itself until the lock timeout. Distributed lock keys are folded by the requesting node only; lock servers compare them verbatim. * refactor(ecstore): key the metadata cache by the shared disk identity The metadata cache fix carried its own copy of the Windows backslash folding rule. Use rustfs_utils::path::object_name_disk_identity, which namespace locks already use, so cache and lock identities cannot drift. * ci(windows): run filesystem tests when key identity rules change The Windows backslash folding for object names lives in utils path.rs and is consumed by the namespace lock and write commit guard; run the windows_ tests when any of them changes. |
||
|
|
776cdc517b |
fix(ecstore): keep Windows disk roots out of verbatim form (#8633)
* fix(ecstore): keep Windows disk roots out of verbatim form The disk root comes from GetFinalPathNameByHandleW, which returns a verbatim path. `simplified` only strips `\\?\C:` below MAX_PATH, so a data directory past 260 characters (or one reached through a UNC share) kept the prefix. Disk IO extends the root by joining `/`-separated relative paths as strings (`read_raw` builds `<object>/xl.meta` with `path_join`), and inside a verbatim path `/` is not a separator: the first metadata read, pool.bin.identity, failed with ERROR_INVALID_NAME until startup gave up. Add `rustfs_utils::non_verbatim`, which strips the disk and UNC verbatim prefixes without a length limit while still keeping paths whose components Win32 would rewrite, and use it for the publication root. std re-adds the extended-length prefix for long paths. Cover a root past MAX_PATH with a disk-level read/write test and run all `dunce::` tests in the Windows filesystem workflow. * fix(ecstore): query Win32 volume APIs with extended long disk roots A disk root past the legacy limit used to reach `rustfs_utils::os` in verbatim form, which the Win32 volume APIs accept. Now that the root stays non-verbatim, GetDiskFreeSpaceExW rejected it with ERROR_PATH_NOT_FOUND and LocalDisk::new failed in the Windows filesystem workflow. Pass long roots to `get_info` and `get_physical_device_ids` in extended-length form; shorter roots stay unchanged so reported volume identities keep their `C:\` form. |
||
|
|
5efae5baa6 |
fix(ecstore): unify object key admission for Windows hosts (#8632)
* fix(ecstore): admit CopyObject destinations like PutObject Object-key platform checks were split across call sites with gaps: CopyObject only ran check_bucket_and_object_names on its destination and then reached the pools' put_object directly, so it admitted keys PutObject rejects (over 1024 bytes, leading slash, and on Windows reserved characters or unaddressable segments, the "writes but cannot be read" case of #3449). - rustfs-utils: expose check_windows_file_name as the single per-segment Win32 rule set; dunce's simplified() reuses it. Reserved device names now include COM/LPT with superscript digits and CONIN$/CONOUT$. - ecstore: replace the duplicated reserved-name table with that function; Windows also rejects control characters 0x01-0x1F (NUL keeps its platform-independent ObjectNameInvalid answer). - ecstore: add check_new_object_args as the shared admission entry for PutObject, cross-key CopyObject destinations and CreateMultipartUpload. In-place copies (metadata replace, restore) keep the copy-only check so existing keys stay rewritable. CreateMultipartUpload now also rejects over-NAME_MAX segments up front instead of failing at completion. - CI: run bucket::utils and dunce tests in the Windows filesystem job. * fix(ecstore): reject new backslash keys on Windows hosts A Windows disk treats '\' as a path separator, so a new key `a\b` lands on the same xl.meta as `a/b` and the two keys overwrite each other. Reject '\' only where a key enters the namespace (check_new_object_args: PutObject, cross-key CopyObject destinations, CreateMultipartUpload) and only on Windows. Reads, deletes, in-flight multipart operations, in-place copies, data movement and internal meta buckets keep accepting it, so keys already stored with '\' stay readable, deletable and movable. Pending owner ruling: whether new '\' keys should be rejected at all, and whether reads/deletes should keep accepting them. * ci(windows): quote filtered test runs and drop duplicate path |
||
|
|
62b6b6149c |
fix(ecstore): publish delete rollback backups past Windows MAX_PATH (#8606)
tempfile's Windows `persist` passes the raw paths to MoveFileExW and SetFileAttributesW, bypassing std's extended-length handling. Once `<object>/<rollback>/xl.meta.bkp` reached 260 UTF-16 units every delete of that key failed with 500, while PUT and GET kept working. Add `rustfs_utils::extended_length_path`, which normalizes a path with GetFullPathNameW and prefixes it with `\\?\` (or `\\?\UNC\`), and use it for the staging directory and destination handed to tempfile. Cover the single and batch delete paths with a deep-key regression test and run the helper's Windows assertions in the Windows filesystem workflow. Fixes #8545 |
||
|
|
b77bd26874 | Merge commit from fork | ||
|
|
9442e89f5f |
fix(iam): require an explicit permission for force-delete (#8154)
* fix(iam): require an explicit permission for force-delete A force-delete header no longer inherits s3:* or consoleAdmin. Bucket force-delete requires s3:ForceDeleteBucket whenever the header is present, and recursive object force-delete requires s3:ForceDeleteObject. A plain delete keeps the existing checks. Co-authored-by: RustFS <hello@rustfs.com> Signed-off-by: loverustfs <155562731+loverustfs@users.noreply.github.com> * test(e2e): keep force-delete header names static The bucket force-delete helper must pass a static header name into the SDK request mutator. Co-authored-by: RustFS <hello@rustfs.com> Signed-off-by: loverustfs <155562731+loverustfs@users.noreply.github.com> * test(e2e): move the force-delete header into the request mutator The SDK request customizer requires a static header name owned by the closure. Co-authored-by: RustFS <hello@rustfs.com> Signed-off-by: loverustfs <155562731+loverustfs@users.noreply.github.com> * fix(iam): keep force-delete out of NotAction grants NotAction now uses plain wildcard matching, so NotAction "s3:*" still excludes force-delete. An Allow statement grants s3:ForceDeleteObject or s3:ForceDeleteBucket only when its Action list names the action; a NotAction-only Allow never does. The rule applies to both IAM and bucket policy statements. Also build the invalid-header errors with S3Error::with_message to keep the s3s footprint at its baseline, and fix a clippy single_match. --------- Signed-off-by: loverustfs <155562731+loverustfs@users.noreply.github.com> Co-authored-by: Hauser <housemecn@gmail.com> Co-authored-by: overtrue <anzhengchao@gmail.com> |
||
|
|
fc5609bbb0 |
fix(s3): make retried CompleteMultipartUpload idempotent (#8153)
Record the upload id on the completed object so a lost-response retry returns that object's ETag instead of NoSuchUpload, while a different part list or a replaced object keeps the existing errors. Signed-off-by: loverustfs <155562731+loverustfs@users.noreply.github.com> Co-authored-by: Hauser <housemecn@gmail.com> |
||
|
|
892d3ba3f7 |
Allow 127.0.0.0/8 as loopback addresses for binding (#7943)
This is particularly useful for integration testing of services that use an S3 API, as it lets many different instances bind a port on different IPs. Co-authored-by: Chris <anzhengchao@gmail.com> Co-authored-by: Hauser <housemecn@gmail.com> |
||
|
|
474fcf78fb |
fix: align object version limit handling (#7415)
Co-authored-by: zhi22915 <qiuzgang@gmail.com> |
||
|
|
7b40b9503b | feat(observability): diagnose node-local S3 write failures (#7407) | ||
|
|
899f81f3ad |
fix(replication): resolve drifted replicas via a target version ledger (#7368)
* fix(replication): resolve drifted replicas via a target version ledger A replication target that mints its own version ids (Wasabi, AWS S3) never answers to the source uuid, so every version-addressed mutation after the initial PUT failed forever: permanent version deletes answered NoSuchVersion every heal cycle, and tag / retention / legal-hold updates re-PUT the object, minting one more target version per update (rustfs/backlog#2340). Record the id the target assigned as a per-target ledger on the source version (replication-target-version-<arn>, written through the existing status writeback) and resolve every later mutation through it: version deletes DELETE the ledger id, metadata updates go through the metadata-only Object Lock and tagging APIs. Replicas written before the ledger existed are located by exact key and ETag, minus the candidates other generations of the key already claim through their own ledgers; an ambiguous remainder is refused with a backoff instead of guessed, since a wrong pick would destroy a live generation. A fresh write never consults content identity. NoSuchVersion on a version-addressed DELETE counts as purged. The fake target gains the Wasabi shape (404 NoSuchVersion on an unknown id, per-version Object Lock APIs) and the matrix covers the three mutation classes plus the same-bytes generation case. * fix(scanner): drop the unused Digest import Same one-line change as rustfs/rustfs#7366 (main is red with it under -D warnings); carried here so the stacked PRs' merge commits compile until that fix lands. * fix(admin): probe replication-check mutations by the assigned version id (#7373) On a target that mints its own version ids the DeleteMarker and VersionDelete phases of ?replication-check were skipped: they addressed the source id, which such a target never had. The replication worker now addresses the id the target assigned (the target-version ledger), and the probe already holds that id from its own PUT, so run both phases against it. VersionFidelity keeps failing with the mismatch code and the target stays FAILED; the phases report whether ledger-addressed purges work against this endpoint (rustfs/backlog#2340). * fix(replication): abandon purges to targets the bucket no longer names (#7377) * fix(admin): probe replication-check mutations by the assigned version id On a target that mints its own version ids the DeleteMarker and VersionDelete phases of ?replication-check were skipped: they addressed the source id, which such a target never had. The replication worker now addresses the id the target assigned (the target-version ledger), and the probe already holds that id from its own PUT, so run both phases against it. VersionFidelity keeps failing with the mismatch code and the target stays FAILED; the phases report whether ledger-addressed purges work against this endpoint (rustfs/backlog#2340). * fix(replication): abandon purges to targets the bucket no longer names A permanent version delete whose replication keeps failing stays in xl.meta as a PENDING purge, hidden from listings, until every target confirms it. Once the operator removes the replication configuration or the rule naming that target nothing ever confirms it: the heal path derived its delete decision from the configuration (the decision string is not persisted) and skipped the version forever, so DeleteBucket answered BucketNotEmpty for a residue the client could neither list nor remove (rustfs/backlog#2340). Owe a version purge to the targets its purge state names, let the heal path through without a configuration, and have the delete worker settle a target the configuration no longer names as abandoned: the purge is reported complete locally through the normal writeback, the replica on the former target is left alone, and the event replication_purge_abandoned plus a counter are the record. * fix(admin): send replication-check marker creation without a version id Running the DeleteMarker / VersionDelete phases on a target that mints its own version ids exposed two probe-shape bugs on real Wasabi: - the DeleteMarker phase put the assigned version id on its DELETE. A RustFS peer reads the source-deletemarker header and creates a marker, but a generic S3 target executes it as a permanent delete of the probe version, so VersionDelete then answered NoSuchVersion. Use the same wire shape as live delete replication: no versionId on a marker creation. - cleanup treated NoSuchVersion on the version the VersionDelete phase had already removed as a failure (RustFS/MinIO answer 204 there). Also gate the no-configuration heal pass-through for pending purges on a purge state that actually names targets, so a purge without a recorded target keeps the ordinary skip (scanner unit test), and merge origin/main (#7365 settles the pool-metadata probe test that failed in CI). --------- Co-authored-by: houseme <housemecn@gmail.com> |
||
|
|
95e6c89c1c |
fix(replication): carry the compression layout through SSE-C passthrough (#7366)
* fix(scanner): drop the unused Digest import * fix(replication): carry the compression layout through SSE-C passthrough (#7372) * fix(replication): queue an in-flight version only once (#7376) |
||
|
|
0181a583a6 | fix(ilm): recover orphaned restore generations (#7104) | ||
|
|
86ebcb325c |
fix(replication): fence stale metadata status writeback (#7083)
Co-authored-by: houseme <housemecn@gmail.com> |
||
|
|
183b5c9ede |
refactor(object): extract internal put entry and ODM provenance keys (#7071)
* feat(utils): add on-demand migration provenance metadata suffixes * refactor(object): extract internal put entry from the S3 PutObject path |
||
|
|
40a2470feb |
fix(s3): align encrypted checksums and multipart completion (#7025)
* fix(s3): align encrypted checksum handling * test(s3): align multipart SSE-C completion * fix(ecstore): scope startup helper to tests |
||
|
|
152f110583 |
revert: rollback AHashMap changes and keep using std HashMap (#6741)
* Revert "perf(ecstore): use AHashMap for FileInfo metadata fields (#6738)"
This reverts commit
|
||
|
|
13a2ae212e | perf(ecstore): use AHashMap for FileInfo metadata fields (#6738) | ||
|
|
94a6da6e83 | feat(s3): enforce multipart presigned size limits (#6732) | ||
|
|
73cd1b5be2 |
fix(ecstore): fence rebalance and decommission activation (#6400)
* fix(ecstore): fence rebalance and decommission activation * fix(ecstore): fence lost activation locks * fix(ecstore): bind rebalance workers to activation id * fix(ecstore): close rebalance activation races * test(ecstore): exercise lost rebalance commit fence * fix(ecstore): repair rebalance fence test wiring * test(ecstore): reuse rebalance metadata fixture * fix(ecstore): satisfy rebalance activation clippy checks * fix(ecstore): fence stale rebalance workers * fix(ecstore): commit rebalance activation after persistence * fix(ecstore): fence rebalance commits and unblock stop * test(ecstore): exercise real rebalance fences * fix(rebalance): cancel admin stop before activation wait * fix(ecstore): fence multipart staging on rebalance lock loss * fix(ecstore): adopt activations after durable commit * fix(rebalance): preserve committed activation recovery * fix(rebalance): make prepared stop terminal-safe * fix(ecstore): repair rebalance test imports * fix(ecstore): repair rebalance entry runtime failures * test(ecstore): fix activation fence synchronization * test(ecstore): scope rebalance disk trait import * test(ecstore): observe decommission lock attempt * fix(ecstore): align activation fence test imports * fix(ecstore): remove duplicate activation test import * fix(ecstore): resolve CI clippy failures * fix: satisfy activation merge lint gates --------- Co-authored-by: houseme <housemecn@gmail.com> |
||
|
|
31933c32f9 | fix(replication): apply receiver-side LWW to inbound metadata categories (#6379) |