-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20393][WEBU UI][1.6] Strengthen Spark to prevent XSS vulnerabilities #19528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d9a45aa
630854a
ffe3e98
cafe18d
cb1609b
76ad8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,9 +16,9 @@ | |
| */ | ||
|
|
||
| package org.apache.spark.ui.jobs | ||
|
|
||
| import javax.servlet.http.HttpServletRequest | ||
|
||
| import org.apache.spark.scheduler.SchedulingMode | ||
| import org.apache.spark.ui.{SparkUI, SparkUITab} | ||
| import org.apache.spark.ui.{SparkUI, SparkUITab, UIUtils} | ||
|
|
||
| /** Web UI showing progress status of all jobs in the given SparkContext. */ | ||
| private[ui] class JobsTab(parent: SparkUI) extends SparkUITab(parent, "jobs") { | ||
|
|
@@ -33,4 +33,20 @@ private[ui] class JobsTab(parent: SparkUI) extends SparkUITab(parent, "jobs") { | |
|
|
||
| attachPage(new AllJobsPage(this)) | ||
| attachPage(new JobPage(this)) | ||
|
|
||
| def handleKillRequest(request: HttpServletRequest): Unit = { | ||
| if (killEnabled && parent.securityManager.checkModifyPermissions(request.getRemoteUser)) { | ||
| // stripXSS is called first to remove suspicious characters used in XSS attacks | ||
| val jobId = Option(UIUtils.stripXSS(request.getParameter("id"))).map(_.toInt) | ||
| jobId.foreach { id => | ||
| if (jobProgresslistener.activeJobs.contains(id)) { | ||
| sc.foreach(_.cancelJob(id)) | ||
| // Do a quick pause here to give Spark time to kill the job so it shows up as | ||
| // killed after the refresh. Note that this will block the serving thread so the | ||
| // time should be limited in duration. | ||
| Thread.sleep(100) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?