Improved test pages

For #390
This commit is contained in:
kkapsner 2019-09-04 00:30:20 +02:00
parent acc171041d
commit 14b4bd8ac6
10 changed files with 87 additions and 32 deletions

View File

@ -19,7 +19,7 @@
</head>
<body>
<h1>Audio test</h1>
Expected result:
<h2>Expected result</h2>
<ul>
<li>the hashes in each set should be the same</li>
<li>the hashes should vary between the sets</li>
@ -27,7 +27,7 @@ Expected result:
<li>hitting the refresh button should not change the values</li>
<li>reloading the page should change the values (depending on CanvasBlocker settings)</li>
</ul>
<h2>Tests</h2>
<div id="test">
Hashes: <table class="hashes"></table>
Sum: <span class="sum"></span>

View File

@ -1,7 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>data-URL Test</title>
<title>Data-URL Test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="testIcon.svg" type="image/png" rel="icon">
<link href="testIcon.svg" type="image/png" rel="shortcut icon">
<style>
iframe, object, embed {
display: block;
@ -13,9 +16,18 @@
<link rel="stylesheet" href="data:text/css;base64,Ym9keXtiYWNrZ3JvdW5kLWNvbG9yOiNlMGZmZTA7fQ==">
</head>
<body>
<h1>Normal iFrame</h1>
<h1>Data-URL test</h1>
This test might not work properly if any other addon is installed that changes the CSP headers (e.g. NoScript or uBlock Origin).
<h2>Expected result</h2>
<ul>
<li>the "Normal" and "blob" iFrames show faked hashes</li>
<li>the "Data-URL" iFrame, object and embed shows nothing</li>
<li>the whole page has a green background</li>
</ul>
<h2>Tests</h2>
<h3>Normal iFrame</h3>
<iframe src="sendFingerprintTest.html"></iframe>
<h1>Data-URL iFrame</h1>
<h3>Data-URL iFrame</h3>
<iframe id="iframe" src="data:text/html;base64&#x2c;<?php
echo base64_encode(
str_replace(
@ -25,9 +37,9 @@
)
);
?>"></iframe>
<h1>blob iFrame</h1>
<h3>blob iFrame</h3>
<iframe id="blobIframe"></iframe>
<h1>Data-URL object</h1>
<h3>Data-URL object</h3>
<object
type="text/html"
data="data:text/html;base64&#x2c;<?php
@ -40,7 +52,7 @@
);
?>"
></object>
<h1>Data-URL embed</h1>
<h3>Data-URL embed</h3>
<embed
type="text/html"
src="data:text/html;base64&#x2c;<?php
@ -53,7 +65,7 @@
);
?>"
></embed>
<h1>iFrame code</h1>
<h3>iFrame code</h3>
<pre id="code"></pre>
<script src="dataUrlTest.js"></script>

View File

@ -44,10 +44,17 @@
</head>
<body>
<h1>DOMRect test</h1>
<h2>Expected result</h2>
<ul>
<li>all the hashes and numbers should be equal for each test</li>
<li>if "refresh" is clicked the hash must not change</li>
<li>upon page reload the hashes chang</li>
</ul>
<h2>Tests</h2>
<iframe id="iframe" src="domRectIFrame.html"></iframe>
<div id="tests">
<div class="test">
<h2 class="title"></h2>
<h3 class="title"></h3>
Hash: <span class="hash"></span><br>
Data: <span class="data"></span><br>
<button class="refresh">refresh</button>

View File

@ -41,7 +41,10 @@
window.setTimeout(function(){
document.body.innerHTML = "<iframe></iframe>";
console.log("TEST:", "innerHTML after 1000ms:", compare(test(window[0]), reference));
document.body.innerHTML = "<h1>Iframe protection</h1>Open console (Ctrl + Shift + K) to see results. Depending on your Browser version you might have to check the \"Persist Logs\" flag and reload the page.<br><h2>Expected behaviour</h2><ul><li>The displayed hashes should not be your native hash (run test with CB disabled to get it)</li><li>All the displayed hashes should be the same (exception if there is a change to a wyciwyg page)</li><li>All lines with \"TEST:\" should have a \"match\" at the end</li></ul>";
document.body.innerHTML = "<h1>Iframe protection</h1>Open console (Ctrl + Shift + K) to see results. Depending on your Browser version you might have to check the \"Persist Logs\" flag and reload the page.<br><h2>Expected result</h2><ul><li>the displayed hashes should not be your native hash (run test with CB disabled to get it)</li><li>all the displayed hashes should be the same (exception if there is a change to a wyciwyg page)</li><li>all lines with \"TEST:\" should have a \"match\" at the end</li></ul>";
var title = document.createElement("title");
title.textContent = "iFrame test";
document.getElementsByTagName("head")[0].appendChild(title);
}, 1000);
</script>
</body>

View File

@ -8,7 +8,9 @@
</head>
<body>
<h1>Test pages for CanvasBlocker</h1>
<div>
The "Expected result" in each test page apply to the default settings of CanvasBlocker if not stated otherwise. If you get different results and do not understand why you may open an issue at <a href="https://github.com/kkapsner/CanvasBlocker/issues">https://github.com/kkapsner/CanvasBlocker/issues</a>. Do not forget to post your settings within the issue.
</div>
<ul>
<li><a href="test.html">Fingerprinting test</a></li>
<li><a href="dataUrlTest.php">Data-URL test</a></li>

