-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lots of various improvements.. #283
Open
warren-bank
wants to merge
36
commits into
privacypass:master
Choose a base branch
from
warren-bank:PR/v3-rc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,843
−3,554
Open
Changes from 11 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1931272
minor configuration updates
warren-bank a623dee
work in progress..
warren-bank 59e01e2
work in progress..
warren-bank c9b0c40
work in progress..
warren-bank 6af07f7
work in progress..
warren-bank 4b7beb1
work in progress..
warren-bank 70ec3f1
work in progress..
warren-bank 06222cc
work in progress..
warren-bank a4e23fb
work in progress..
warren-bank 00cba76
v3.3.0 w/ Cloudflare and hCaptcha providers
warren-bank 6fe4c6c
update jest configs for testing and fix all tests to pass
warren-bank 578a97b
v3.3.1 w/ minified ES5
warren-bank 929cabd
v3.3.2 w/ minified ES5
warren-bank b9df538
minor configuration updates
warren-bank cf7144c
refactor and improve the dist/.bin build scripts
warren-bank 2f3fad0
work in progress..
warren-bank e101fc7
hCaptcha sends issuing requests from 'onCompleted' hook function
warren-bank 615f189
minor css tweak to popup window
warren-bank 37a5271
minor updates to the 'dist/.bin' build scripts
warren-bank 706a9e7
minor updates to the 'dist/.bin' build scripts
warren-bank baa5e80
add popup menu buttons to backup and restore tokens in local storage
warren-bank b889333
minor updates to the 'dist/.bin' build scripts
warren-bank 8d57b84
fix hCaptcha redemption
warren-bank 1f84b01
minor refactoring
warren-bank bf6d1ae
address race-condition: delay blocking async code by next-tick timer
warren-bank 48f5e14
revert hCaptcha and refactor Cloudflare
warren-bank 71e4b54
detect and fix incorrect requests on Cloudflare issuing domain
warren-bank 3e39527
fix: use feature detection so browser compatability isn't reduced
warren-bank 84ea20b
fix a conditional statement that may effect Cloudflare token issuing
warren-bank 29febe8
minor refactoring
warren-bank 8283f46
add static helper method: "getNormalizedFormData"
warren-bank 0ab56ce
fix the ability to restore tokens from a JSON text file
warren-bank 7057859
add i18n translations using IBM Watson Language Translator service
warren-bank 6ee36f8
minor html/css tweak to popup window
warren-bank 333f32b
accomodate for changes to Cloudflare provider backend
warren-bank ad517dd
CF: normalize name of querystring parameter in request to issue tokens
warren-bank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo off | ||
|
||
set CHROME_HOME=C:\PortableApps\Google Chrome\97.0.4692.71\App\Chrome-bin | ||
set CHROME_HOME=C:\PortableApps\SRWare Iron\85.0.4350.0\Iron | ||
set PATH=%CHROME_HOME%;%PATH% | ||
|
||
cd /D "%~dp0..\.." | ||
|
||
set ext_dir="%cd%\PrivacyPass" | ||
set ext_key="%cd%\PrivacyPass.pem" | ||
|
||
if exist %ext_key% ( | ||
chrome --pack-extension=%ext_dir% --pack-extension-key=%ext_key% | ||
) else ( | ||
chrome --pack-extension=%ext_dir% | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# configuration | ||
|
||
CHROME_HOME='/c/PortableApps/Google Chrome/97.0.4692.71/App/Chrome-bin' | ||
CHROME_HOME='/c/PortableApps/SRWare Iron/85.0.4350.0/Iron' | ||
PATH="${CHROME_HOME}:${PATH}" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# bootstrap | ||
|
||
function main { | ||
cd "${DIR}/../.." | ||
cwd=$(realpath .) | ||
ext_dir="${cwd}/PrivacyPass" | ||
ext_key="${cwd}/PrivacyPass.pem" | ||
|
||
if [ -f "$ext_key" ];then | ||
chrome "--pack-extension=${ext_dir}" "--pack-extension-key=${ext_key}" | ||
else | ||
chrome "--pack-extension=${ext_dir}" | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# configuration | ||
|
||
OPENSSL_HOME='/c/PortableApps/OpenSSL/1.1.0' | ||
PATH="${OPENSSL_HOME}:${PATH}" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Source: https://stackoverflow.com/a/18709204 | ||
# Purpose: Pack a Chromium extension directory into crx format | ||
# notes: all temporary files are created in the cwd. | ||
# the final crx is created adjacent to the input extension directory. | ||
|
||
function pack_crx3 { | ||
if test $# -ne 2; then | ||
echo "Usage: crxmake.sh <extension dir> <pem path>" | ||
exit 1 | ||
fi | ||
|
||
ext_dir=$1 | ||
ext_key=$2 | ||
crx="${ext_dir}.crx" | ||
name=$(basename "$ext_dir") | ||
pub="${name}.pub" | ||
sig="${name}.sig" | ||
zip="${name}.zip" | ||
tosign="${name}.presig" | ||
binary_crx_id="${name}.crxid" | ||
|
||
echo "writing '${name}.crx'" | ||
|
||
# preparation: remove previous crx | ||
rm -f "$crx" | ||
|
||
# preparation: remove all previous temporary files in the cwd | ||
rm -f "$pub" "$sig" "$zip" "$tosign" "$binary_crx_id" | ||
|
||
# cleanup: remove all temporary files in the cwd | ||
trap 'rm -f "$pub" "$sig" "$zip" "$tosign" "$binary_crx_id"' EXIT | ||
|
||
# zip up the crx dir | ||
cwd=$(pwd -P) | ||
(cd "$ext_dir" && zip -qr -9 -X "${cwd}/${zip}" .) | ||
|
||
#extract crx id | ||
openssl rsa -in "$ext_key" -pubout -outform der | openssl dgst -sha256 -binary -out "$binary_crx_id" | ||
truncate -s 16 "$binary_crx_id" | ||
|
||
#generate file to sign | ||
( | ||
# echo "$crmagic_hex $version_hex $header_length $pub_len_hex $sig_len_hex" | ||
printf "CRX3 SignedData" | ||
echo "00 12 00 00 00 0A 10" | xxd -r -p | ||
cat "$binary_crx_id" "$zip" | ||
) > "$tosign" | ||
|
||
# signature | ||
openssl dgst -sha256 -binary -sign "$ext_key" < "$tosign" > "$sig" | ||
|
||
# public key | ||
openssl rsa -pubout -outform DER < "$ext_key" > "$pub" 2>/dev/null | ||
|
||
crmagic_hex='43 72 32 34' # Cr24 | ||
version_hex='03 00 00 00' # 3 | ||
header_length='45 02 00 00' | ||
header_chunk_1='12 AC 04 0A A6 02' | ||
header_chunk_2='12 80 02' | ||
header_chunk_3='82 F1 04 12 0A 10' | ||
( | ||
echo "${crmagic_hex} ${version_hex} ${header_length} ${header_chunk_1}" | xxd -r -p | ||
cat "$pub" | ||
echo "$header_chunk_2" | xxd -r -p | ||
cat "$sig" | ||
echo "$header_chunk_3" | xxd -r -p | ||
cat "$binary_crx_id" "$zip" | ||
) > "$crx" | ||
|
||
echo 'success: crx3 Chrome extension has been packed' | ||
} | ||
|
||
# ------------------------------------------------------------------------------ | ||
# bootstrap | ||
|
||
function main { | ||
cd "${DIR}/../.." | ||
cwd=$(pwd -P) | ||
ext_dir="${cwd}/PrivacyPass" | ||
ext_key="${cwd}/PrivacyPass.pem" | ||
|
||
TMP="${DIR}/temp" | ||
[ -d "$TMP" ] && rm -rf "$TMP" | ||
mkdir "$TMP" | ||
|
||
cd "$TMP" | ||
pack_crx3 "$ext_dir" "$ext_key" | ||
|
||
# cleanup: remove temporary directory | ||
cd "$DIR" | ||
rm -rf "$TMP" | ||
} | ||
|
||
main |
62 changes: 62 additions & 0 deletions
62
.bin/firefox/docs/installing-unsigned-extensions-permanently-to-firefox.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
- - - - | ||
|
||
# Add-on signing in Firefox | ||
|
||
### What are my options if I want to use an unsigned add-on? | ||
|
||
Firefox [Extended Support Release (ESR)](https://www.mozilla.org/firefox/organizations/), Firefox [Developer Edition](https://www.mozilla.org/firefox/developer/) and [Nightly](https://nightly.mozilla.org/) versions of Firefox will allow you to override the setting to enforce the extension signing requirement, by changing the preference `xpinstall.signatures.required` to __false__ in the [Firefox Configuration Editor](https://support.mozilla.org/en-US/kb/about-config-editor-firefox) (`about:config` page). To override the language pack signing requirement, you would set the preference `extensions.langpacks.signatures.required` to __false__. There are also special unbranded versions of Firefox that allow this override. See the MozillaWiki article, [Add-ons/Extension Signing](https://wiki.mozilla.org/Add-ons/Extension_Signing) for more information. | ||
|
||
> The source of this post can be found: | ||
> * [here](https://support.mozilla.org/en-US/kb/add-on-signing-in-firefox?#w_what-are-my-options-if-i-want-to-use-an-unsigned-add-on-advanced-users) in HTML format | ||
|
||
- - - - | ||
|
||
# Installing unsigned extensions permanently to Firefox | ||
|
||
<small>2020-11-26</small> | ||
|
||
If you have worked with browser extension on Firefox, you likely go to `about:debugging` for installing the extensions temporary, while useful for development, the extension gets removed once Firefox restarts. | ||
|
||
Sometimes you may need to test how the extension behaves when Firefox starts, or, just want to leave your extension installed without signing it with the Developer Hub. | ||
|
||
|
||
## Summary | ||
|
||
Gladly, there is a simple solution: | ||
1. Update your extension manifest to include custom `browser_specific_settings`. | ||
2. Disable signature checks while installing extensions. | ||
3. Package your extension as a zip file. | ||
4. Install the extension. | ||
5. Enable signature checks while installing extensions. | ||
|
||
|
||
### Step 1 | ||
Update your `manifest.json` to include a new key, the `id` could be any email: | ||
|
||
```json | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
} | ||
``` | ||
|
||
### Step 2 | ||
Go to `about:config`, change `xpinstall.signatures.required` to `false`. | ||
|
||
### Step 3 | ||
Simply run `zip -r -FS ../my-extension.zip * --exclude '*.git*'`. | ||
|
||
### Step 4 | ||
Go to `about:addons`, and choose the `Install Add-on from file` option, choose the zip file created in the previous step. | ||
|
||
### Step 5 | ||
Go to `about:config`, change `xpinstall.signatures.required` to `true`. | ||
|
||
That's it, you have installed an unsigned extension permanently. | ||
|
||
> The source of this post can be found: | ||
> * [here](https://wiringbits.net/browser-extensions/2020/11/27/installing-unsigned-extensions-permanently-to-firefox.html) in HTML format | ||
> * [here](https://github.com/wiringbits/wiringbits.github.io/blob/4f08ae14f53df32809420675d36b21deca081401/_posts/2020-11-26-installing-unsigned-extensions-permanently-to-firefox.md) in Markdown format | ||
|
||
- - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@echo off | ||
|
||
set ZIP7_HOME=C:\PortableApps\7-Zip\16.02\App\7-Zip64 | ||
set PATH=%ZIP7_HOME%;%PATH% | ||
|
||
cd /D "%~dp0..\.." | ||
|
||
set ext_name=PrivacyPass | ||
set xpi_file="%cd%\%ext_name%.xpi" | ||
|
||
cd "%ext_name%" | ||
|
||
rem :: https://sevenzip.osdn.jp/chm/cmdline/index.htm | ||
rem :: https://sevenzip.osdn.jp/chm/cmdline/commands/add.htm | ||
7z a -tzip %xpi_file% -r . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# bootstrap | ||
|
||
function main { | ||
cd "${DIR}/../.." | ||
cwd=$(pwd -P) | ||
ext_name='PrivacyPass' | ||
xpi_file="${cwd}/${ext_name}.xpi" | ||
|
||
cd "$ext_name" | ||
|
||
# https://extensionworkshop.com/documentation/publish/package-your-extension/#package-linux | ||
zip -r -FS "$xpi_file" * | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* text=auto | ||
|
||
*.cmd text eol=crlf | ||
*.bat text eol=crlf | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
*.swp | ||
/node_modules | ||
/dist | ||
/lib | ||
node_modules/ | ||
lib/ | ||
PrivacyPass/ | ||
PrivacyPass.pem | ||
PrivacyPass.crx | ||
PrivacyPass.xpi | ||
|
||
.bin/**/temp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2017-2020, Privacy Pass Team, Cloudflare, Inc., and other contributors. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
// Mocking crypto with Node webcrypto API. | ||
|
||
// Requires Node v15.0+ | ||
// https://nodejs.org/api/crypto.html#cryptowebcrypto | ||
|
||
import { webcrypto } from 'crypto'; | ||
|
||
if (typeof crypto === 'undefined') { | ||
global.crypto = (webcrypto as unknown) as Crypto | ||
global.crypto = (webcrypto as unknown) as Crypto; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change the name to
PrivacyPass
? I think the namePrivacyPass
doesn't indicate that the files in the directory are generated files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because when Chrome is used to pack an extension, both the name of the .crx and the .pem are expected to be the same as the input directory (all siblings)..
.gitignore
allows the .pem to be permanently homed where Chrome expects it to be.. without ever being commit to version control.. and likewise, the generated .crx and .xpi files won't eitherthis naming convention is associated with the scripts in the
.bin
directory.. if you already have tools that you use to package your extensions, then.. you:.bin
directoryThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another option.. which might be preferable.. would be to:
.bin
directory todist/.bin
dist/PrivacyPass
.gitignore
to exclude:dist/PrivacyPass
anddist/PrivacyPass.[pem|crx|xpi]
so all output.. and my scripts to pack the output into extensions.. would be confined under
dist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update:
That last suggestion seemed (to me) as a much cleaner option.. so I just pushed a commit to make those changes.