From f6b5627eaff84b90912e4a81becd8dc82a47b5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Tue, 24 Sep 2019 18:16:54 +0200 Subject: [PATCH] Add test page to gitlab.io --- .gitlab-ci.yml | 7 +++ public/css/styles.css | 16 ++++++ public/i253.html | 42 +++++++++++++++ public/index.html | 55 ++++++++++++++++++++ public/js/scripts.js | 113 +++++++++++++++++++++++++++++++++++++++++ public/void/index.html | 0 6 files changed, 233 insertions(+) create mode 100644 public/css/styles.css create mode 100644 public/i253.html create mode 100644 public/index.html create mode 100644 public/js/scripts.js create mode 100644 public/void/index.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7dd1b00..87f7394 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ before_script: stages: - build + - deploy hash rules: stage: build @@ -40,3 +41,9 @@ build chrome: artifacts: paths: - ClearUrls_chrome.zip + +pages: + stage: deploy + artifacts: + paths: + - public \ No newline at end of file diff --git a/public/css/styles.css b/public/css/styles.css new file mode 100644 index 0000000..a8a760f --- /dev/null +++ b/public/css/styles.css @@ -0,0 +1,16 @@ +body { + background-color: #FFFFFF; +} +.ui.menu .item img.logo { + margin-right: 1.5em; +} +.main.container { + margin-top: 7em; +} +.wireframe { + margin-top: 2em; +} +.ui.footer.segment { + margin: 5em 0em 0em; + padding: 5em 0em; +} diff --git a/public/i253.html b/public/i253.html new file mode 100644 index 0000000..722c202 --- /dev/null +++ b/public/i253.html @@ -0,0 +1,42 @@ + + + + + + + ClearURLs - Issue 253 + + + + + + + + + + +
+

ClearURLs - Issue 253

+ +
+ +
+

+ Your ClearURLs version is vulnerable to the problem from issue 253. + Please update your ClearURLs installation to at least version 1.8.3 or higher. +

+
+
+
+ + + + + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..62c82f8 --- /dev/null +++ b/public/index.html @@ -0,0 +1,55 @@ + + + + + + + ClearURLs test page + + + + + + + + + + +
+

ClearURLs test page

+ +

+ On this page you can automatically check whether ClearURLs works correctly. + If you are using an obsolete ClearURLs version that is affected by a potential security vulnerability, + you will also be notified on this page. +

+ +
+ +
+
+
+
+ + + + + + + +
+ + + + + + diff --git a/public/js/scripts.js b/public/js/scripts.js new file mode 100644 index 0000000..0367d7c --- /dev/null +++ b/public/js/scripts.js @@ -0,0 +1,113 @@ +/* +* ClearURLs +* Copyright (c) 2017-2019 Kevin Röbert +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, see . +*/ + +/*jshint esversion: 6 */ +function checkRule() { + let resURL; + try { + resURL = document.getElementById("void_roebert_eu_iframe").contentWindow.location.href; + } catch(e) { + resURL = "error"; + } + + let segment = $('#rules_filter_test'); + + if(resURL === 'https://kevinroebert.gitlab.io/clearurls/void/index.html') { + segment.addClass('positive'); + segment.append(''); + segment.append('

The tracking filter function of ClearURLs works correctly.

'); + } else { + segment.addClass('warning'); + segment.append(''); + segment.append('

The tracking filter function of ClearURLs does not work properly. ' + + 'Maybe the addon is disabled or the rules could not be downloaded.

'); + } +} + +function checkRedirection() { + let resURL; + try { + resURL = document.getElementById("redirect_roebert_eu_iframe").contentWindow.location.href; + } catch(e) { + resURL = "error"; + } + + let segment = $('#redirection_filter_test'); + + if(resURL === 'https://kevinroebert.gitlab.io/clearurls/void/index.html') { + segment.addClass('positive'); + segment.append(''); + segment.append('

The redirection function of ClearURLs works correctly.

'); + } else { + segment.addClass('warning'); + segment.append(''); + segment.append('

The redirection function of ClearURLs does not work properly. ' + + 'Maybe the addon is disabled or the rules could not be downloaded.

'); + } +} + +function checkBlock() { + let segment = $('#block_filter_test'); + + $('#block_roebert_eu_img') + .on('load', function() { + segment.addClass('warning'); + segment.append(''); + segment.append('

The block function of ClearURLs does not work properly. ' + + 'Maybe the addon is disabled or the rules could not be downloaded.

'); + }) + .on('error', function() { + segment.addClass('positive'); + segment.append(''); + segment.append('

The block function of ClearURLs works correctly.

'); + }) + .attr("src", 'https://www.contentpass.de/img/logo.svg'); +} + +function checkIssue253() { + let segment = $('#issue_253_test'); + + $('#i253_roebert_eu_img') + .on('load', function() { + segment.addClass('negative'); + segment.append(''); + segment.append('

Your ClearURLs version is vulnerable to the problem from issue 253. ' + + 'Please update your ClearURLs installation to at least version 1.8.3 or higher.

'); + }) + .on('error', function() { + segment.addClass('positive'); + segment.append(''); + segment.append('

Your ClearURLs version is not vulnerable to the problem from Issue 253.

'); + }) + .attr("src", 'https://www.google.com/url?rct=j&url=https%3A%2F%2Fkevinroebert.gitlab.io%2Fclearurls%2Fi253.html'); +} + +$(window).on('load', function () { + try { + checkRule(); + } catch(e) {} + try { + checkRedirection(); + } catch(e) {} + try { + checkBlock(); + } catch(e) {} + try { + checkIssue253(); + } catch(e) {} +}); diff --git a/public/void/index.html b/public/void/index.html new file mode 100644 index 0000000..e69de29