[BUG] S3 presigned PUT ignores x-amz-meta-* passed in the query string
Service
S3
AWS API Action
PutObject via a presigned URL, followed by HeadObject
Expected behavior
When a presigned PutObject URL carries user metadata as query parameters (x-amz-meta-*, which is what the AWS SDK for JavaScript v3 presigner does by default: metadata is hoisted into the query string and does not appear in X-Amz-SignedHeaders, though the query parameters are still covered by the signature), AWS stores it as user metadata. A later HeadObject returns it, the same way it does for a plain PutObject with metadata headers:
"Metadata": { "source": "presigned-put" }Actual behavior
Floci accepts the upload (200 OK), but the object has no user metadata:
"Metadata": {}Metadata is stored correctly when the same keys are sent as signed request headers instead (signableHeaders / unhoistableHeaders), and for a normal PutObject. So this looks specific to reading x-amz-meta-* from the query string of a presigned PUT. #707 fixed the equivalent problem for presigned POST form fields.
Reproduction
docker run -d -p 4566:4566 floci/floci:2.1.0
npm i @aws-sdk/[email protected] @aws-sdk/[email protected]
node repro.mjs// repro.mjs
import { S3Client, CreateBucketCommand, PutObjectCommand, HeadObjectCommand } from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
const s3 = new S3Client({
region: 'us-east-1',
endpoint: 'http://localhost:4566',
forcePathStyle: true,
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
const Bucket = 'metadata-repro';
await s3.send(new CreateBucketCommand({ Bucket }));
// Control: PutObject with metadata headers.
await s3.send(new PutObjectCommand({ Bucket, Key: 'control.txt', Body: 'x', Metadata: { source: 'control' } }));
console.log('control ', (await s3.send(new HeadObjectCommand({ Bucket, Key: 'control.txt' }))).Metadata);
// Presigned PUT: the SDK hoists x-amz-meta-* into the query string
// (not in X-Amz-SignedHeaders), so the client PUTs with no extra headers.
const url = await getSignedUrl(
s3,
new PutObjectCommand({ Bucket, Key: 'presigned.txt', Body: 'x', Metadata: { source: 'presigned-put' } }),
{ expiresIn: 600 },
);
console.log('url ', url.replace(/X-Amz-Signature=[0-9a-f]+/, 'X-Amz-Signature=…'));
const res = await fetch(url, { method: 'PUT', body: 'x' });
console.log('put status', res.status);
console.log('presigned ', (await s3.send(new HeadObjectCommand({ Bucket, Key: 'presigned.txt' }))).Metadata);Output:
control { source: 'control' }
url http://localhost:4566/metadata-repro/presigned.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=test%2F20260930%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260930T164030Z&X-Amz-Expires=600&X-Amz-Signature=…&X-Amz-SignedHeaders=content-length%3Bhost&x-amz-checksum-crc32=jNwWgw%3D%3D&x-amz-meta-source=presigned-put&x-amz-sdk-checksum-algorithm=CRC32&x-id=PutObject
put status 200
presigned {}The same result with virtual-host addressing (forcePathStyle: false, <bucket>.localhost:4566) and with FLOCI_SERVICES_S3_ENFORCE_AUTH=true.
Environment
- Floci version / image tag:
floci/floci:2.1.0 - SDK:
@aws-sdk/client-s3and@aws-sdk/s3-request-presigner3.1014.0 (Node 22) - How you're running Floci: Docker (Docker Desktop, macOS on Apple Silicon)
Source: floci-io/floci