Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT Object request with V4Signer gives Forbidden error #652

Open
aravinds502 opened this issue Jun 15, 2024 · 0 comments
Open

PUT Object request with V4Signer gives Forbidden error #652

aravinds502 opened this issue Jun 15, 2024 · 0 comments

Comments

@aravinds502
Copy link

Hello Team,

We have configured s3proxy with Amazon s3, when a 'PUT' object request is sent with the V4Signer, it gives

403 SignatureDoesNotMatch

[s3proxy] D 06-15 05:26:43.505 S3Proxy-Jetty-18 o.gaul.s3proxy.S3ProxyHandler:301 |::] request: Request(PUT https://<mydomain.com>/<my_bucket>/f3f6c3e4-3e6c-45d7-bf6d-3ca4a8b4da5e/bb9c175e-6ee0-489b-91b6-a0bc016d213f/65e18173bb62ae7c1abf746a48a8c5d511ef9a143e7af56425c928fcb0858b3f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240615T052639Z&X-Amz-SignedHeaders=host%3Bx-amz-content-sha256&X-Amz-Expires=120&X-Amz-Credential=<access_key>%2F20240615%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=d3cd2cd970a9f8d097afa069c9a12e64013e1e7399b7b6103332b45a7ca4e8d4)@1c5eebea
[s3proxy] D 06-15 05:26:43.506 S3Proxy-Jetty-18 o.gaul.s3proxy.S3ProxyHandler:2971 |::] sendSimpleErrorResponse: 403 SignatureDoesNotMatch Forbidden {}

Code:

	AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
				.putHeader(SignerConstant.X_AMZ_CONTENT_SHA256, request.getObjectHash())
				.signer(staticPresigner)
				.build();

		PutObjectRequest putObjectRequest =
				PutObjectRequest.builder()
						.bucket(bucket)
						.key(request.getFullPath(delimiter))
						.overrideConfiguration(overrideConfiguration)  **---> if this was commented out, it works**
						.build();

		PutObjectPresignRequest putObjectPresignRequest =
				PutObjectPresignRequest.builder()
						.signatureDuration(defaultDuration)
						.putObjectRequest(putObjectRequest)
						.build();

                presigner.presignPutObject(putObjectPresignRequest) // -> call this URL fails

Without proxy, directly to the s3 'PUT' request it works, and below is the working request URL

https://.s3.eu-west-1.amazonaws.com/0070ae55-a5c4-4e22-9bae-fe305c59117d/e0b2549e-87e3-4734-9fb0-ea6d1f55238f/65e18173bb62ae7c1abf746a48a8c5d511ef9a143e7af56425c928fcb0858b3f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240615T055453Z&X-Amz-SignedHeaders=host%3Bx-amz-content-sha256&X-Amz-Expires=120&X-Amz-Credential=<my_access_key>%2F20240615%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=95617314709766adff6fc39fef3d728d5a6b3dfdbfd43cede932a87495be9e50

@aravinds502 aravinds502 changed the title PUT Object request with V4Signer gives PUT Object request with V4Signer gives Forbidden error Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant