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

[Bug] - REST - NoSuchBucketPolicy error returns empty Resource tags rather than BucketName value #959

Open
lrm25 opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@lrm25
Copy link
Contributor

lrm25 commented Nov 20, 2024

Describe the bug
After sending a GetBucketPolicy command to a bucket without a policy, a direct-to-s3 call returns something similar to this:

<?xml version="1.0" encoding="UTF-8"?>
   <Error><Code>NoSuchBucketPolicy</Code><Message>The bucket policy does not exist</Message><BucketName>versity-gwtest-bucket-luke-four-1</BucketName><RequestId>C8872RVZ17B250QW</RequestId><HostId>aoSKfEAWHTpqZzPb/w9HG0l1vxBjcop8n1m9HopEGMX+q5vZGrCT5w4t6YS6Ik1YBu9dTlSVqiI=</HostId></Error>

versitygw, on the other hand, returns something like this, and doesn't mention the bucket:

<?xml version="1.0" encoding="UTF-8"?>
   <Error><Code>NoSuchBucketPolicy</Code><Message>The bucket policy does not exist.</Message><Resource></Resource><RequestId></RequestId><HostId></HostId></Error>

To Reproduce

  1. Start versitygw, e.g.: ./versitygw --access=******** --secret=******** --region=us-east-1 --cert /Users/lukemccrone/devel/versitygw/cert.pem --key /Users/lukemccrone/devel/versitygw/versitygw.pem posix --versioning-dir /tmp/versioning /tmp/gw
  2. Create bucket, e.g.: aws --no-verify-ssl s3api create-bucket --bucket versity-gwtest-bucket-one-1
  3. Attempt to retrieve bucket policy with the https://github.com/versity/versitygw/blob/test/rest_get_bucket_policy/tests/rest_scripts/get_bucket_policy.sh script. The command should look like: curl -ks -w %{http_code} https://localhost:7070/versity-gwtest-bucket-one-1?policy= -H Authorization: AWS4-HMAC-SHA256 Credential=********/20241120/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=29682d58ee26c75aee5e4bb9829be6d1966801cd73f841fcfa0422217fe94097 -H x-amz-content-sha256: UNSIGNED-PAYLOAD -H x-amz-date: 20241120T125133Z -o /Users/lukemccrone/devel/versitygw/versity-gwtest-files/policy.txt

Expected behavior
Error returns BucketName with value

Server Version
Version : v1.0.8
Build : ad700a5
BuildTime: 2024-11-20_01:25:28PM
Darwin Lukes-MacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 arm64

@lrm25 lrm25 added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant