TEZ-4754: RelocalizationUtils: input handling improvements - #537
abstractdog wants to merge 1 commit into
Conversation
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
🟡 Changes recommended
URI-scheme traversal and submission-state corruption remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Tightens destination filename validation for relocalized AM resources and adds unit coverage.
Changes:
- Rejects empty, path-based, absolute, and traversal-like names.
- Adds tests for valid and invalid destination names.
File summaries
| File | Description |
|---|---|
tez-common/src/test/java/org/apache/tez/dag/utils/TestRelocalizationUtils.java |
Adds coverage for accepted and rejected destination names. |
tez-common/src/main/java/org/apache/tez/dag/utils/RelocalizationUtils.java |
Validates destination names before downloading resources. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (destName.indexOf('/') >= 0 || destName.indexOf('\\') >= 0 | ||
| || destName.indexOf('\0') >= 0) { | ||
| throw new IllegalArgumentException( | ||
| "Resource name must not contain path separators: " + destName); | ||
| } | ||
| if (destName.equals(".") || destName.equals("..")) { | ||
| throw new IllegalArgumentException( | ||
| "Resource name must not be a parent-directory reference: " + destName); | ||
| } | ||
| if (new Path(destName).isAbsolute()) { |
There was a problem hiding this comment.
not true, adding a unit test to prove: uriSchemeOpaqueFormIsRejected
new Path(destName) call inside RelocalizationUtils#validateDestName already throwsIllegalArgumentException from Hadoop's URI parser in such cases
| // absolute path, a path separator, or a ".." segment — so a submitter | ||
| // holding AM modify access cannot land a jar anywhere on the AM host and | ||
| // chain it into code execution via the classloader / am-hooks path. | ||
| validateDestName(destName); |
There was a problem hiding this comment.
ack, handling with an upfront check
d42ada8 to
650be89
Compare
Tighten validation of the destination file name used when downloading additional AM resources so unexpected shapes are rejected before the file is written. Adds a small unit test. Co-Authored-By: Claude Code <noreply@anthropic.com>
650be89 to
5ce77fb
Compare
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
Tighten validation of the destination file name used when downloading additional AM resources so unexpected shapes are rejected before the file is written. Adds a small unit test.