Skip to content
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

Removing URL query param from swagger UI to fix the XSS issue #23234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/ui/data/swagger/datafile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2679,12 +2679,7 @@ var _third_party_swagger_ui_index_html = []byte(`<!DOCTYPE html>
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "../../swaggerapi";
}
var url = "../../swaggerapi";
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
Expand Down Expand Up @@ -2763,7 +2758,7 @@ func third_party_swagger_ui_index_html() (*asset, error) {
return nil, err
}

info := bindata_file_info{name: "third_party/swagger-ui/index.html", size: 3720, mode: os.FileMode(416), modTime: time.Unix(1458251987, 0)}
info := bindata_file_info{name: "third_party/swagger-ui/index.html", size: 3561, mode: os.FileMode(416), modTime: time.Unix(1458347707, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down
2 changes: 2 additions & 0 deletions third_party/swagger-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ https://github.com/swagger-api/swagger-ui#how-to-use-it
https://github.com/swagger-api/swagger-ui#how-to-use-it
- Modified swagger-ui.js to list resources and operations in sorted order: https://github.com/kubernetes/kubernetes/pull/3421
- Set supportedSubmitMethods: [] in index.html to remove "Try it out" buttons.
- Remove the url query param to fix XSS issue:
https://github.com/kubernetes/kubernetes/pull/23234

LICENSE file has been created for compliance purposes.
Not included in original distribution.
7 changes: 1 addition & 6 deletions third_party/swagger-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "../../swaggerapi";
}
var url = "../../swaggerapi";
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
Expand Down