kerneltime opened a new pull request, #11860: URL: https://github.com/apache/ozone/pull/11860
## What changes were proposed in this pull request? The S3 Gateway unmarshals request bodies (DeleteObjects, CompleteMultipartUpload, PutBucketLifecycleConfiguration) with JAXB. When an element that should hold only text also holds a child element, JAXB keeps only the text after the last child and drops the rest, so the gateway acts on a value the request does not literally contain. A multi-object delete of `<Key>dir/<a/>file</Key>` is read as key `file`, not `dir/file`, and the gateway deletes `file`. No S3 request body has mixed content. `XmlNamespaceFilter`, which every request unmarshaller already uses, now tracks for each open element whether it has seen non-whitespace text and whether it has seen a child element, and rejects the request if it has both. Whitespace between elements stays allowed. A rejected body takes the existing parse-error path (`InvalidRequest`). HDDS-14857 already made the parser reject DOCTYPE declarations; this closes a separate gap. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17600 ## How was this patch tested? - Unit: `TestMultiDeleteRequestUnmarshaller` checks that both mixed-content shapes (`<Key>dir/<a/>file</Key>` and `<Key><a>dir/</a>file</Key>`) are rejected, which fails without the fix because the body is accepted; that a key containing an escaped `<` is still read as one key; and that an indented body still parses. All s3gateway unit tests under `org.apache.hadoop.ozone.s3` pass (80 classes, 1,742 tests). - Acceptance: a new case in `s3/objectmultidelete.robot` sends a mixed-content key through a presigned DeleteObjects URL, because the AWS CLI escapes `<` in keys; `presigned_url_helper.py` gains the helper. On the `ozone` compose cluster, on master it returns `200 OK` with `<Deleted><Key>PREFIX-mixed</Key></Deleted>`, deleting a key the request did not name; with the fix it is rejected and the object is kept. The other `objectmultidelete.robot` case passes in both runs. - `checkstyle:check` on `ozone-s3gateway` is clean. Note: multi-delete parse errors map to `InvalidRequest`, while the CompleteMultipartUpload unmarshaller maps them to `MalformedXML`, which is AWS's code for a malformed body. Aligning that is left out of this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
