TEZ-4753: ShuffleHandler: input handling improvements - #536
Open
abstractdog wants to merge 1 commit into
Open
abstractdog wants to merge 1 commit into
abstractdog wants to merge 1 commit into
Conversation
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
🟡 Changes recommended
Query-parameter “shape” validation is still incomplete (multiple dag/vertex values) and the new test should use a consistent valid job id to avoid false-positive coverage.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR strengthens ShuffleHandler HTTP query parameter validation to block path-traversal vectors (dag/vertex/map) before any filesystem path construction or delete/read operations occur, and adds a regression test to cover traversal attempts.
Changes:
- Added strict regex validation for
dag,vertex, andmap/attempt identifiers to prevent traversal components from reaching path concatenation logic. - Added early request rejection (400) for malformed structural parameters.
- Added a regression test that issues delete/read requests with traversing values and asserts they are rejected and do not delete out-of-scope files.
File summaries
| File | Description |
|---|---|
| tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java | Adds parameter pattern validation to prevent path traversal via shuffle query parameters and attempt-id handling. |
| tez-plugins/tez-aux-services/src/test/java/org/apache/tez/auxservices/TestShuffleHandler.java | Adds a regression test covering traversal attempts in dag, vertex, and map query parameters. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1208
to
+1221
| if (dagIdQ != null && !dagIdQ.isEmpty()) { | ||
| String dagId = dagIdQ.get(0); | ||
| if (dagId == null || !DAG_ID_PATTERN.matcher(dagId).matches()) { | ||
| sendError(ctx, "Bad dag parameter", BAD_REQUEST); | ||
| return false; | ||
| } | ||
| } | ||
| if (vertexIdQ != null && !vertexIdQ.isEmpty()) { | ||
| String vertexId = vertexIdQ.get(0); | ||
| if (vertexId == null || !VERTEX_ID_PATTERN.matcher(vertexId).matches()) { | ||
| sendError(ctx, "Bad vertex parameter", BAD_REQUEST); | ||
| return false; | ||
| } | ||
| } |
Comment on lines
+1912
to
+1913
| conn = (HttpURLConnection) URI.create( | ||
| base + "/mapOutput?job=job_12345_1&dag=1&reduce=1&map=" |
Comment on lines
+1205
to
+1207
| private boolean validateShufflePathParams(ChannelHandlerContext ctx, | ||
| List<String> dagIdQ, List<String> vertexIdQ, List<String> mapIds, | ||
| boolean isDeleteRequest) { |
Tighten validation of the dag, vertex and map query parameters in the shuffle handler so unexpected shapes are rejected up front rather than carried into filesystem path construction. Also reject requests where dag or vertex is present more than once, since downstream code only reads the first occurrence and a permissive validator would let a submitter pair a benign first value with a hostile second one. Adds regression tests. Co-Authored-By: Claude Code <noreply@anthropic.com>
abstractdog
force-pushed
the
TEZ-4753
branch
from
September 21, 2026 09:53
6967579 to
e5cb36f
Compare
|
🎊 +1 overall
This message was automatically generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tighten validation of the dag, vertex and map query parameters in the shuffle handler so unexpected shapes are rejected up front rather than carried into filesystem path construction. Adds a regression test.