Skip to content
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

Merge openwpm-webext-instrumentation repo #328

Merged
merged 144 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
b6430fb
Initial commit
motin Sep 28, 2018
9fdb23a
chore: Set initial version to 0.1.0
motin Sep 28, 2018
6277db8
chore: Add npm run commit. Add commitizen as dev dependency
motin Sep 28, 2018
a4448bd
style: Modify prettier configuration
motin Sep 28, 2018
03cff1b
chore: Remove example typings from boilerplate
motin Sep 28, 2018
3ce6d14
build: Add npm run prepare so that build artifacts gets included in t…
motin Sep 28, 2018
80e3dec
refactor: Renamed package to openwpm-webext-instrumentation
motin Sep 29, 2018
743d765
Add typescript typings for Firefox web extensions apis
motin Oct 2, 2018
a9d8fc0
feat: Import reusable instrumentation from the OpenWPM repository
motin Oct 2, 2018
94d856b
refactor: Move from js to ts file extensions
motin Oct 2, 2018
4bcc6f3
docs: Update official repo url
motin Oct 2, 2018
9aeafb5
refactor: Inject loggingDB into HttpPostParser at runtime
motin Oct 2, 2018
3117632
refactor: Moved http-post-parser to lib folder
motin Oct 2, 2018
d54902e
refactor: Move all export declarations to a single file
motin Oct 3, 2018
a7a5b20
refactor: Moved out page-scoped js-instrumentation to separate file
motin Oct 3, 2018
01f702d
style: npm run fix
motin Oct 3, 2018
9e07ec5
style: Set severity of currently applicable tslint rules to warning i…
motin Oct 3, 2018
bb9c3c6
style: Adhere to tslint rule triple-equals
motin Oct 3, 2018
980fda7
feat: Typescript compiles
motin Oct 3, 2018
8e44ba8
feat: Improve lint and test npm scripts
motin Oct 3, 2018
bdc6415
refactor: Simplify module exports
motin Oct 3, 2018
e42c40b
refactor: Simplify the public interface
motin Oct 3, 2018
689f4a7
fix: Not catching errors in emitMsg sendMessage since this fudges Fx …
motin Oct 3, 2018
8429acd
feat: Make functional again when running in openwpm web extension
motin Oct 3, 2018
12d4b58
fix: Make testing param in injectJavascriptInstrumentPageScript optional
motin Oct 4, 2018
745f6bf
fix: Restore js instrumentation (including inclusion of relevant meth…
motin Oct 4, 2018
91fa3ae
refactor: Rename loggingDB to dataReceiver
motin Oct 12, 2018
8f1a324
fix: Export string-utils
motin Oct 12, 2018
0815d9b
style: Add editorconfig
motin Oct 12, 2018
8a6c84a
refactor: Use functions from lib/string-utils in http and cookie inst…
motin Oct 12, 2018
446773d
feat: Add interfaces also for http and cookie updates
motin Oct 12, 2018
cf1b7a8
feat: Add schema-based typescript interfaces
motin Oct 12, 2018
e74ead7
fix: Use all three http-related interfaces in http instrumentation
motin Oct 13, 2018
e60c780
refactor: Use schema-based type interfaces in cookie and javascript i…
motin Oct 24, 2018
9dbdb71
fix: Restore more of the cookie and http instrumentation
motin Oct 25, 2018
7900632
fix: Move out typing definitions to separate file and continue the re…
motin Oct 26, 2018
c80b10f
feat: Add minimal readme instructions
motin Oct 26, 2018
2677f6e
fix: Restore isJS() and get location header
motin Oct 26, 2018
9c9d39c
fix: Valid SPDX license field
motin Oct 26, 2018
53846db
fix: Restore more of the save response body logic
motin Oct 26, 2018
369fe87
feat: Add sha256 hashing logic
motin Oct 27, 2018
d50dd63
fix: Use sha256 content hash logic
motin Oct 27, 2018
65b2505
feat: Store resource type (as strings) instead of content policy type…
motin Oct 27, 2018
17fec7b
fix: Restore isXHR check
motin Oct 27, 2018
9f4be3a
fix: Remove varchar definitions in schema interfaces
motin Oct 27, 2018
137651e
fix: Restore saving of response bodies
motin Oct 27, 2018
4887745
fix: Restore is full page and is frame load checks
motin Oct 27, 2018
3e22ac2
fix: Remove or comment out debug-related logging and mark yet-to-be-r…
motin Oct 27, 2018
3955362
fix: Fix use of details.documentUrl
motin Oct 27, 2018
63e0564
refactor: Make http post parser compile
motin Oct 27, 2018
4d38abf
fix: Restore a light version of the http post parser which uses reque…
motin Oct 27, 2018
df223da
fix: Log pending request timeouts when encountered in post data handl…
motin Oct 27, 2018
0f2522a
fix: Blocking listener does not block all requests
motin Oct 27, 2018
1e9502d
refactor: Move OnChangedCause back into an import statement so that i…
motin Oct 27, 2018
4dcaae7
docs: Remove sqlite-related part of a comment
motin Oct 27, 2018
14c1248
feat: Add is_host_only, same_site and first_party_domain to cookie in…
motin Oct 27, 2018
4e91061
fix: Cast all boolean data attributes to integers
motin Oct 28, 2018
f06cb95
refactor: A bit less magic string conversion method
motin Oct 28, 2018
07d2d1f
fix: Return empty response and emit a debug message when POST request…
motin Oct 28, 2018
fbccd09
fix: Grab the corresponding values for the triggering and loading Pri…
motin Oct 28, 2018
5cfed58
fix: Skip converting function arguments to an object
motin Oct 29, 2018
8c12276
chore: Bump version to represent the many breaking changes
motin Oct 29, 2018
3124a16
feat: Js instrumentation does no longer log to console except when de…
motin Oct 29, 2018
6890b99
fix: Remove interfaces that are exclusively used by code outside the …
motin Oct 29, 2018
411163c
fix: Dropped attributes related to the P3P policy of the cookie
motin Oct 29, 2018
17810cc
refactor: Clarify which schema attributes are dates
motin Oct 29, 2018
af09bfc
feat: Http instrumentation cleanup() method
motin Oct 29, 2018
d9ade48
feat: Cookie + js instrumentation cleanup() methods
motin Oct 29, 2018
2f877b2
fix: Export schema-based interfaces
motin Oct 29, 2018
74b0f1c
docs: Add minimal docs about instrumentation to readme
motin Oct 29, 2018
f8c6ef4
fix: Schema interfaces properly exported in build
motin Oct 29, 2018
eeedb5a
fix: Use <all_urls> as request filter instead of only matching http(s…
motin Oct 30, 2018
43a5619
fix: Typo
motin Oct 30, 2018
befc96a
fix: Don't assume responseHeaders always are available
motin Oct 30, 2018
c90b191
fix: Don't assume requestHeaders always are available
motin Oct 30, 2018
12b7f97
fix: Drop attributes as discussed in PR conversations
motin Oct 31, 2018
8a8ba34
fix: Http redirect request id more likely to correspond to old_channe…
motin Oct 31, 2018
106af4c
fix: JS request type checks now only use RequestType (no longer conte…
motin Oct 31, 2018
f979546
fix: Restore HttpRequest.top_level_url (using the url of the requesti…
motin Oct 31, 2018
e6524f3
feat: Add HttpRequest.parent_frame_id and frame_ancestors
motin Nov 1, 2018
0415637
feat: Add Cookie.change_cause
motin Nov 1, 2018
52d946b
feat: Add time_stamp to cookie instrumentation
motin Oct 31, 2018
9c38ab6
fix: Use ISO date format for Cookie.expiry (allowing us to drop the m…
motin Nov 2, 2018
167839d
fix: Use ´request_id´ instead of `channel_id` in http-instrument
motin Nov 2, 2018
dcd28b3
Merge pull request #7 from mozilla/refactor-legacy-sdk-code-to-webext…
englehardt Nov 7, 2018
e40f2b0
Write data property sets to instance rather than prototype objects
englehardt Nov 14, 2018
1af4022
Merge pull request #19 from englehardt/overwrite-fix
motin Nov 14, 2018
989229b
feat: Instrument access to the document.referrer property
motin Oct 31, 2018
56ec1fc
feat: Instrument navigations
motin Nov 1, 2018
508538b
feat: Add Navigation.uuid
motin Nov 1, 2018
9988e17
feat: Add general property extension_session_uuid to be able to disti…
motin Nov 1, 2018
01bf7cc
feat: Add window, tab and frame id to http and javascript packets
motin Nov 1, 2018
6c0eeb4
feat: Add Navigation.tab_opener_tab_id
motin Nov 1, 2018
e5ca954
feat: Record cookie store ids
motin Nov 2, 2018
07d0681
feat: Add incognito attributes where applicable (navigation, http and…
motin Nov 2, 2018
bc2f8f1
feat: Add HttpRedirect.response_status and response_status_text
motin Nov 2, 2018
094b43c
fix: Handle tabId being -1 in http and navigation instrument
motin Nov 2, 2018
97bf14f
fix: Comment out unused parts of http-post-parsed (avoids the "unreac…
motin Nov 2, 2018
41aaea0
feat: Tab/window dimensions and window type in Navigation instrument
motin Nov 2, 2018
af7944c
feat: CookieInstrument.saveAllCookies()
motin Nov 6, 2018
5575d37
fix: Whitespace
motin Nov 6, 2018
98659df
refactor: Minor code cleanup
motin Nov 19, 2018
90b2c1d
fix: Remove two outdated comments
motin Nov 20, 2018
40e4bdc
fix: Add HttpRedirect.old|new_request_url, restoring some sort of abi…
motin Nov 20, 2018
73b35b8
fix: Restore HttpRequest.referrer
motin Nov 21, 2018
698e402
feat: Keep track of the order of the original incoming events
motin Nov 21, 2018
abc6c7e
Merge pull request #11 from mozilla/several-enhancements
englehardt Nov 21, 2018
b63c947
style: Fix comment white-space in page-scoped js instrumentation
motin Nov 22, 2018
aa2f3bc
refactor: Small code cleanup
motin Nov 22, 2018
47c46e1
feat: Record web navigation onBeforeNavigate timestamp, event ordinal…
motin Nov 22, 2018
2df84a7
fix: Comment out HttpResponse.referrer in schema since it is currentl…
motin Nov 23, 2018
778da7a
feat: Document and export the date time format used for time stamps
motin Nov 23, 2018
a8f3754
feat: Include timestamp in js instrumentation started console log mes…
motin Nov 26, 2018
1d90b38
feat: Strip away data from data URLs before being stored
motin Nov 26, 2018
b29c338
Update npm-run-all to remove event-stream dependency
englehardt Nov 27, 2018
889aba0
Merge pull request #32 from mozilla/remove-event-stream
motin Nov 27, 2018
6469b58
Merge pull request #31 from mozilla/enhancements-batch-2
englehardt Nov 27, 2018
ecf4a4f
Add Mozilla Code of Conduct file
Mar 30, 2019
0f59d24
Merge pull request #41 from Mozilla-GitHub-Standards/master
englehardt Apr 19, 2019
d2d5b50
Moved core js instrumentation methods to a separate file
motin May 3, 2019
b967c51
Moved the instrumentation of fingerprinting apis to a separate file
motin May 3, 2019
cc6d8c7
Npm run fix
motin May 4, 2019
38b8d16
Return the response body as Uint8Array instead of string
eriktews May 20, 2019
f9f912d
Save the contentHash in the database too
eriktews May 22, 2019
ca7e2c7
Remove commented out code
eriktews May 22, 2019
d64a766
Merge pull request #45 from eriktews/binary-response-body
englehardt May 23, 2019
3ded79b
Merge pull request #42 from mozilla/a-bit-more-customizable
motin May 28, 2019
e1c00d9
Cleaned up javascript-instrumentation.ts + allowing it to listen to m…
motin May 4, 2019
8dd157f
Merge pull request #44 from mozilla/js-instrument-listen-early
motin May 28, 2019
a8646d5
Handle raw HTTP POST data as well
eriktews Jun 7, 2019
ae4e9c0
Merge pull request #47 from eriktews/mozilla-raw-post
englehardt Jun 11, 2019
a408495
Moved some files temporarily pending repo merge
motin Jun 25, 2019
ab7ccb0
Merge remote-tracking branch 'openwpm-webext-instrumentation/master' …
motin Jun 25, 2019
7e2b026
Moved webext-instrumentation into its own directory
motin Jun 25, 2019
3478c03
Revert "Moved some files temporarily pending repo merge"
motin Jun 25, 2019
4a91b35
Remove files that are only relevant at a root repository level
motin Jun 25, 2019
1b17f6c
Updated package-lock.json files in automation/Extension
motin Jun 25, 2019
826cd3c
Linked extension with local webext-instrumentation folder as dependency
motin Jun 25, 2019
3a1e1eb
Updated docs to reflect the merged instrumentation repo
motin Jun 25, 2019
5c46a62
Use firefox dev edition to start the extension while developing inste…
motin Jun 25, 2019
29b8e0b
Install webext-instrumentation deps after installing extension deps
motin Jun 25, 2019
3e8fc1d
Bumped instrumentation version retroactively to 0.3.0 to reflect the …
motin Jun 25, 2019
dab5d35
Updated Dockerfile to work with the merged webext-instrumentation
motin Jun 25, 2019
49078b3
Removed the currently unused travis configuration for webext-instrume…
motin Jun 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@
FROM node:10 as extension
WORKDIR /usr/src/app

# Copy the package.json and package-lock.json first and install all the
# packages. Should the source code of the extension be changed without
# altering the list of required packages, this step can be cached by Docker.
COPY automation/Extension/firefox/package*.json ./

# The extension needs to run for example the TypeScript transpiler
# to generate the JavaScript code of the extension. This must be done as root
# as long as the directory of the extension is only writeable as root.
RUN npm config set unsafe-perm true

RUN npm install
COPY automation/Extension/firefox/. ./
COPY automation/Extension/webext-instrumentation/. ../webext-instrumentation
RUN npm install
RUN npm run build


# Stage 2, build the main OpenWPM image
FROM ubuntu:18.04

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,10 @@ dependencies, which can be installed with `install-dev.sh`.
### Editing instrumentation

The instrumentation extension is included in `/automation/Extension/firefox/`.
Any edits within this directory will require the extension to be re-built to produce a new `openwpm.xpi` with your updates. You can use `build_extension.sh` to do this.

The actual instrumentation code is maintained in https://github.com/mozilla/openwpm-webext-instrumentation. To test changes to the instrumentation code, change the dependency in [package.json](https://github.com/mozilla/OpenWPM/blob/master/automation/Extension/firefox/package.json) to point to your local clone (e.g. `"openwpm-webext-instrumentation": "file:/path/to/openwpm-webext-instrumentation"`). Make sure to run `npm run build` in the `openwpm-webext-instrumentation` repo to pick up changes.
The instrumentation itself (used by the above extension) is included in
`/automation/Extension/webext-instrumentation/`.
Any edits within these directories will require the extension to be re-built to produce
a new `openwpm.xpi` with your updates. You can use `build_extension.sh` to do this.

### Debugging the platform

Expand Down
3 changes: 1 addition & 2 deletions automation/Extension/firefox/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions automation/Extension/firefox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"author": "Mozilla",
"dependencies": {
"openwpm-webext-instrumentation": "github:mozilla/openwpm-webext-instrumentation#master"
"openwpm-webext-instrumentation": "../webext-instrumentation"
},
"devDependencies": {
"eslint": "^5.16.0",
Expand Down Expand Up @@ -38,7 +38,8 @@
"url": "https://github.com/mozilla/openwpm-firefox-webext"
},
"scripts": {
"prebuild": "webpack",
"prebuild": "cd ../webext-instrumentation && npm run build && cd - && webpack",
"postinstall": "cd ../webext-instrumentation && npm install",
"build": "web-ext build",
"eslint": "eslint . --ext jsm,js,json",
"lint": "npm-run-all lint:*",
Expand Down
2 changes: 1 addition & 1 deletion automation/Extension/firefox/web-ext-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const defaultConfig = {
overwriteDest: true,
},
run: {
firefox: process.env.FIREFOX_BINARY || "firefox",
firefox: process.env.FIREFOX_BINARY || "firefoxdeveloperedition",
Copy link
Collaborator

@englehardt englehardt Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? From what I can tell the unbranded build is registered as "Nightly". It seems like we shouldn't need any fallback though, as we really only want to test/crawl with the firefox binary grabbed from our install script and throwing an error seems preferable to silently falling back to the system's firefox or dev edition binary. (If I'm misunderstanding how this is used, lmk).

Copy link
Contributor Author

@motin motin Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this so that one can run npm start and get a working extension up and running in Firefox, rather than a broken experience. It'd be better if this can run the bundled Fx installation, but not sure how to set that up in a cross platform way. Using firefox dev edition to start the extension is at least better than the branded firefox (which doesn't run web extension experiments), but we can default to "nightly" too, albeit it may be less likely that extension developers have Nightly installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If I'm misunderstanding how this is used, lmk).

process.env.FIREFOX_BINARY allows developers to supply their preference when running npm commands, eg, FIREFOX_BINARY=nightly npm start or FIREFOX_BINARY=/Applications/Firefox.app/Contents/MacOS/firefox-bin npm start.

browserConsole: true,
startUrl: ["about:debugging"],
pref: ["extensions.legacy.enabled=true"],
Expand Down
9 changes: 9 additions & 0 deletions automation/Extension/webext-instrumentation/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
11 changes: 11 additions & 0 deletions automation/Extension/webext-instrumentation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
build
test
src/**.js
.idea/*

coverage
.nyc_output
*.log

yarn.lock
14 changes: 14 additions & 0 deletions automation/Extension/webext-instrumentation/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
src
test
tsconfig.json
tsconfig.module.json
tslint.json
.travis.yml
.github
.prettierignore
.vscode
build/docs
**/*.spec.*
coverage
.nyc_output
*.log
2 changes: 2 additions & 0 deletions automation/Extension/webext-instrumentation/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json
26 changes: 26 additions & 0 deletions automation/Extension/webext-instrumentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# OpenWPM instrumentation library for WebExtensions

Allows WebExtensions to track and monitor privacy-related browsing behavior

## Installation

This package is yet to be published to npm.

## Instrumentation

The instrumentation leverages the available [JavaScript APIs for WebExtensions](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API) and listens to navigation, web requests, cookie modifications and access to certain javascript API:s, as described in [the main OpenWPM project README](https://github.com/citp/OpenWPM/tree/develop#instrumentation-and-data-access) under the following bullet points:
- HTTP Request and Response Headers, redirects, and POST request bodies
- Javascript Calls
- Response body content
- Cookie Access (Experimental)

More specifically, all packets sent by the instrumentation conform to [these interfaces](https://github.com/mozilla/openwpm-webext-instrumentation/blob/refactor-legacy-sdk-code-to-webext-equivalent/src/schema.ts).

## Usage

The instrumentation is designed to invoke a `dataReceiver` object whenever a packet or log entry is available.

Pending proper documentation, the best way to see how this library is used is to check how the instrumentation is incorporated into the following extensions:

* https://github.com/mozilla/OpenWPM/tree/master/automation/Extension/firefox
* https://github.com/motin/jestr-pioneer-shield-study
Loading