-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-13668. Support S3 signed single chunk payload verification #9294
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
base: master
Are you sure you want to change the base?
Conversation
Investigation: why aws-sdk-ruby test still failsIn the AWS documentation — for example, IAM, S3 query parameter and S3 Signature Calculations for the Authorization Header — it is stated that all However, in the Mint Ruby testcase,it appears that the In the MinIO implementation, only the |
...ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/signature/StringToSignProducer.java
Outdated
Show resolved
Hide resolved
|
During the implementation process, I noticed that Ozone doesn’t seem to validate mismatched values between signed headers and signed query parameters.
To clarify my understanding: Ozone currently relies only on the query parameters for signature validation and does not compare them against the corresponding request headers. Because of this, a mismatch would never trigger an Please let me know if I’m missing something. |
Could you give some examples here? Currently I think we only check that all the headers in |
Hi @ivandika3, I added a test (link) to check if requests with conflicting |
|
@yandrey321 Do you wanna review this change? |
|
Hi @ivandika3, I tried a new implementation that introduces a runnable However, the current implementation feels suboptimal. To avoid changing existing method signatures, I throw I have a couple of questions:
PTAL when you have time, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hevinhsu for iterating on this.
Is this design acceptable (i.e., introducing preCommit in KeyOutputStream and exposing it via a setter)?
The preCommit hook is a good approach. We can maybe make it an array/list to accomodate additional precommit validation like in #8506, but we can address this in the future.
However, the current implementation feels suboptimal. To avoid changing existing method signatures, I throw IllegalArgumentException when validation fails, and then transform that exception into an O3SException in ObjectEndpoint if the error message matches.
Yes, this seems a bit awkward and prone to error. Instead of Runnable, we might be able to use Ratis CheckedRunnable<IOException> as the preCommit (similar to Validator interface in XceiverClientSpi)? Afterwards, we can simply throw OS3Exception that will be automatically handled by OS3ExceptionMapper?
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
Outdated
Show resolved
Hide resolved
|
Thanks @ivandika3 for the feedback.
Sorry, I may have misunderstood this point. I did try a similar approach while exploring the solution, but I ran into a limitation: I also considered introducing a new I’d appreciate any clarification on how you envisioned using |
|
@hevinhsu Yes, you are correct. Since I wonder whether there will be any effects if we simply change |
|
@ivandika3 Got it — I’ll give this approach a try and evaluate the impact. This was actually my initial thought when exploring possible solutions. However, after some consideration, I hesitated because I wasn’t fully convinced that That said, given the benefit of simplifying the |
|
Hi @ivandika3, I’ve updated this PR based on your feedback. Separately, I also experimented with making ozone/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java Line 508 in 41dd150
After adding this additional handling logic: Due to this behavioral impact and the need to adjust existing exception-handling logic, I did not include the |
ivandika3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hevinhsu Thanks for the updating the patch and testing the workarounds. Sorry the review takes a lot longer than expected.
Regarding updating the BucketEndpoint issue, could you try changing the catch (IOException) to catch(OMException) instead and let the other IOException including OS3Exception to IOException.
Another possible alternative is simply make OS3Exception to be unchecked exception (i.e. RuntimeException). This might be more appropriate compared to IOException.
FYI, if you want to go through with the previous wrapping solution, we have HddsClientUtils#containsException to find the exception we want, but might have some other issues.
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
Outdated
Show resolved
Hide resolved
# Conflicts: # hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectPut.java # hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectTaggingDelete.java
|
Hi @ivandika3, Thank you for taking the time to review this fairly large change set and for the detailed suggestions — I really appreciate it.
I tried changing
I also tried making
I also tried the wrapper-based approach by introducing S3IOExceptionWrapper to carry the original I did not end up using If there are any edge cases or design considerations that I might have overlooked with this simplified approach, please let me know — I’d be happy to revisit it. |
What changes were proposed in this pull request?
Add S3 request body SHA-256 verification to support single-chunk payload validation.
Please describe your PR in detail:
x-amz-content-sha256header.x-amz-content-sha256forGETrequests when the header is present.What is the link to the Apache JIRA
HDDS-13668
How was this patch tested?
https://github.com/hevinhsu/ozone/actions/runs/19321794081
This patch also tested using the MinIO Mint S3 compatibility suite, focusing only on the test cases that previously failed in HDDS-12871.
After applying this patch:
unmarshalling xml failedmessage (introduced on 2025/Oct/03) no longer appears.