Files
floci/src
Priamo Germosen 8d3fdbdd56 refactor(elasticache,rds): extract shared SigV4 request validation into a common utility (#3581)
SigV4Validator (ElastiCache proxy) and RdsSigV4Validator (RDS proxy, also reused by
Redshift) each reimplemented the same ~60-line AWS SigV4 presigned-URL verification
algorithm (query parsing, expiry check, secret resolution, canonical request, signing
key derivation, signature comparison), flagged as duplicated by CPD. Extracted the
shared algorithm into SigV4RequestValidator under core.common.auth; both validators now
delegate to it, parameterized only by their genuine differences: the identity query
parameter (User vs DBUser), whether that parameter is required to be present at all
(RDS always requires DBUser; ElastiCache does not require User), and the exact string
each signs as the canonical host header (cluster ID for ElastiCache, host:port for RDS).

No behavior change. Public constructors and validate(...) signatures on both
SigV4Validator and RdsSigV4Validator are unchanged, since existing unit tests construct
them directly with an IamService and reflect on a declared sanitizeForLog method on each
class; that method is kept (identically implemented, not delegated) on both wrapper
classes specifically so those tests keep working unmodified. All existing SigV4
validator, ElastiCache, RDS, and Redshift tests pass unchanged.
2026-09-13 21:10:44 -05:00
..