Repository navigation
TEZ-4755: AMWebController: rendering improvements in StaticAMView - #538
abstractdog wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
U+2028 and U+2029 can still break the inline JavaScript redirect.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates StaticAMView to safely encode configured history URLs in HTML and JavaScript contexts.
Changes:
- Adds context-specific escaping helpers.
- Applies escaping to rendered redirects.
- Adds regression tests for injection characters.
File summaries
| File | Summary |
|---|---|
tez-dag/src/test/java/org/apache/tez/dag/app/web/TestAMWebController.java |
Adds escaping regression coverage. |
tez-dag/src/main/java/org/apache/tez/dag/app/web/AMWebController.java |
Escapes history URLs before rendering; JavaScript line terminators remain unhandled. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| default: | ||
| if (c < 0x20) { | ||
| sb.append(String.format("\\u%04x", (int) c)); | ||
| } else { | ||
| sb.append(c); | ||
| } |
|
🎊 +1 overall
This message was automatically generated. |
43cb2b4 to
c0cc34d
Compare
|
🎊 +1 overall
This message was automatically generated. |
ayushtkn
left a comment
There was a problem hiding this comment.
Thanx @abstractdog
Can we use the existing libraries here?
-
Replace escapeHtmlAttribute(historyUrl) with:StringEscapeUtils.escapeHtml4(historyUrl)
-
Replace escapeJsString(historyUrl) with:StringEscapeUtils.escapeEcmaScript(historyUrl)
or
- Replace escapeHtmlAttribute(historyUrl) with:Encode.forHtmlAttribute(historyUrl)
- Replace escapeJsString(historyUrl) with:Encode.forJavaScript(historyUrl)
Just trying to see, if we can use some existing lib rather than maintaining these methods ourselves
Encode the configured history-url value when splicing it into the StaticAMView redirect page so unexpected characters cannot alter the surrounding HTML or JavaScript context. Adds a unit test. Co-Authored-By: Claude Code <noreply@anthropic.com>
ack, moved to commons-text, thanks! |
|
🎊 +1 overall
This message was automatically generated. |
Encode the configured history-url value when splicing it into the StaticAMView redirect page so unexpected characters cannot alter the surrounding HTML or JavaScript context. Adds a unit test.