From 2358e53e9c9f8489b24648b1017eb856d4bd42b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Elek?= Date: Sat, 14 Sep 2019 05:33:05 +0200 Subject: [PATCH] HDDS-2111. XSS fragments can be injected to the S3g landing page Signed-off-by: Anu Engineer --- .../main/resources/webapps/static/index.html | 8 +++++-- .../src/main/resources/webapps/static/s3g.js | 23 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 hadoop-ozone/s3gateway/src/main/resources/webapps/static/s3g.js diff --git a/hadoop-ozone/s3gateway/src/main/resources/webapps/static/index.html b/hadoop-ozone/s3gateway/src/main/resources/webapps/static/index.html index 68939ef29e..b20bf3530d 100644 --- a/hadoop-ozone/s3gateway/src/main/resources/webapps/static/index.html +++ b/hadoop-ozone/s3gateway/src/main/resources/webapps/static/index.html @@ -21,6 +21,7 @@ + @@ -68,12 +69,15 @@

S3 gateway

For example with aws-cli:

-
aws s3api --endpoint  create-bucket --bucket=wordcount
+
aws s3api --endpoint  create-bucket --bucket=wordcount

For more information, please check the documentation.

- + + + + diff --git a/hadoop-ozone/s3gateway/src/main/resources/webapps/static/s3g.js b/hadoop-ozone/s3gateway/src/main/resources/webapps/static/s3g.js new file mode 100644 index 0000000000..8b1e977ba7 --- /dev/null +++ b/hadoop-ozone/s3gateway/src/main/resources/webapps/static/s3g.js @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +window.onload = function () { + var safeurl = window.location.protocol + "//" + window.location.host + window.location.pathname; + safeurl = safeurl.replace("static/", ""); + document.getElementById('s3gurl').innerHTML = safeurl; +};