Merge pull request #11 from eyedeekay/contextual-ids

Contextual ids
This commit is contained in:
idk
2019-10-16 17:31:57 -04:00
committed by GitHub
8 changed files with 149 additions and 29 deletions

View File

@@ -34,8 +34,8 @@ clean:
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
MOZ_VERSION=0.32
VERSION=0.32
MOZ_VERSION=0.34
VERSION=0.35
#VERSION=1.27
xpi:

View File

@@ -53,3 +53,26 @@ submission to AMO.
### Screenshot
![Visiting i2p-projekt.i2p](i2psetproxy.js.png)
Super Extra Important Background Info:
--------------------------------------
This plugin's viability is directly related to the viability of Mozilla and
Tor's work on hardening Firefox itself and of particular interest are the
"Uplift" and "Fusion(Firefox Using Onions)" projects.
### Links about Project Uplift
* https://wiki.mozilla.org/Security/Tor_Uplift
* https://wiki.mozilla.org/Security/FirstPartyIsolation
* https://wiki.mozilla.org/Security/Fingerprinting
* https://wiki.mozilla.org/Security/Fennec%2BTor_Project
* https://wiki.mozilla.org/Security/Tor_Uplift/Tracking
Project uplift seems to have largely been accomplished?
### Links about Project Fusion
* https://wiki.mozilla.org/Security/Fusion
* https://trac.torproject.org/projects/tor/wiki/org/meetings/2018Rome/Notes/FusionProject
* https://blog.torproject.org/tor-heart-firefox

7
debian/changelog vendored
View File

@@ -1,3 +1,10 @@
i2psetproxy.js (0.35-1) UNRELEASED; urgency=low
* Automatically activate contexts
-- idk <hankhill19580@gmail.com> Thu, 01 Aug 2019 00:32:39 -0400
i2psetproxy.js (0.31-1) UNRELEASED; urgency=low
* Initial release. Closes: #nnnn

View File

@@ -42,6 +42,8 @@ document.addEventListener("click", e => {
});
} else if (e.target.id === "clear-browser-data") {
forgetBrowsingData();
} else if (e.target.id === "check-i2p-control") {
echo("I2P Router Detected", "panel-section-i2pcontrol-check");
}
e.preventDefault();

View File

@@ -16,12 +16,13 @@
"webRequestBlocking",
"contextualIdentities",
"cookies",
"history",
"tabs",
"<all_urls>"
],
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "0.32",
"version": "0.35",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
"icons": {
@@ -44,6 +45,7 @@
"background.js",
"proxy.js",
"info.js",
"i2pcontrol.js",
"scrub.js"
]
},

View File

@@ -198,16 +198,7 @@ function EnableSavePasswords() {
var defaultSettings = {
since: "forever",
dataTypes: [
"history",
"downloads",
"cache",
"cookies",
"passwords",
"pluginData",
"formData",
"serviceWorkers"
]
dataTypes: ["downloads", "passwords", "formData", "localStorage", "history"]
};
var appSettings = {
@@ -269,26 +260,111 @@ function forgetBrowsingData(storedSettings) {
browser.notifications.create({
type: "basic",
title: "Removed browsing data",
message: `Removed ${dataTypesString}\nsince ${sinceString}`
message: `Removed ${dataTypesString}\n for i2pbrowser`
});
}
browser.browsingData
.remove(
{
since
},
dataTypes
)
.then(notify);
function deepCleanHistory(historyItems) {
console.log("Deep cleaning history");
for (item of historyItems) {
if (i2pHost(item.url)) {
browser.history.deleteUrl({
url: item.url
});
browser.browsingData.removeCache({});
console.log("cleared Cache");
browser.browsingData
.removePasswords({
hostnames: [i2pHostName(item.url)],
since: since
})
.then(onGot);
console.log("cleared Passwords");
browser.browsingData
.removeDownloads({
hostnames: [i2pHostName(item.url)],
since: since
})
.then(onGot);
console.log("cleared Downloads");
browser.browsingData
.removeFormData({
hostnames: [i2pHostName(item.url)],
since: since
})
.then(onGot);
console.log("cleared Form Data");
browser.browsingData
.removeLocalStorage({
hostnames: [i2pHostName(item.url)],
since: since
})
.then(onGot);
console.log("cleared Local Storage");
contexts = browser.contextualIdentities.query({
name: "i2pbrowser"
});
function deepCleanCookies(cookies) {
for (cookie of cookies) {
var removing = browser.cookies.remove({
firstPartyDomain: cookie.firstPartyDomain,
name: cookie.name,
url: item.url
});
removing.then(onGot, onError);
}
console.log("Cleared cookies")
}
function deepCleanContext(cookieStoreIds) {
for (cookieStoreId of cookieStoreIds) {
var removing = browser.cookies.getAll({
firstPartyDomain: null,
storeId: cookieStoreId.cookieStoreId
});
removing.then(deepCleanCookies, onError);
}
}
contexts.then(deepCleanContext, onError);
}
}
notify();
}
var searching = browser.history.search({
text: "i2p",
startTime: 0
});
searching.then(deepCleanHistory);
setAllPrivacy();
ResetPeerConnection();
}
function i2pHostName(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
}
return hostname;
}
function i2pHost(url) {
let hostname = i2pHostName(url);
return hostname.endsWith(".i2p");
}
function onGot(contexts) {
for (let context of contexts) {
console.log(context);
if (contexts != null) {
for (let context of contexts) {
console.log(context);
}
}
}

View File

@@ -7,10 +7,12 @@ var contextScrub = async function(requestDetails) {
} else {
if ((context.name = "i2pbrowser")) {
var ua = "MYOB/6.66 (AN/ON)";
for (var header of requestDetails.requestHeaders) {
if (header.name.toLowerCase() === "user-agent") {
header.value = ua;
console.log("(scrub)User-Agent header modified", header.value);
if (i2pHost(requestUrl.url)) {
for (var header of requestDetails.requestHeaders) {
if (header.name.toLowerCase() === "user-agent") {
header.value = ua;
console.log("(scrub)User-Agent header modified", header.value);
}
}
}
return {
@@ -180,13 +182,18 @@ var contextSetup = async function(requestDetails) {
}
};
function i2pHost(url) {
function i2pHostName(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
}
return hostname;
}
function i2pHost(url) {
let hostname = i2pHostName(url);
return hostname.endsWith(".i2p");
}

View File

@@ -32,6 +32,8 @@
<a href="http://i2pforum.i2p" id="window-create-forum-panel">Visit the I2P Forums</a><br>
<a href="http://i2p-projekt.i2p/blog" id="window-create-news-panel">Get the latest I2P News</a><br>
<div class="panel-section-separator"></div>
<a href="#" id="check-i2p-control">Check I2P Router Health</a><div id="panel-section-i2pcontrol-check"></div>
<div class="panel-section-separator"></div>
<div class="panel-section-identity">
<div id="identity-list"></div>
@@ -44,6 +46,7 @@
<script src="privacy.js"></script>
<script src="info.js"></script>
<script src="content.js"></script>
<script src="i2pcontrol.js"></script>
</body>