From 66c4247e641269d57e55c4550bee5d819b5bd782 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Jul 2026 09:03:51 +0700 Subject: [PATCH] debug: add SigV4 mismatch logging with expected vs received signature --- src/utils/s3/auth.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/utils/s3/auth.ts b/src/utils/s3/auth.ts index 95f659e..381f3f4 100644 --- a/src/utils/s3/auth.ts +++ b/src/utils/s3/auth.ts @@ -331,7 +331,22 @@ export const verifySignature = async ( const signingKey = await getSigningKey(s3SecretKey, dateStamp, region); const expectedSignature = await hmacHex(signingKey, stringToSign); + // TEMP DEBUG: log signature mismatch details if (!timingSafeCompare(expectedSignature, parsed.signature)) { + const debugInfo = { + method, + uri: canonicalUri, + canReq: canonicalRequest.slice(0, 400), + hashedCR: hashedCanonicalRequest, + amzDate, + dateStamp, + scope: credentialScope, + stringToSign: stringToSign.slice(0, 300), + expectedSig: expectedSignature, + receivedSig: parsed.signature, + accessKey: parsed.accessKey, + }; + console.error('SIGV4_MISMATCH:' + JSON.stringify(debugInfo)); return { isValid: false, credential: null, errorCode: 'SignatureDoesNotMatch' }; }