-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-20393][Webu UI] Strengthen Spark to prevent XSS vulnerabilities #17686
Closed
Closed
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6bdc629
UIUtils.stripXSS added for each page calling request.getParameter.
n-marion c812f2e
Perform stripXSS on creation of allParameters mapping
n-marion 06a6791
getParameterMap returns Array[String], created new function to handle
n-marion d50c0c2
Clean up method. Change variable names. Add space in comment to match…
n-marion 19d6f86
Cleanup stripXSS and remove redundant (_)
n-marion ff7be45
Remove additional array function. Add 4 tests to UIUtilsSuite.
n-marion 18dbd6f
Change to regex, add case-insensitivity to regex, create new testcase…
n-marion 39824a8
Fix Scalastyle errors.
n-marion ef1cc25
ScalaStyle fix for imports on UIUtils.
n-marion 8ed9c76
Fix scalastyle for new tests.
n-marion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,18 +220,20 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") { | |
jobTag: String, | ||
jobs: Seq[JobUIData], | ||
killEnabled: Boolean): Seq[Node] = { | ||
val allParameters = request.getParameterMap.asScala.toMap | ||
//stripXSS is called to remove suspicious characters used in XSS attacks | ||
val allParameters = request.getParameterMap.asScala.toMap.mapValues(UIUtils.stripXSSMap(_)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
val parameterOtherTable = allParameters.filterNot(_._1.startsWith(jobTag)) | ||
.map(para => para._1 + "=" + para._2(0)) | ||
|
||
val someJobHasJobGroup = jobs.exists(_.jobGroup.isDefined) | ||
val jobIdTitle = if (someJobHasJobGroup) "Job Id (Job Group)" else "Job Id" | ||
|
||
val parameterJobPage = request.getParameter(jobTag + ".page") | ||
val parameterJobSortColumn = request.getParameter(jobTag + ".sort") | ||
val parameterJobSortDesc = request.getParameter(jobTag + ".desc") | ||
val parameterJobPageSize = request.getParameter(jobTag + ".pageSize") | ||
val parameterJobPrevPageSize = request.getParameter(jobTag + ".prevPageSize") | ||
//stripXSS is called first to remove suspicious characters used in XSS attacks | ||
val parameterJobPage = UIUtils.stripXSS(request.getParameter(jobTag + ".page")) | ||
val parameterJobSortColumn = UIUtils.stripXSS(request.getParameter(jobTag + ".sort")) | ||
val parameterJobSortDesc = UIUtils.stripXSS(request.getParameter(jobTag + ".desc")) | ||
val parameterJobPageSize = UIUtils.stripXSS(request.getParameter(jobTag + ".pageSize")) | ||
val parameterJobPrevPageSize = UIUtils.stripXSS(request.getParameter(jobTag + ".prevPageSize")) | ||
|
||
val jobPage = Option(parameterJobPage).map(_.toInt).getOrElse(1) | ||
val jobSortColumn = Option(parameterJobSortColumn).map { sortColumn => | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
Not sure what this method is trying to do but it just returns its argument. Do you just mean
url.map(stripXSS)
? why Map, why url as names?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.
I appreciate the feedback. The method returned the array of strings stripped of possible XSS issues. I have used your recommendation in the next commit. Map was changed to Array. url is now requestParameter.