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 GetObjectAttributes - incorrect error message when attribute param is wrong #1000

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

Comments

@lrm25
Copy link
Contributor

lrm25 commented Dec 23, 2024

Describe the bug
The following error message is reported when an attribute param is wrong in versitygw:

<?xml version="1.0" encoding="UTF-8"?>
   <Error><Code>InvalidRequest</Code><Message>The x-amz-object-attributes header specifying the attributes to be retrieved is either missing or empty</Message><Resource></Resource><RequestId></RequestId><HostId></HostId></Error>

This is incorrect, as the attribute isn't empty, it's wrong. Here's what is reported when going direct to s3:

<?xml version="1.0" encoding="UTF-8"?>
   <Error><Code>InvalidArgument</Code><Message>Invalid attribute name specified.</Message><ArgumentName>x-amz-object-attributes</ArgumentName><ArgumentValue>ETags</ArgumentValue><RequestId>QPXG94ABP0V5JE4K</RequestId><HostId>Y9IEVTI2VaHnOvbFZkdcvlKq6qyI9G/n6lPKzIl9SLY5Nqw4jnzaGlDWIt3kaXVLTP5pQFM5Mfs=</HostId></Error>

Note that this contains the invalid argument value "ETags" and an accurate error message.

To Reproduce

  1. Start versitygw, e.g.: ./versitygw --access=******** --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 bucket, e.g.: aws --no-verify-ssl s3api create-bucket --bucket versity-gwtest-bucket-one-1
  3. Add object, e.g.: aws --no-verify-ssl s3api put-object --body /Users/lukemccrone/devel/versitygw/versity-gwtest-files/test_file --bucket versity-gwtest-bucket-one-1 --key test_file
  4. Attempt to get invalid attribute, e.g. (with the get_object_attributes.sh REST script): curl -ks -w %{http_code} https://localhost:7070/versity-gwtest-bucket-one-1/test_file?attributes= -H Authorization: AWS4-HMAC-SHA256 Credential=********/20241223/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-object-attributes,Signature=558f9cf8424268cf30447c14f1029a56a99422335808e7efe195b70c52dc73c1 -H x-amz-content-sha256: UNSIGNED-PAYLOAD -H x-amz-date: 20241223T203326Z -H x-amz-object-attributes: ETags -o /Users/lukemccrone/devel/versitygw/versity-gwtest-files/attributes.txt

Expected behavior
versitygw error matches the direct error

Server Version
Version : v1.0.9
Build : 91d3bbc
BuildTime: 2024-12-23_08:30:21PM
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 Dec 23, 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