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

Etag in metadata is assumed to be hex string #1371

Closed
sudeeptoroy opened this issue Nov 4, 2017 · 7 comments
Closed

Etag in metadata is assumed to be hex string #1371

sudeeptoroy opened this issue Nov 4, 2017 · 7 comments
Labels
investigating This issue is being investigated and/or work is in progress to resolve the issue. response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.

Comments

@sudeeptoroy
Copy link

While this is mostly true that the etag is hex string. But RFC define etag as "opaque quoted string"

https://tools.ietf.org/html/rfc7232#page-9

In AmazonS3Client.java getEtag usage can cause issues if metadata.etag is not hex as it's assumed in the entire file.

@shorea
Copy link
Contributor

shorea commented Nov 6, 2017

What problems is this causing? Are you using the S3 client with an alternative S3 implementation?

@shorea shorea added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Nov 6, 2017
@sudeeptoroy
Copy link
Author

This is used with apm and they tend to attach some metadata for their internal usage.
This breaks this hex assumption.
BinaryUtils.fromHex(s3Object.getObjectMetadata().getETag());

Not sure how easy is will it be for you to refactor this code.

@millems
Copy link
Contributor

millems commented Nov 10, 2017

  1. Do you have an example ETag value that is causing the problematic behavior?
  2. What behavior would you expect in this case (obviously not an exception).

@sudeeptoroy
Copy link
Author

Have a look at the etag examples below in the webpage.
https://answers.dynatrace.com/spaces/148/uem-open-q-a_2/questions/153939/uem-sensor-deducting-1s-from-last-modified-respons.html
I could not attach the print screen.
However looks like latest version of dynatrace do not add append to the etag so the exception is not coming after upgrade. However this situation should be handled gracefully and better to expect etag as opaque than a hex value.

@millems
Copy link
Contributor

millems commented Nov 10, 2017

Unfortunately S3 uses the etag for checksum validation, so if it's changed we can't validate the checksum. You can disable GET checksum validation with the com.amazonaws.services.s3.disableGetObjectMD5Validation system property and PUT checksum validation with the com.amazonaws.services.s3.disablePutObjectMD5Validation system property, but that's mostly a workaround.

I'm not sure what we could do if they're changing the etag. Do you have any suggestions as to what you'd expect the SDK to do?

@sudeeptoroy
Copy link
Author

Hi, thanks for the information. At this point in time I guess it's fine as they moved out of etag. However if we can do something to handle this gracefully would help. Like make this a key value so that others can modify it and u can still extract ur value from it. Just a suggestion.

@millems
Copy link
Contributor

millems commented Nov 14, 2017

It's tricky to handle people mutating things in ways we can't predict. They could prepend data, append data, override it altogether, etc. If it was a predictable, standardized mutation, like "data is always appended with a semicolon in front of it", we could probably handle it, but that's not guaranteed here. I'm glad you found a workaround!

@millems millems closed this as completed Nov 14, 2017
@debora-ito debora-ito added response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. and removed needs-response labels Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating This issue is being investigated and/or work is in progress to resolve the issue. response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.
Projects
None yet
Development

No branches or pull requests

5 participants