test(e2e): negative header-SigV4 rejection suite (backlog#1151 sec-1) (#4708)

test(e2e): add negative header-SigV4 rejection suite (backlog#1151 sec-1)

RustFS delegates SigV4 verification to the s3s dependency, so nothing in
this repo pins OUR end-to-end wiring of it. Add negative_sigv4_test.rs
sending REJECTED header-SigV4 requests against a live RustFSTestEnvironment
and asserting the HTTP status plus the S3 error code XML:

- valid_header_sigv4_request_succeeds (positive control so the negatives
  cannot pass for the wrong reason)
- tampered_signature_returns_signature_does_not_match -> 403 SignatureDoesNotMatch
- wrong_secret_key_returns_signature_does_not_match -> 403 SignatureDoesNotMatch
- tampered_payload_is_rejected (body != signed x-amz-content-sha256) -> not 200
- skewed_date_returns_request_time_too_skewed (>15min) -> 403 RequestTimeTooSkewed
- malformed_authorization_header_returns_clean_4xx (present-not-missing) -> 4xx, never 5xx

Signatures are hand-built via rustfs_signer::request_signature_v4 primitives
(get_signing_key/get_signature/get_scope) so the test controls the timestamp,
secret, signed payload hash, and final signature bytes. Missing-credential
negatives are intentionally not duplicated (covered by multipart_auth_test /
anonymous_access_test).

Refs backlog#1151 (sec-1), master plan backlog#1155.
This commit is contained in:
Zhengchao An
2026-07-11 11:28:56 +08:00
committed by GitHub
parent ac646cfbe4
commit abe6c41227
2 changed files with 387 additions and 0 deletions
+5
View File
@@ -165,6 +165,11 @@ mod bucket_logging_test;
#[cfg(test)]
mod multipart_auth_test;
// Negative header-SigV4 regression suite (backlog#1151 sec-1): tampered
// signature, wrong secret, skewed date, malformed Authorization.
#[cfg(test)]
mod negative_sigv4_test;
#[cfg(test)]
mod stale_multipart_cleanup_cluster_test;