mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
S3's PreSignedUrlFilter carried its own private copy of deriveSigningKey/hmacSha256/ sha256Hex/hexEncode, the same SigV4 signing-key derivation block that SigV4Validator (ElastiCache) and RdsSigV4Validator (RDS) used to carry independently before #3581 consolidated those two into core.common.auth.SigV4RequestValidator. S3's copy was out of scope there and left as a third independent copy of the same crypto logic. S3's canonical-request construction is real REST SigV4 (method/path/headers/payload hash), a different shape from SigV4RequestValidator's own validate() method, which handles the simplified query-token form ElastiCache/RDS presigned URLs use. So this doesn't reuse validate() itself, only the four low-level crypto primitives, now made public on SigV4RequestValidator for exactly this kind of reuse. PreSignedUrlFilter's own copies are removed and its one call site now delegates to the shared methods. S3HeaderSignatureFilter, which reused PreSignedUrlFilter's helpers directly (they were package-private), is updated to call the shared class as well. Adds SigV4RequestValidatorTest: the shared crypto primitives were previously only exercised indirectly through each caller's own request flow. Now that they're public specifically for cross-service reuse, this pins them directly against an independently computed value (cross-checked with Python's hmac/hashlib, not derived from this code). No behavior change otherwise. Full S3 test suite (over 1000 tests across all S3 files) and the ElastiCache/RDS/Redshift SigV4 validator tests pass unchanged.