View File

@ -8,7 +8,14 @@
</head>
<body>
<h1>Navigator test</h1>
Tests the navigator properties.
Tests the navigator properties. In the default settings of CanvasBlocker the navigator properties are not altered. You have to enable the navigator protection and then open the navigator settings to chose the desired values.
<h2>Expected result</h2>
<ul>
<li>the server and client user agent match</li>
<li>the navigator properties are according to what was set in the CanvasBlocker settings</li>
<li>the values in the iFrame are equal to the normal values</li>
</ul>
<h2>Tests</h2>
<div id="log">
<div class="log">
<div class="logLine">

View File

@ -8,7 +8,7 @@
</head>
<body>
<h1>Performance test</h1>
Tests the canvas readout performance.
Tests the performance of some operations that are affected by CanvasBlocker.
<div id="log">
</div>
<script src="performanceTest.js"></script>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<title>Settings loading test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="testIcon.svg" type="image/png" rel="icon">
<link href="testIcon.svg" type="image/png" rel="shortcut icon">
@ -47,32 +47,46 @@
var firstFingerprint = false;
}
</script>
<style>
#output {
padding: 1em;
}
</style>
</head>
<body>
<h1>Settings loading test</h1>
<h2>Expected result</h2>
<ul>
<li>the background of the test result is green and states "good"</li>
<li>the displayed hash changes upon reload</li>
</ul>
<h2>Test</h2>
<div id="output"></div>
<script>
if (firstFingerprint){
document.body.textContent = "context API not blocked";
var output = document.getElementById("output");
output.textContent = "context API not blocked";
window.setTimeout(function(){
console.log(new Date(), "starting second fingerprint", window.name);
document.body.appendChild(document.createElement("br"));
output.appendChild(document.createElement("br"));
var secondFingerprint = fingerPrint();
if (firstFingerprint === secondFingerprint){
hash(firstFingerprint).then(function(hash){
document.body.appendChild(document.createTextNode("fingerprint consistent (" + hash + ") -> good!"));
document.body.style.backgroundColor = "green";
output.appendChild(document.createTextNode("fingerprint consistent (" + hash + ") -> good!"));
output.style.backgroundColor = "green";
});
}
else {
Promise.all([hash(firstFingerprint), hash(secondFingerprint)]).then(function(hashes){
document.body.appendChild(document.createTextNode("fingerprint not consistent (" + hashes[0] + " != " + hashes[1] + ") -> very bad! (potential fingerprint leak)"));
document.body.style.backgroundColor = "red";
output.appendChild(document.createTextNode("fingerprint not consistent (" + hashes[0] + " != " + hashes[1] + ") -> very bad! (potential fingerprint leak)"));
output.style.backgroundColor = "red";
});
}
}, 500);
}
else {
document.body.textContent = "context API blocked";
document.body.style.backgroundColor = "orange";
output.textContent = "context API blocked";
output.style.backgroundColor = "orange";
}
</script>
</body></html>

View File

@ -2,20 +2,30 @@
<script src="firstPossibleCall.js"></script>
<html>
<head>
<title>Test</title>
<title>Canvas test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="testIcon.svg" type="image/png" rel="icon">
<link href="testIcon.svg" type="image/png" rel="shortcut icon">
</head>
<body>
<h1>Canvas test</h1>
<h2>Expected result</h2>
<ul>
<li>all the hashes should be equal for each test</li>
<li>the hash before and after the "/" do not have to match</li>
<li>"isPointInPath" may vary between tests</li>
<li>if "refresh" is clicked the hash must not change (but "isPointInPath" may)</li>
<li>upon page reload the hash changes</li>
</ul>
<h2>Tests</h2>
<div id="top">
<h1>top Test</h1>
<h3>top Test</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="iframe">
<h1>iFrame Test. Thanks to DocumentRoot.</h1>
<h3>iFrame Test. Thanks to DocumentRoot.</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<iframe sandbox="allow-same-origin" style="display:none"></iframe>
@ -23,7 +33,7 @@
</div>
</div>
<div id="iframe2">
<h1>iFrame Test 2 - with URL</h1>
<h3>iFrame Test 2 - with URL</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<iframe src="?" sandbox="allow-same-origin" style="display:none"></iframe>
@ -31,26 +41,26 @@
</div>
</div>
<div id="iframe3">
<h1>iFrame Test 3 - violating SOP</h1>
<h3>iFrame Test 3 - violating SOP</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<iframe src="http://example.org" style="display:none"></iframe>
<button>refresh</button>
</div>
<div id="iframe4">
<h1>iFrame Test 4 - different access 1</h1>
<h3>iFrame Test 4 - different access 1</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="iframe5">
<h1>iFrame Test 5 - different access 2</h1>
<h3>iFrame Test 5 - different access 2</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="iframe6">
<h1>iFrame Test 6 - different access 3</h1>
<h3>iFrame Test 6 - different access 3</h3>
<img class="display"><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>

View File

@ -23,7 +23,7 @@
max = Math.max(max, values[pixels[i]]);
}
output.textContent = context + ": " + (max !== 3 * values[255]? "": "not ") + "faked";
output.textContent = context + ": " + (max !== 3 * values[255]? "": "not ") + "supported";
output.title = JSON.stringify(values);
}
catch (e){