Skip to content

[Bug] - REST PutObject - signature mismatch with Expect:100-continue #1707

@lrm25

Description

@lrm25

Describe the bug
Via versitygw, the command:

curl -iks -X PUT "https://localhost:7070/versity-gwtest-bucket-one-1-20251218135249/test_file" -H "Authorization: AWS4-HMAC-SHA256 Credential=AKIA6****/20251218/us-east-1/s3/aws4_request,SignedHeaders=expect;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length,Signature=c7aad9a8ae3496c89a2e185c3a13a9e02d1b70e044892e80a4c43ee1a73d2b14" -H "Expect: 100-continue" -H "host: localhost:7070" -H "x-amz-content-sha256: ffbd0d51f6c792a8d085f716a884ab5da475d9e7e7c196508d891378d24097c4" -H "x-amz-date: 20251218T165250Z" -H "x-amz-decoded-content-length: 10" -T /Users/lukemccrone/devel/versitygw/versity-gwtest-files/test_file

Results in a signature mismatch. This does not happen in direct mode. An example of what's returned:

HTTP/1.1 100 Continue
   
 HTTP/1.1 403 Forbidden
 Server: VERSITYGW
 Date: Thu, 18 Dec 2025 16:52:49 GMT
 Content-Type: text/plain; charset=utf-8
 Content-Length: 281
 Connection: close
 
 <?xml version="1.0" encoding="UTF-8"?>
 <Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><Resource></Resource><RequestId></RequestId><HostId></HostId></Error>

Example of CR from successful direct command:

PUT
/versity-gwtest-bucket-luke-four-2-20251218134804/test_file

expect:100-continue
host:s3.amazonaws.com
x-amz-content-sha256:1b16bf9db651028417f36513e1458bd501c1cf286f067e886937b8cf38cf32ac
x-amz-date:20251218T164806Z
x-amz-decoded-content-length:10

expect;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length
1b16bf9db651028417f36513e1458bd501c1cf286f067e886937b8cf38cf32ac

To Reproduce

  1. Start versitygw, e.g.: ./versitygw --access=AKIA**** --secret=******** --region=us-east-1 --iam-dir=/Users/lukemccrone/devel/versitygw/iam --cert /Users/lukemccrone/devel/versitygw/cert.pem --key /Users/lukemccrone/devel/versitygw/versitygw.pem posix --versioning-dir /tmp/versioning /tmp/gw
  2. Create a bucket, e.g.: curl -ks -w %{http_code} -X PUT https://localhost:7070/versity-gwtest-bucket-one-1-20251218135249 -H Authorization: AWS4-HMAC-SHA256 Credential=AKIA6****/20251218/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=546fe652a7397ebb73aa485b24d346e301b82b2d3a0a06d263d3598baff9b4d5 -H host: localhost:7070 -H x-amz-content-sha256: UNSIGNED-PAYLOAD -H x-amz-date: 20251218T165249Z -o /Users/lukemccrone/devel/versitygw/versity-gwtest-files/output.txt
  3. Create an object locally.
  4. Use generateCommand.go to send a PutObject command with Expect:100-continue. Use the following paramaters in addition to the required AWS ones: "-bucketName" "{name}" "-objectKey" "{key}" "-method" "PUT" "-payloadFile" "${object}" "-signedParams" "Expect:100-continue". The output should look like this: curl -iks -X PUT https://localhost:7070/versity-gwtest-bucket-one-1-20251218135249/test_file -H Authorization: AWS4-HMAC-SHA256 Credential=AKIA6****/20251218/us-east-1/s3/aws4_request,SignedHeaders=expect;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length,Signature=c7aad9a8ae3496c89a2e185c3a13a9e02d1b70e044892e80a4c43ee1a73d2b14 -H Expect: 100-continue -H host: localhost:7070 -H x-amz-content-sha256: ffbd0d51f6c792a8d085f716a884ab5da475d9e7e7c196508d891378d24097c4 -H x-amz-date: 20251218T165250Z -H x-amz-decoded-content-length: 10 -T /Users/lukemccrone/devel/versitygw/versity-gwtest-files/test_file`
  5. Send the command.

Expected behavior
The command succeeds as it does when sent directly to s3.

Server Version
Version : v1.0.19
Build : dd8a22d
BuildTime: 2025-12-17_06:42:53PM
Darwin Lukes-MacBook-Pro.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions