Skip to content

Commit 6c1c8de

Browse files
committed
Merge branch 'master' of github.com:EFForg/https-everywhere
2 parents 60700a7 + 04d9431 commit 6c1c8de

File tree

1,968 files changed

+4116
-38926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,968 files changed

+4116
-38926
lines changed

.github/PULL_REQUEST_TEMPLATE/existing_contributors.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/actions/https-everywhere-labeller/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/https-everywhere-labeller/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"homepage": "https://github.com/eff/https-everywhere-labeller#readme",
1616
"dependencies": {
17-
"@actions/core": "^1.2.3",
17+
"@actions/core": "^1.2.6",
1818
"@actions/github": "^2.1.1",
1919
"express": "^4.17.1",
2020
"@octokit/rest": "^17.1.4",

.github/pull_request_template.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
***Delete section if irrelevant***
1+
Fixes #(issue)
22

3-
### List related PRs if any
3+
## Type of change
44

5-
- pr link
5+
- [ ] Bug fix (non-breaking change which fixes an issue)
6+
- [ ] New feature (non-breaking change which adds functionality)
7+
- [ ] Refactoring existing code
8+
- [ ] New Ruleset
9+
- [ ] Existing Ruleset
610

7-
### List related issues if any
11+
## For Rulesets: Testing
812

9-
- issue link
13+
- [ ] Travis CI completed without errors (triggered upon pull request)
1014

11-
***May delete note after reading***
12-
13-
### Note to contributor:
14-
Thank you for contributing! If this is a new ruleset and your first time contributing, congratulations! There will be some tests ran through our continuous integration in Travis. For example, checking for duplicate hosts, problematic hosts, etc. in the ruleset file. You will see this testing begin when you open this pull request.
15-
16-
If this is not your first time and you have open PRs that have not been closed or merged, please revisit them by searching: `https://github.com/EFForg/https-everywhere/issues?q=is%3Aopen+assignee%3A[yourusernamehere]`. If there is something not being addressed by other maintainers or a project lead, link them to the PR with your question. Thank you for your patience.
17-
18-
More helpful filters in Pull Request search:
19-
- Changes requested:
20-
`is:pr is:open type:pr review:changes_requested author:[your username]`
21-
- Updated from specific date:
22-
`is:pr updated:>yyyy-mm-dd`
23-
- Merged PRs:
24-
`is:pr is:merged author:[your username]`
25-
- Approved PRs:
26-
`is:pr review:approved author:[your username]`
15+
## Existing Contributors
16+
If you have open PRs that have not been closed or merged, please revisit them by searching: `https://github.com/EFForg/https-everywhere/issues?q=is%3Aopen+assignee%3A[yourusernamehere]`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/EFForg/https-everywhere.svg?branch=master)](https://travis-ci.org/EFForg/https-everywhere)
1+
[![Build Status](https://travis-ci.com/EFForg/https-everywhere.svg?branch=master)](https://travis-ci.com/EFForg/https-everywhere)
22
[![Coverage Status](https://coveralls.io/repos/github/EFForg/https-everywhere/badge.svg?branch=master)](https://coveralls.io/github/EFForg/https-everywhere?branch=master)
33

44
# Getting Started With HTTPS Everywhere

browser-dist/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Browser Distribution Special Cases
2+
3+
## Edge
4+
5+
Case:
6+
Edge does not accept CRX files for direct upload to store.
7+
8+
Work around: `edge.sh`
9+
10+
## Opera
11+
12+
Case:
13+
Opera does not accept `default.rulesets` due to strict MIME type restriction
14+
15+
In order to not disrupt many downstream channels, we are building a separate CRX file for Opera for now.
16+
17+
Work around: `opera.sh`
18+
19+
## Build process
20+
21+
These scripts are normally ran after main build and deployment is finished. The reason being we want a confirmed CRX file upload to Chrome to build the Edge zip and Opera crx distributions on.
22+
23+
## CRX Verification of Files before Upload
24+
25+
Install Node Package for CRX Verification via NPM
26+
`[sudo] npm -g i crx3-utils`
27+
28+
### Verify CRX file
29+
30+
1. `crx3-info rsa 0 < $crx > public.pem`
31+
2. `crx3-verify rsa 0 public.pem < $crx`
32+
3. `echo "CRX verified"`

edge.sh renamed to browser-dist/edge.sh

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
#!/bin/bash
22
# Written for transparency and reproducibility on Edge upload
3+
# See browser-dist.md for more info
34

4-
# Install Node Package for CRX Verification via NPM
5-
# [sudo] npm -g i crx3-utils
6-
7-
# Verify CRX file
8-
# crx3-info rsa 0 < $crx_cws > public.pem
9-
# crx3-verify rsa 0 public.pem < $crx_cws
10-
# echo "CRX verified"
11-
12-
VERSION=`python3.6 -c "import json ; print(json.loads(open('chromium/manifest.json').read())['version'])"`
13-
crx_cws="pkg/https-everywhere-$VERSION-cws.crx"
14-
crx_eff="pkg/https-everywhere-$VERSION-eff.crx"
5+
VERSION=`python3.6 -c "import json ; print(json.loads(open('../chromium/manifest.json').read())['version'])"`
6+
crx_cws="../pkg/https-everywhere-$VERSION-cws.crx"
7+
crx_eff="../pkg/https-everywhere-$VERSION-eff.crx"
158

169
crx3-info rsa 0 < $crx_cws > public.pem
1710
crx3-verify rsa 0 public.pem < $crx_cws
@@ -24,7 +17,7 @@ crx3-info < $crx_eff | awk '/^header/ {print $2}' \
2417

2518
echo >&2 "Edge zip package has sha256sum: `openssl dgst -sha256 -binary "https-everywhere-$VERSION-edge.zip" | xxd -p`"
2619

27-
mv https-everywhere-$VERSION-edge.zip pkg/https-everywhere-$VERSION-edge.zip
20+
mv https-everywhere-$VERSION-edge.zip ../pkg/https-everywhere-$VERSION-edge.zip
2821

2922
echo "Created pkg/https-everywhere-$VERSION-edge.zip"
3023

browser-dist/opera.sh

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/usr/bin/env bash
2+
3+
# Build an HTTPS Everywhere Opera CRX Distribution
4+
# Written for transparency and reproducibility on Opera upload
5+
# See browser-dist.md for more info
6+
7+
# To build the current state of the tree:
8+
#
9+
# ./browser-dist-opera.sh
10+
#
11+
# To build a particular tagged release:
12+
#
13+
# ./browser-dist-opera.sh <version number>
14+
#
15+
# eg:
16+
#
17+
# ./browser-dist-opera.sh 2017.8.15
18+
#
19+
# Note that .crx files must be signed; this script makes you a
20+
# "dummy-chromium.pem" private key for you to sign your own local releases,
21+
# but these .crx files won't detect and upgrade to official HTTPS Everywhere
22+
# releases signed by EFF :/. We should find a more elegant arrangement.
23+
24+
! getopt --test > /dev/null
25+
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
26+
echo 'I’m sorry, `getopt --test` failed in this environment.'
27+
exit 1
28+
fi
29+
30+
OPTIONS=eck:
31+
LONGOPTS=remove-extension-update,remove-update-channels,key:
32+
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
33+
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
34+
# e.g. return value is 1
35+
# then getopt has complained about wrong arguments to stdout
36+
exit 2
37+
fi
38+
39+
# read getopt’s output this way to handle the quoting right:
40+
eval set -- "$PARSED"
41+
42+
REMOVE_EXTENSION_UPDATE=false
43+
REMOVE_UPDATE_CHANNELS=false
44+
KEY=$(pwd)/dummy-chromium.pem
45+
while true; do
46+
case "$1" in
47+
-e|--remove-extension-update)
48+
REMOVE_EXTENSION_UPDATE=true
49+
shift
50+
;;
51+
-c|--remove-update-channels)
52+
REMOVE_UPDATE_CHANNELS=true
53+
shift
54+
;;
55+
-k|--key)
56+
KEY="$2"
57+
shift 2
58+
;;
59+
--)
60+
shift
61+
break
62+
;;
63+
*)
64+
echo "Programming error"
65+
exit 3
66+
;;
67+
esac
68+
done
69+
70+
if [ "${KEY:0:1}" != "/" ]; then
71+
echo "Key must be specified as an absolute path."
72+
exit 4
73+
fi
74+
75+
cd $(dirname $0)
76+
77+
if [ -n "$1" ]; then
78+
BRANCH=`git branch | head -n 1 | cut -d \ -f 2-`
79+
SUBDIR=checkout
80+
[ -d $SUBDIR ] || mkdir $SUBDIR
81+
cp -r -f -a .git $SUBDIR
82+
cd $SUBDIR
83+
git reset --hard "$1"
84+
git submodule update --recursive -f
85+
fi
86+
87+
VERSION=`python3.6 -c "import json ; print(json.loads(open('../chromium/manifest.json').read())['version'])"`
88+
89+
echo "Building version" $VERSION
90+
91+
[ -d pkg ] || mkdir -p ../pkg
92+
[ -e pkg/crx-opera ] && rm -rf ../pkg/crx-opera
93+
94+
# Clean up obsolete ruleset databases, just in case they still exist.
95+
rm -f src/chrome/content/rules/default.rulesets src/defaults/rulesets.sqlite
96+
97+
mkdir -p ../pkg/crx-opera/rules
98+
cd ../pkg/crx-opera
99+
cp -a ../../chromium/* ./
100+
# Turn the Firefox translations into the appropriate Chrome format:
101+
rm -rf _locales/
102+
mkdir _locales/
103+
python3.6 ../../utils/chromium-translations.py ../../translations/ _locales/
104+
python3.6 ../../utils/chromium-translations.py ../../src/chrome/locale/ _locales/
105+
do_not_ship="*.py *.xml"
106+
rm -f $do_not_ship
107+
108+
mkdir wasm
109+
cp ../../lib-wasm/pkg/*.wasm wasm
110+
cp ../../lib-wasm/pkg/*.js wasm
111+
112+
cd ../..
113+
114+
python3.6 ./utils/merge-rulesets.py || exit 5
115+
116+
cp src/chrome/content/rules/default.rulesets.json pkg/crx-opera/rules/default.rulesets.json
117+
118+
sed -i -e "s/VERSION/$VERSION/g" pkg/crx-opera/manifest.json
119+
120+
for x in `cat .build_exclusions`; do
121+
rm -rf pkg/crx-opera/$x
122+
done
123+
124+
#Create Opera CRX caveat
125+
cd pkg/crx-opera
126+
sed -i 's/rules\/default.rulesets/rules\/default.rulesets.json/g' background-scripts/update.js
127+
cd ../..
128+
129+
# Remove the 'applications' manifest key from the crx version of the extension, change the 'author' string to a hash, and add the "update_url" manifest key
130+
# "update_url" needs to be present to avoid problems reported in https://bugs.chromium.org/p/chromium/issues/detail?id=805755
131+
python3.6 -c "import json; m=json.loads(open('pkg/crx-opera/manifest.json').read()); m['author']={'email': 'eff.software.projects@gmail.com'}; del m['applications']; open('pkg/crx-opera/manifest.json','w').write(json.dumps(m,indent=4,sort_keys=True))"
132+
133+
# If the --remove-update-channels flag is set, remove all out-of-band update channels
134+
if $REMOVE_UPDATE_CHANNELS; then
135+
echo "Flag --remove-update-channels specified. Removing all out-of-band update channels."
136+
echo "require.scopes.update_channels.update_channels = [];" >> pkg/crx-opera/background-scripts/update_channels.js
137+
fi
138+
139+
if [ -n "$BRANCH" ] ; then
140+
crx_opera="pkg/https-everywhere-$VERSION-opera.crx"
141+
else
142+
crx_opera="pkg/https-everywhere-$VERSION-pre-opera.crx"
143+
fi
144+
if ! [ -f "$KEY" ] ; then
145+
echo "Making a dummy signing key for local build purposes"
146+
openssl genrsa -out /tmp/dummy-chromium.pem 768
147+
openssl pkcs8 -topk8 -nocrypt -in /tmp/dummy-chromium.pem -out $KEY
148+
fi
149+
150+
# now pack the crx'es
151+
BROWSER="chromium-browser"
152+
which $BROWSER || BROWSER="chromium"
153+
154+
$BROWSER --no-message-box --pack-extension="pkg/crx-opera" --pack-extension-key="$KEY" 2> /dev/null
155+
156+
mv pkg/crx-opera.crx $crx_opera
157+
158+
echo >&2 "Opera crx package has sha256sum: `openssl dgst -sha256 -binary "$crx_opera" | xxd -p`"
159+
echo >&2 "Total included rules: `find src/chrome/content/rules -name "*.xml" | wc -l`"
160+
echo >&2 "Rules disabled by default: `find src/chrome/content/rules -name "*.xml" | xargs grep -F default_off | wc -l`"
161+
162+
echo "Created $crx_opera"
163+
164+
if [ -n "$BRANCH" ]; then
165+
cd ..
166+
cp $SUBDIR/$crx_opera pkg
167+
rm -rf $SUBDIR
168+
fi

chromium/background-scripts/background.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,18 @@ function updateState () {
181181
title: 'HTTPS Everywhere' + ((iconState === 'active') ? '' : ' (' + iconState + ')')
182182
});
183183

184-
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
185-
if (!tabs || tabs.length === 0) {
184+
const chromeUrl = 'chrome://';
185+
186+
chrome.tabs.query({ active: true, currentWindow: true, status: 'complete' }, function(tabs) {
187+
if (!tabs || tabs.length === 0 || tabs[0].url.startsWith(chromeUrl) ) {
186188
return;
187189
}
190+
191+
// tabUrl.host instead of hostname should be used to show the "disabled" status properly (#19293)
188192
const tabUrl = new URL(tabs[0].url);
189-
const hostname = util.getNormalisedHostname(tabUrl.hostname);
193+
const host = util.getNormalisedHostname(tabUrl.host);
190194

191-
if (isExtensionDisabledOnSite(hostname) || iconState == "disabled") {
195+
if (isExtensionDisabledOnSite(host) || iconState == "disabled") {
192196
if ('setIcon' in chrome.browserAction) {
193197
chrome.browserAction.setIcon({
194198
path: {

0 commit comments

Comments
 (0)