diff --git a/.gitignore b/.gitignore index 23b396e..ec05012 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -data/_audit/node_modules -data/_audit/report.txt -*.xpi -.idea +audit/node_modules +audit/report.txt diff --git a/.jpmignore b/.jpmignore deleted file mode 100644 index 94fb2f8..0000000 --- a/.jpmignore +++ /dev/null @@ -1,8 +0,0 @@ -data/_audit/node_modules -data/_audit/report.txt -.jpmignore -.gitignore -.idea -*.xpi -test -.git diff --git a/README.md b/README.md index d687279..d86aba8 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,30 @@ Decentraleyes ============= -A [web browser extension](https://decentraleyes.org) that emulates Content Delivery Networks locally by intercepting requests, finding the required resource and injecting it into the environment. This all happens instantaneously, automatically, and no prior configuration is required. Feel free to use this [testing utility](https://decentraleyes.org/test) to see if it's properly installed, enabled, and correctly configured. +A [web browser extension](https://decentraleyes.org) that emulates Content Delivery Networks to improve your online privacy. It intercepts traffic, finds supported resources locally, and injects them into the environment. All of this happens automatically, so no prior configuration is required. Feel free to use the following [testing utility](https://decentraleyes.org/test) to find out if you are properly protected. > **Note:** Decentraleyes is no silver bullet, but it does prevent a lot of websites from making you send these kinds of requests. Ultimately, you can make Decentraleyes block requests for any missing CDN resources, too. -## Roadmap +## Contributing Code -Now that there's a solid, Mozilla approved, foundation, it's time to move forward. Mobility, extensibility (through support for community-powered resource packages), and usability, will be the main points of attention during this phase. +Suggestions in the form of **Issues**, and contributions in the form of **Pull Requests**, are highly welcome. You can also use the public contact details and PGP key on the extension's [contact page](https://decentraleyes.org/contact) to get in touch. -#### Essential Next Steps +#### Prerequisites -* Start work on a resource bundle standard, to allow users to create and import custom resources. With support for these bundles in place, Decentraleyes will still work out of the box, but can be extended if needed. -* To keep this add-on from turning into bloatware, it's important to find out which versions of which libraries are most commonly used on websites, so that less popular resources can be removed from the default bundle. +* Mozilla Firefox 56 *(or higher)*. -#### Planned Features +> **Note:** If you want to contribute to the Firefox legacy extension, please check out the ```legacy``` branch. If you are looking for the Chromium-compatible codebase, please see the ```experimental``` branch. -* Advanced policy management for users who block requests for missing resources. -* Smarter resource version interpretation for handling dynamic notations. -* A minimalistic and non-essential graphical user interface. -* Support for custom, importable, library repositories. +#### Running the Code -> **Note:** These long-term goals are subjective to change, and can be discussed. That is, as long as the suggestions do not conflict with the ultimate goal of realizing a free and open standard for exchanging web resource bundles. +Please read this [short guide](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension#Trying_it_out) for information on how to run this extension from source. + +> **Important:** All commits since 26 October 2016 are signed with GPG. It's likely best to ignore unsigned commits, unless you really know what you're doing. Please send an email if you have any questions or security concerns. ## Submitting Translations Do you master a non-supported language? Please help out by translating this add-on on [Crowdin](https://crowdin.com/project/decentraleyes). -## Contributing Code - -Suggestions in the form of **Issues** and contributions in the form of **Pull Requests** are highly welcome. You can also use the contact details and PGP key on the add-on [download page](https://addons.mozilla.org/firefox/addon/decentraleyes) to get in touch. - -#### Prerequisites - -* Jetpack Manager [jpm](https://developer.mozilla.org/Add-ons/SDK/Tools/jpm#Installation) (a Node-based replacement for cfx). -* Firefox version 38 or later. *If you need to work with earlier versions of Firefox, you'll need to use the old cfx tool. See instructions for [getting started with cfx](https://developer.mozilla.org/Add-ons/SDK/Tutorials/Getting_started). - -#### Build Instructions (Unix) - - git clone https://github.com/Synzvato/decentraleyes - cd decentraleyes - jpm xpi - -> **Important:** All commits since 26 October 2016 are signed with GPG. It's likely best to ignore unsigned commits, unless you really know what you're doing. Please send an email if you have any questions or security concerns. - ## License [MPL-2.0](https://www.mozilla.org/MPL/2.0). diff --git a/_locales/bg/messages.json b/_locales/bg/messages.json new file mode 100644 index 0000000..bc8c1d0 --- /dev/null +++ b/_locales/bg/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Защитава ви от следене чрез свободна, централизирана доставка на съдържание.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Блокиране на заявки за липсващи ресурси", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Отмяна на прехванатата заявка, ако изисквания ресурс не е наличен на местно ниво.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Изключване на домейните от инспекции", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Въведете домейни, които да се добавят в белия списък. Отделете стойностите с точка и запетая.", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Брояч за местно вмъкнати ресурси", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Количество на местни вмъквания на ресурси от началото на инсталацията.", + "description": "Amount injected description." + } +} diff --git a/_locales/da/messages.json b/_locales/da/messages.json new file mode 100644 index 0000000..e04f40b --- /dev/null +++ b/_locales/da/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Beskytter dig imod sporing af \"gratis\", centraliserede indholdsleverandører.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Bloker anmodninger om manglende ressourcer", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Annullerer en anmodning hvis den forespurgte ressource ikke findes lokalt.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Udeluk disse domæner fra inspektion", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Tilføj domæner der ikke skal opfanges. Separer flere med semikolon (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Optælling af lokalt leverede ressourcer", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Antal injektioner af lokale ressourcer siden installation.", + "description": "Amount injected description." + } +} diff --git a/_locales/de/messages.json b/_locales/de/messages.json new file mode 100644 index 0000000..2576388 --- /dev/null +++ b/_locales/de/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Schützt vor Tracking durch \"gratis\", zentralisiertes, Abliefern von Content.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Blockiere Anfordern fehlender Inhalte", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Abgefangene Anforderung unterbinden, falls angeforderte Datei nicht lokal verfügbar ist.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Domains von Prüfung ausschließen", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Gebe zu ignorierende Domains an. Trenne mehrere Einträge durch Semikolons (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Zähler für lokal injizierte Ressourcen", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Anzahl der lokalen Injektionen von den CDN-Ressourcen seit der Installation.", + "description": "Amount injected description." + } +} diff --git a/_locales/el/messages.json b/_locales/el/messages.json new file mode 100644 index 0000000..3aac9cb --- /dev/null +++ b/_locales/el/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Προστατεύει από παρακολούθηση μέσω \"δωρεάν\" διανομής περιεχόμενου.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Μπλοκ αιτήσεων για ανύπαρκτους πόρους", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Ακύρωση απομακρυσμένης αίτησης, αν ο απαιτούμενος πόρος δεν είναι τοπικά διαθέσιμος.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Εξαίρεση διευθύνσεων από επιθεωρήσεις", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Εισαγωγή διευθύνσεων στις επιτρεπόμενες. Διαχωρίστε πολλαπλές καταχωρήσεις με ερωτηματικά (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Μετρητής εμβόλιμων τοπικών πόρων", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Ποσοστό εμβόλιμων τοπικών πόρων Δικτύων Παροχής Περιεχομένου από την στιγμή της εγκατάστασης.", + "description": "Amount injected description." + } +} diff --git a/_locales/en_GB/messages.json b/_locales/en_GB/messages.json new file mode 100644 index 0000000..6c77d19 --- /dev/null +++ b/_locales/en_GB/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protects you against tracking through \"free\", centralised, content delivery.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Block requests for missing resources", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Cancel intercepted request if the required resource is not locally available.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Exclude domains from inspections", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Enter domains to whitelist them. Separate multiple entries with semi-colons (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Counter for locally injected resources", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Amount of local Content Delivery Network resource injections since installation.", + "description": "Amount injected description." + } +} diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json new file mode 100644 index 0000000..4dc5b01 --- /dev/null +++ b/_locales/en_US/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protects you against tracking through \"free\", centralized, content delivery.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Block requests for missing resources", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Cancel intercepted request if the required resource is not locally available.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Exclude domains from inspections", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Enter domains to whitelist them. Separate multiple entries with semi-colons (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Counter for locally injected resources", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Amount of local Content Delivery Network resource injections since installation.", + "description": "Amount injected description." + } +} diff --git a/_locales/es/messages.json b/_locales/es/messages.json new file mode 100644 index 0000000..fe64358 --- /dev/null +++ b/_locales/es/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protégete contra rastreo a través de entrega de contenido centralizado \"gratis\".", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Bloquear peticiones de fuentes faltantes", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Cancelar peticiones detenidas si la fuente requerida no se encuentra localmente.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Excluir dominios de inspecciones", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Ingresar dominios a ser ignorados. Separar múltiples entradas con punto y coma (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Contador para fuentes inyectadas localmente", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Cifra de inyecciones de fuentes de Redes de Entrega de Contenido desde instalación.", + "description": "Amount injected description." + } +} diff --git a/_locales/fi/messages.json b/_locales/fi/messages.json new file mode 100644 index 0000000..34a31c4 --- /dev/null +++ b/_locales/fi/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Suojaa sinua \"ilmaisten\" keskitettyjen sisällön jakeluverkkojen jäljitykseltä.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Estä pyynnöt puuttuviin resursseihin", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Estää pyynnöt jos paikallista sisältöä ei ole saatavilla.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Poissulje verkkotunnukset", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Lisää verkkotunnus jottei sitä korvata. Erota rivit puolipisteellä (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Korvatut pyynnöt", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Korvatut sisältöpyynnöt lisäosan asennuksen jälkeen.", + "description": "Amount injected description." + } +} diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json new file mode 100644 index 0000000..388374d --- /dev/null +++ b/_locales/fr/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protège du pistage lié à l'accès à des contenus \"gratuits\", centralisés.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Bloquer les ressources manquantes", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Annuler une demande de ressource si elle est indisponible localement.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Ne pas inspecter certains domaines", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Indiquez les domaines à exclure. Séparer les noms par un point-virgule (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Compteur des ressources injectées", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Total des ressources des CDN injectées localement depuis l'installation.", + "description": "Amount injected description." + } +} diff --git a/_locales/id/messages.json b/_locales/id/messages.json new file mode 100644 index 0000000..575a316 --- /dev/null +++ b/_locales/id/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Melindungi dari pelacakan melalui distribusi konten yang bebas dan terpusat.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Blokir permintaan untuk sumber daya yang hilang", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Batalkan intersep permintaan jika sumber daya yang dibutuhkan tidak tersedia secara lokal.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Cegah inspeksi domain", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Masukkan domain ke daftar putih. Pisahkan entri dengan titik koma (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Sumber daya lokal yang disematkan", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Jumlah penyematan sumber daya Jaringan Distribusi Konten lokal sejak pemasangan.", + "description": "Amount injected description." + } +} diff --git a/_locales/it/messages.json b/_locales/it/messages.json new file mode 100644 index 0000000..199bcf5 --- /dev/null +++ b/_locales/it/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protegge dal tracciamento tramite i CDN centralizzati \"gratuiti\".", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Bloccare richieste di risorse mancanti", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Annulla la richiesta intercettata se la risorsa necessaria non è disponibile localmente.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Escludere domini dalle ispezioni", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Inserire domini nella whitelist per escluderli. Separare voci multiple con punti e virgola (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Contatore per risorse iniettate localmente", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Quantità di iniezioni di risorse dalla Rete di Distribuzione di Contenuti locale sin dall'installazione.", + "description": "Amount injected description." + } +} diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json new file mode 100644 index 0000000..2b1c22c --- /dev/null +++ b/_locales/ja/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "「無料」と称してあなたを追跡する大規模なCDNを迂回して、プライバシーを守ります。", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "アドオンに含まれないリソースへのリクエストをブロックする", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "必要なリソースがローカルで利用できない場合、リクエストを取り消します。", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "保護から除外するドメイン", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "ホワイトリストに登録したいドメインを入力してください。エントリが複数ある場合、セミコロン (;) で区切ってください。", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "ローカルのリソースを使用した回数", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "インストール後にローカルのCDNリソースを使用した回数です。", + "description": "Amount injected description." + } +} diff --git a/_locales/nl/messages.json b/_locales/nl/messages.json new file mode 100644 index 0000000..83079bb --- /dev/null +++ b/_locales/nl/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Beschermt tegen tracking via het \"gratis\", gecentraliseerd, verzorgen van content.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Stop verzoeken voor ontbrekende items", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Annuleer een onderschept verzoek wanneer het bestand niet lokaal beschikbaar is.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Sluit domeinen uit van inspecties", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Voer de te negeren domeinen in. Scheid de waarden met puntkomma's (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Teller voor lokaal geïnjecteerde bestanden", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Aantal lokale Content Delivery Network-bestandsinjecties sinds installatie.", + "description": "Amount injected description." + } +} diff --git a/_locales/pl/messages.json b/_locales/pl/messages.json new file mode 100644 index 0000000..2fb1f54 --- /dev/null +++ b/_locales/pl/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Chroni przed śledzeniem przez ośrodki CDN.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Blokuj żądania brakujących zasobów", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Anuluj przechwycone żądania jeśli wymagany zasób nie jest dostępny lokalnie.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Wyklucz domeny z analizy", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Podaj domeny aby dodać je do białej listy. Oddziel wpisy średnikami (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Licznik zasobów podanych lokalnie", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Ilość wstrzyknięć z lokalnego Content Delivery Network od czasu instalacji.", + "description": "Amount injected description." + } +} diff --git a/_locales/pt_PT/messages.json b/_locales/pt_PT/messages.json new file mode 100644 index 0000000..7186550 --- /dev/null +++ b/_locales/pt_PT/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Protege contra monitorização através de entrega de conteúdo centralizado.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Bloquear pedidos por falta de recursos", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Cancelar pedido intercetado se o recurso necessário não estiver disponível localmente.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Excluir domínios de inspeções", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Insira domínios para os colocar na lista branca. Separe múltiplas entradas com pontos e vírgulas (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Contador para recursos injetados localmente", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Quantidade de injeções de recurso Content Delivery Network locais desde a instalação.", + "description": "Amount injected description." + } +} diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json new file mode 100644 index 0000000..ab8159f --- /dev/null +++ b/_locales/ru/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Защищает Вас от отслеживания через «бесплатные», централизованные CDN.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Блокировать запросы недостающих ресурсов", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Отменить перехваченный запрос, если требуемый ресурс не доступен локально (может «ломать» сайты).", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Исключить домены из проверки", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "«Белый список» доменов. Контент, расположенный на них не будет фильтроваться. Записи (при количестве более одной) разделяются точкой с запятой (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Счётчик файлов «доставленных» локально", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Количество местных инъекций ресурсов сети доставки контента с момента установки.", + "description": "Amount injected description." + } +} diff --git a/_locales/sv/messages.json b/_locales/sv/messages.json new file mode 100644 index 0000000..88794c8 --- /dev/null +++ b/_locales/sv/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "Skyddar dig mot att spåras av \"gratis\", centraliserat, innehållsleverans.", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "Blockera förfrågningar när resurs saknas", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "Avbryt uppsnappning om resurs inte finns lokalt.", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "Utelämna domäner från uppsnappningar", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "Ange domäner för vitlistning. Spearera domänerna med semikolon (;).", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "Räknare för lokalt insatta resurser", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "Antalet insatta Content Delivery Network-resurser sedan installationen.", + "description": "Amount injected description." + } +} diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json new file mode 100644 index 0000000..097aab5 --- /dev/null +++ b/_locales/zh_CN/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "保护您免受集中式的内容交付网络(CDN)的跟踪。", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "阻止缺失资源的请求", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "取消被拦截的请求,如果请求的资源在本地不可用。", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "排除要检查的域名", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "输入白名单的域名。用分号 (;) 分隔多项。", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "本地发送资源的计数器", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "自安装以来,从本地的“内容交付网络”发送的资源总量。", + "description": "Amount injected description." + } +} diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json new file mode 100644 index 0000000..6c8b6ce --- /dev/null +++ b/_locales/zh_TW/messages.json @@ -0,0 +1,30 @@ +{ + "extensionDescription": { + "message": "保護您不受「免費」、中心化的內容傳遞網路(CDN)的追蹤。", + "description": "Extension description." + }, + "blockMissingTitle": { + "message": "封鎖缺少資源時的連線請求", + "description": "Block requests for missing resources title." + }, + "blockMissingDescription": { + "message": "若本機沒有所請求的資源,就取消該請求。", + "description": "Block requests for missing resources description." + }, + "domainWhitelistTitle": { + "message": "要排除檢查的網域", + "description": "Domain whitelist title." + }, + "domainWhitelistDescription": { + "message": "輸入網域即可將其加入白名單。使用分號(;)分隔多個網域。", + "description": "Domain whitelist description." + }, + "amountInjectedTitle": { + "message": "由本機提供的資源計數器", + "description": "Amount injected title." + }, + "amountInjectedDescription": { + "message": "安裝以來,由本機檔案所取代的 CDN 資源數量。", + "description": "Amount injected description." + } +} diff --git a/audit/README.md b/audit/README.md new file mode 100644 index 0000000..c7fdd5a --- /dev/null +++ b/audit/README.md @@ -0,0 +1,18 @@ +Introduction +------------ + +This audit script allows any user and extension reviewer to verify the integrity of the bundled resources. It automatically, and transparently, compares all bundled libraries to their original sources. + + +Usage Instructions (Unix) +------------------ + +1. Make sure you have Node.js installed on your machine. + +2. Open up a terminal and ```cd``` into this directory. + +3. Execute ```npm install``` to fetch any dependencies. + +4. Run the audit script by executing ```node run```. + +**Note:** If you'd like to save the report, run ```node run > report.txt```. \ No newline at end of file diff --git a/audit/package-lock.json b/audit/package-lock.json new file mode 100644 index 0000000..1cc810f --- /dev/null +++ b/audit/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "decentraleyes-audit", + "version": "1.4.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + } + } +} diff --git a/data/_audit/package.json b/audit/package.json similarity index 94% rename from data/_audit/package.json rename to audit/package.json index 2558466..534bad9 100644 --- a/data/_audit/package.json +++ b/audit/package.json @@ -1,6 +1,6 @@ { "name": "decentraleyes-audit", - "version": "1.4.0", + "version": "1.5.0", "author": "Thomas Rientjes", "license": "MPL-2.0", "description": "Library audit tool for Decentraleyes.", diff --git a/data/_audit/run.js b/audit/run.js similarity index 92% rename from data/_audit/run.js rename to audit/run.js index 1d03300..b20a428 100644 --- a/data/_audit/run.js +++ b/audit/run.js @@ -31,6 +31,7 @@ sourceMappingURL = require('source-map-url'); var localResourceLocation = '../resources'; var localResourceLocationLength = localResourceLocation.length; var localResourcePaths = []; +var comparedResourceAmount = 0; var resourceAmount = 0; /** @@ -41,10 +42,6 @@ function _fetchLocalResourcePaths(folderPath) { fileSystem.readdirSync(folderPath).forEach(function (resourceName) { - if (resourceName === '_audit') { - return localResourcePaths; - } - var resourcePath = folderPath + '/' + resourceName; var resourceStatistics = fileSystem.statSync(resourcePath); @@ -75,7 +72,7 @@ function _getLocalResourceContents(fileLocation, callback) { var localFileContents = buffer.toString('utf8', 0, buffer.length); - fileSystem.close(fileDescriptor); + fileSystem.close(fileDescriptor, function () {}); callback(localFileContents); }); }); @@ -156,9 +153,6 @@ function _compareResources(localResourceContents, remoteResourceContents, URL) { sourceMappingNotice = '[X] REMOTE RESOURCE HAD SOURCE MAPPING URL'; } - // Remove the syntax invalidation character from the local contents. - localResourceContents = localResourceContents.substring(1); - var localResourceHash = _hashFileContents(localResourceContents); var remoteResourceHash = _hashFileContents(remoteResourceContents); @@ -176,6 +170,8 @@ function _compareResources(localResourceContents, remoteResourceContents, URL) { console.log(); console.log('[X] LOCAL AND REMOTE RESOURCE HASHES MATCH'); console.log(sourceMappingNotice); + + _incrementComparedResourceAmount(); } function _showCompletedMessage() { @@ -186,6 +182,18 @@ function _showCompletedMessage() { console.log(); } +function _incrementComparedResourceAmount() { + + comparedResourceAmount++; + + if (comparedResourceAmount === resourceAmount) { + + setTimeout(function () { + _showCompletedMessage(); + }, 500); + } +} + /** * Initializations */ @@ -215,13 +223,6 @@ localResourcePaths.forEach(function (resourcePath, index) { console.log(); console.log('------------------------------------------'); - - if (index === resourceAmount - 1) { - - setTimeout(function () { - _showCompletedMessage(); - }, 500); - } }); }); diff --git a/chrome.manifest b/chrome.manifest deleted file mode 100644 index 474709d..0000000 --- a/chrome.manifest +++ /dev/null @@ -1,19 +0,0 @@ -locale decentraleyes bg locale/bg/ -locale decentraleyes da locale/da/ -locale decentraleyes de locale/de/ -locale decentraleyes en-GB locale/en-GB/ -locale decentraleyes en-US locale/en-US/ -locale decentraleyes eo locale/eo/ -locale decentraleyes es locale/es/ -locale decentraleyes fi locale/fi/ -locale decentraleyes fr locale/fr/ -locale decentraleyes id locale/id/ -locale decentraleyes it locale/it/ -locale decentraleyes ja locale/ja/ -locale decentraleyes nl locale/nl/ -locale decentraleyes pl locale/pl/ -locale decentraleyes pt-PT locale/pt-PT/ -locale decentraleyes ru locale/ru/ -locale decentraleyes sv-SE locale/sv-SE/ -locale decentraleyes zh-CN locale/zh-CN/ -locale decentraleyes zh-TW locale/zh-TW/ diff --git a/lib/files.js b/core/files.js similarity index 99% rename from lib/files.js rename to core/files.js index cb45448..813a1eb 100644 --- a/lib/files.js +++ b/core/files.js @@ -260,9 +260,3 @@ var files = { 'resources/webfont/1.5.10/webfont.js.dec': true, 'resources/webfont/1.5.18/webfont.js.dec': true }; - -/** - * Exports - */ - -module.exports = files; diff --git a/core/interceptor.js b/core/interceptor.js new file mode 100644 index 0000000..78cb9ae --- /dev/null +++ b/core/interceptor.js @@ -0,0 +1,119 @@ +/** + * Interceptor + * Belongs to Decentraleyes. + * + * @author Thomas Rientjes + * @since 2016-04-06 + * @license MPL 2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +'use strict'; + +/** + * Interceptor + */ + +var interceptor = {}; + +/** + * Constants + */ + +const HTTP_EXPRESSION = /^http?:\/\//; + +/** + * Public Methods + */ + +interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) { + + let validCandidate, targetDetails, targetPath; + + validCandidate = requestAnalyzer.isValidCandidate(requestDetails, tab); + + if (!validCandidate) { + + return { + 'cancel': false + }; + } + + targetDetails = requestAnalyzer.getLocalTarget(requestDetails); + targetPath = targetDetails.path; + + if (!targetPath) { + return interceptor._handleMissingCandidate(requestDetails.url); + } + + if (!files[targetPath]) { + return interceptor._handleMissingCandidate(requestDetails.url); + } + + stateManager.requests[requestDetails.requestId] = { + 'tabIdentifier': tabIdentifier, + 'targetDetails': targetDetails + }; + + return { + 'redirectUrl': chrome.extension.getURL(targetPath) + }; +}; + +/** + * Private Methods + */ + +interceptor._handleMissingCandidate = function (requestUrl) { + + if (interceptor.blockMissing === true) { + + return { + 'cancel': true + }; + } + + if (requestUrl.match(HTTP_EXPRESSION)) { + + requestUrl = requestUrl.replace(HTTP_EXPRESSION, 'https://'); + + return { + 'redirectUrl': requestUrl + }; + + } else { + + return { + 'cancel': false + }; + } +}; + +interceptor._handleStorageChanged = function (changes) { + + if ('blockMissing' in changes) { + interceptor.blockMissing = changes.blockMissing.newValue; + } +}; + +/** + * Initializations + */ + +interceptor.amountInjected = 0; +interceptor.blockMissing = false; + +chrome.storage.local.get(['amountInjected', 'blockMissing'], function (items) { + + interceptor.amountInjected = items.amountInjected || 0; + interceptor.blockMissing = items.blockMissing || false; +}); + +/** + * Event Handlers + */ + +chrome.storage.onChanged.addListener(interceptor._handleStorageChanged); diff --git a/core/main.js b/core/main.js new file mode 100644 index 0000000..d8b047d --- /dev/null +++ b/core/main.js @@ -0,0 +1,36 @@ +/** + * Entry Point + * Belongs to Decentraleyes. + * + * @author Thomas Rientjes + * @since 2016-04-04 + * @license MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +'use strict'; + +/** + * Initializations + */ + +if (typeof chrome.browserAction.setBadgeBackgroundColor !== 'function') { + + chrome.browserAction.setBadgeBackgroundColor = function () {}; + chrome.browserAction.setBadgeText = function () {}; + + chrome.browserAction.onClicked.addListener(function () { + + chrome.tabs.create({ + 'url': chrome.extension.getURL('pages/popup/popup.html'), + 'active': false + }); + }); +} + +chrome.browserAction.setBadgeBackgroundColor({ + 'color': [74, 130, 108, 255] +}); diff --git a/lib/mappings.js b/core/mappings.js similarity index 82% rename from lib/mappings.js rename to core/mappings.js index 67469b5..fca471e 100644 --- a/lib/mappings.js +++ b/core/mappings.js @@ -13,12 +13,6 @@ 'use strict'; -/** - * Imports - */ - -var resources = require('./resources'); - /** * Mappings */ @@ -50,62 +44,6 @@ var mappings = { path: 'resources/jquery/1.11.1/jquery.min.js.dec', type: 'application/javascript' }, - 'jquery/1.2/jquery.min.js': { - path: 'resources/jquery/1.2.6/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.2/jquery.js': { - path: 'resources/jquery/1.2.6/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.3/jquery.min.js': { - path: 'resources/jquery/1.3.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.3/jquery.js': { - path: 'resources/jquery/1.3.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.4/jquery.min.js': { - path: 'resources/jquery/1.4.4/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.4/jquery.js': { - path: 'resources/jquery/1.4.4/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.5/jquery.min.js': { - path: 'resources/jquery/1.5.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.5/jquery.js': { - path: 'resources/jquery/1.5.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.6/jquery.min.js': { - path: 'resources/jquery/1.6.4/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.6/jquery.js': { - path: 'resources/jquery/1.6.4/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.7/jquery.min.js': { - path: 'resources/jquery/1.7.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.7/jquery.js': { - path: 'resources/jquery/1.7.2/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.8/jquery.min.js': { - path: 'resources/jquery/1.8.3/jquery.min.js.dec', - type: 'application/javascript' - }, - 'jquery/1.8/jquery.js': { - path: 'resources/jquery/1.8.3/jquery.min.js.dec', - type: 'application/javascript' - }, 'jqueryui/1/jquery-ui.js': { path: 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec', type: 'application/javascript' @@ -139,7 +77,6 @@ var mappings = { // Microsoft Ajax CDN 'ajax.aspnetcdn.com': { '/ajax/': { - 'jQuery/jquery-{version}.': resources.jQuery, 'jquery/jquery-{version}.': resources.jQuery, 'modernizr/modernizr-{version}.': resources.modernizr } @@ -147,7 +84,6 @@ var mappings = { // Microsoft Ajax CDN [Deprecated] 'ajax.microsoft.com': { '/ajax/': { - 'jQuery/jquery-{version}.': resources.jQuery, 'jquery/jquery-{version}.': resources.jQuery, 'modernizr/modernizr-{version}.': resources.modernizr } @@ -341,9 +277,3 @@ var mappings = { } } }; - -/** - * Exports - */ - -module.exports = mappings; diff --git a/core/request-analyzer.js b/core/request-analyzer.js new file mode 100644 index 0000000..35aa68b --- /dev/null +++ b/core/request-analyzer.js @@ -0,0 +1,155 @@ +/** + * Request Analyzer + * Belongs to Decentraleyes. + * + * @author Thomas Rientjes + * @since 2016-04-11 + * @license MPL 2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +'use strict'; + +/** + * Request Analyzer + */ + +var requestAnalyzer = {}; + +/** + * Constants + */ + +const MAPPING_FILE_EXPRESSION = new RegExp('\.map$', 'i'); +const VERSION_EXPRESSION = /(?:\d{1,2}\.){1,3}\d{1,2}/; +const VERSION_PLACEHOLDER = '{version}'; +const WEB_DOMAIN_EXPRESSION = /:\/\/(.[^\/]+)(.*)/; +const WEB_PREFIX_VALUE = 'www.'; +const WEB_PREFIX_LENGTH = WEB_PREFIX_VALUE.length; + +/** + * Public Methods + */ + +requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) { + + let initiatorHost; + + try { + initiatorHost = tabDetails.url.match(WEB_DOMAIN_EXPRESSION)[1]; + } catch (exception) { + initiatorHost = 'example.org'; + } + + if (initiatorHost && requestAnalyzer.whitelistedDomains[requestAnalyzer._normalizeDomain(initiatorHost)]) { + return false; + } + + // Only requests of type GET can be valid candidates. + return requestDetails.method === 'GET'; +}; + +requestAnalyzer.getLocalTarget = function (requestDetails) { + + let destinationHost, destinationPath, hostMappings, basePath, resourceMappings; + + destinationHost = requestDetails.url.match(WEB_DOMAIN_EXPRESSION)[1]; + destinationPath = requestDetails.url.match(WEB_DOMAIN_EXPRESSION)[2]; + + // Use the proper mappings for the targeted host. + hostMappings = mappings[destinationHost]; + + // Resource mapping files are never locally available. + if (MAPPING_FILE_EXPRESSION.test(destinationPath)) { + return false; + } + + basePath = requestAnalyzer._matchBasePath(hostMappings, destinationPath); + resourceMappings = hostMappings[basePath]; + + if (!resourceMappings) { + return false; + } + + // Return either the local target's path or false. + return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath); +}; + +/** + * Private Methods + */ + +requestAnalyzer._matchBasePath = function (hostMappings, channelPath) { + + for (let basePath of Object.keys(hostMappings)) { + + if (channelPath.startsWith(basePath)) { + return basePath; + } + } + + return false; +}; + +requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath) { + + var resourcePath, versionNumber, resourcePattern; + + resourcePath = channelPath.replace(basePath, ''); + + versionNumber = resourcePath.match(VERSION_EXPRESSION); + resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER); + + for (let resourceMold of Object.keys(resourceMappings)) { + + if (resourcePattern.startsWith(resourceMold)) { + + let targetPath = resourceMappings[resourceMold].path; + targetPath = targetPath.replace(VERSION_PLACEHOLDER, versionNumber); + + // Prepare and return a local target. + return { + source: channelHost, + version: versionNumber[0], + path: targetPath + }; + } + } + + return false; +}; + +requestAnalyzer._applyWhitelistedDomains = function () { + + //noinspection JSUnresolvedVariable + chrome.storage.local.get('whitelistedDomains', function (items) { + requestAnalyzer.whitelistedDomains = items.whitelistedDomains || {}; + }); +}; + +requestAnalyzer._normalizeDomain = function (domain) { + + domain = domain.toLowerCase().trim(); + + if (domain.startsWith(WEB_PREFIX_VALUE)) { + domain = domain.slice(WEB_PREFIX_LENGTH); + } + + return domain; +}; + +/** + * Initializations + */ + +requestAnalyzer.whitelistedDomains = {}; +requestAnalyzer._applyWhitelistedDomains(); + +/** + * Event Handlers + */ + +chrome.storage.onChanged.addListener(requestAnalyzer._applyWhitelistedDomains); diff --git a/lib/resources.js b/core/resources.js similarity index 98% rename from lib/resources.js rename to core/resources.js index 678e3fb..76b8d06 100644 --- a/lib/resources.js +++ b/core/resources.js @@ -90,9 +90,3 @@ var resources = { type: 'application/javascript' } }; - -/** - * Exports - */ - -module.exports = resources; diff --git a/core/state-manager.js b/core/state-manager.js new file mode 100644 index 0000000..af376a6 --- /dev/null +++ b/core/state-manager.js @@ -0,0 +1,212 @@ +/** + * State Manager + * Belongs to Decentraleyes. + * + * @author Thomas Rientjes + * @since 2017-03-10 + * @license MPL 2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +'use strict'; + +/** + * State Manager + */ + +var stateManager = {}; + +/** + * Constants + */ + +const BLOCKING_ACTION = 'blocking'; +const HOST_PREFIX = '*://'; +const HOST_SUFFIX = '/*'; +const JAVASCRIPT_REQUEST_TYPE = 'script'; +const REQUEST_HEADERS = 'requestHeaders'; +const XML_HTTP_REQUEST_TYPE = 'xmlhttprequest'; + +/** + * Public Methods + */ + +stateManager.registerInjection = function (tabIdentifier, injection) { + + let injectionIdentifier, registeredTab, injectionCount; + + injectionIdentifier = injection.source + injection.path + injection.version; + registeredTab = stateManager.tabs[tabIdentifier]; + + registeredTab.injections[injectionIdentifier] = injection; + injectionCount = Object.keys(registeredTab.injections).length || 0; + + if (injectionCount > 0) { + + chrome.browserAction.setBadgeText({ + tabId: tabIdentifier, + text: injectionCount.toString() + }); + + } else { + + chrome.browserAction.setBadgeText({ + tabId: tabIdentifier, + text: '' + }); + } + + if (isNaN(interceptor.amountInjected)) { + + chrome.storage.local.get('amountInjected', function (items) { + + interceptor.amountInjected = items.amountInjected; + + chrome.storage.local.set({ + 'amountInjected': ++interceptor.amountInjected + }); + }); + + } else { + + chrome.storage.local.set({ + 'amountInjected': ++interceptor.amountInjected + }); + } +}; + +/** + * Private Methods + */ + +stateManager._createTab = function (tab) { + + let tabIdentifier, requestFilters; + + tabIdentifier = tab.id; + + stateManager.tabs[tabIdentifier] = { + 'injections': {} + }; + + requestFilters = { + + 'tabId': tabIdentifier, + 'types': stateManager.validTypes, + 'urls': stateManager.validHosts + }; + + chrome.webRequest.onBeforeRequest.addListener(function (requestDetails) { + + return new Promise((resolve) => { + + browser.tabs.get(tabIdentifier).then(function (tab) { + resolve(interceptor.handleRequest(requestDetails, tabIdentifier, tab)); + }); + }); + + }, requestFilters, [BLOCKING_ACTION]); +}; + +stateManager._removeTab = function (tabIdentifier) { + delete stateManager.tabs[tabIdentifier]; +}; + +stateManager._updateTab = function (details) { + + let tabIdentifier, frameIdentifier; + + tabIdentifier = details.tabId; + frameIdentifier = details.frameId; + + if (tabIdentifier === -1 || frameIdentifier !== 0) { + return; + } + + chrome.browserAction.setBadgeText({ + tabId: tabIdentifier, + text: '' + }); + + if (stateManager.tabs[tabIdentifier]) { + stateManager.tabs[tabIdentifier].injections = {}; + } +}; + +/** + * Initializations + */ + +stateManager.requests = {}; +stateManager.tabs = {}; + +stateManager.validTypes = [ + + JAVASCRIPT_REQUEST_TYPE, + XML_HTTP_REQUEST_TYPE +]; + +stateManager.validHosts = []; + +for (let mapping in mappings) { + + if (!mappings.hasOwnProperty(mapping)) { + continue; + } + + let supportedHost = HOST_PREFIX + mapping + HOST_SUFFIX; + stateManager.validHosts.push(supportedHost); +} + +chrome.tabs.query({}, function (tabs) { + tabs.forEach(stateManager._createTab); +}); + +/** + * Event Handlers + */ + +chrome.tabs.onCreated.addListener(stateManager._createTab); +chrome.tabs.onRemoved.addListener(stateManager._removeTab); + +chrome.webNavigation.onCommitted.addListener(stateManager._updateTab, { + url: [{urlContains: ':'}] +}); + +chrome.webRequest.onErrorOccurred.addListener(function (requestDetails) { + + if (stateManager.requests[requestDetails.requestId]) { + delete stateManager.requests[requestDetails.requestId]; + } + +}, {'urls': ['*://*/*']}); + +chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) { + + let knownRequest = stateManager.requests[requestDetails.requestId]; + + if (knownRequest) { + + stateManager.registerInjection(knownRequest.tabIdentifier, knownRequest.targetDetails); + delete stateManager.requests[requestDetails.requestId]; + } + +}, {'urls': ['*://*/*']}); + +chrome.webRequest.onBeforeSendHeaders.addListener(function (requestDetails) { + + for (let i = 0; i < requestDetails.requestHeaders.length; ++i) { + + if (requestDetails.requestHeaders[i].name === 'Origin') { + requestDetails.requestHeaders.splice(i, 1); + } else if (requestDetails.requestHeaders[i].name === 'Referer') { + requestDetails.requestHeaders.splice(i, 1); + } + } + + return {requestHeaders: requestDetails.requestHeaders}; + +}, {urls: stateManager.validHosts}, [BLOCKING_ACTION, REQUEST_HEADERS]); diff --git a/data/_audit/README.md b/data/_audit/README.md deleted file mode 100644 index b8d5a7b..0000000 --- a/data/_audit/README.md +++ /dev/null @@ -1,29 +0,0 @@ -INTRODUCTION ------------- - -This script (first introduced in Decentraleyes v1.1.5) should make reviewing this extension a lot easier than it used to be. It's open source and open for scrutiny, and it automatically compares the bundled libraries (resources) to their original sources (after removing any source mapping URLs). - - -FOR NON-LINUX USERS -------------------- - -This usage guide is tailored to Linux based operating systems. If you're on a different type of system, the easiest direct solution might be to launch a free Linux box with Node.js pre-installed on Red Hat OpenShift. You can then SSH into it (after adding your own machine's public key to your account). - -Having said that, every terminal command in the usage guide below comes with a description, so it should not be too hard to get this done on practically any type of configuration. - - -USAGE INSTRUCTIONS ------------------- - -1. Make sure you have Node.js installed on your machine (or install it). - -2. Open up a terminal and 'cd' into this directory. - Description: Navigate to this directory. - -3. Execute 'npm install' to fetch any dependencies. - -4. Run the audit script by executing 'node run'. - Description: Run the script through Node.js and view the output. - -Note: If you'd like to store the report, run 'node run > report.txt'. - Note description: It's possible to write the console output to a file. diff --git a/data/resources/backbone.js/1.0.0/backbone-min.js.dec b/data/resources/backbone.js/1.0.0/backbone-min.js.dec deleted file mode 100644 index 5425c89..0000000 --- a/data/resources/backbone.js/1.0.0/backbone-min.js.dec +++ /dev/null @@ -1 +0,0 @@ -@(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$('