Skip to content

[BACKPORT][MINOR][UI] Encode query parameters when generating log page scripts#57166

Open
holdenk wants to merge 4 commits into
apache:branch-4.xfrom
holdenk:log-page-encode-4.x
Open

[BACKPORT][MINOR][UI] Encode query parameters when generating log page scripts#57166
holdenk wants to merge 4 commits into
apache:branch-4.xfrom
holdenk:log-page-encode-4.x

Conversation

@holdenk

@holdenk holdenk commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

The log viewer pages assemble a query string from request parameters and embed it into an inline script literal. Encode that value for a JavaScript string context using the bundled commons-text StringEscapeUtils, matching the existing pattern in AllJobsPage, so the generated script stays well-formed regardless of the parameter contents. Also sanitize the parameters on the client side in log-view.js, and add a regression test.

Backport to 4.x of #57165

Why are the changes needed?

Formatting can get funky with unescaped parameters.

Does this PR introduce any user-facing change?

No

How was this patch tested?

New test

Was this patch authored or co-authored using generative AI tooling?

Primarily Claude 4.8

Claude and others added 2 commits July 2, 2026 14:01
The log viewer pages assemble a query string from request parameters and
embed it into an inline script literal. Encode that value for a JavaScript
string context using the bundled commons-text StringEscapeUtils, matching
the existing pattern in AllJobsPage, so the generated script stays
well-formed regardless of the parameter contents. Also sanitize the
parameters on the client side in log-view.js, and add a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmZGbR3Y8L84RfcfqptgGW
Encode individual query-parameter values on the server when building the
log page bootstrap script, so the resulting /log requests are unambiguous.
Extract the shared script-building helper into UIUtils to keep the log
pages consistent. The server now emits a fully-encoded query string, so
the client-side handling is reverted to a straight pass-through.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmZGbR3Y8L84RfcfqptgGW
(cherry picked from commit 4a5e27e)
@dongjoon-hyun

Copy link
Copy Markdown
Member

cc @huaxingao

@huaxingao huaxingao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pending CI

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holdenk and others added 2 commits July 9, 2026 22:39
Co-authored-by: Dongjoon Hyun <dongjoon@apache.org>

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for revisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants