-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Browser extension): Firefox support (#74)
* chore(Browser extension): Improve Firefox support by moving fetch to background / service worker * chore(Browser extension): Improve Firefox support customizing manifest for MV2 * chore(Browser extension): Improve async fetch from background script * chore(Browser extension): Improve async fetch from background script (take 2) * chore(Browser extension): eslint fix * chore(Browser extension): Background script optimise for listener registration * chore(Browser extension): Dynamically pull config in Threat Composer inject script * chore(Browser extension): Added logo * chore(Browser extension): Revised logo * docs(Browser extension): README * build(Browser extension): Include Firefox build in build task * docs(Browser extension): Updated README for local install instructions --------- Co-authored-by: Darran Boyd <[email protected]>
- Loading branch information
Showing
10 changed files
with
277 additions
and
187 deletions.
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
2 changes: 1 addition & 1 deletion
2
packages/threat-composer-app-browser-extension/.projen/tasks.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 +1,60 @@ | ||
# replace this | ||
# Threat Composer Browser Extension | ||
|
||
## Introduction | ||
|
||
This extension/add-on allows you to view web accessible Threat Composer exports (.tc.json) with one click directly in your browser. The Threat Composer web-app is baked into the extension itself. | ||
|
||
The extension supports the following integrations where a ‘View in Threat Composer’ button is added to the page: | ||
|
||
- GitHub Code Browser | ||
- Amazon Code Catalyst | ||
- ‘View Raw’ anywhere online so long as the URL includes reference to `.tc.json` (Note: on Firefox it does not work on `githubusercontent.com` due to the `sandbox` CSP directive) | ||
|
||
## Build | ||
|
||
1. Clone this repo | ||
1. Run the main build script (`./scripts/build.sh`) to build everything (including the browser extension) | ||
|
||
For any other guidance see the [Development](../../README.md#development) section of the main [README](../../README.md) | ||
|
||
## Load locally | ||
|
||
### Google Chrome | ||
|
||
1. Open Chrome, then goto `chrome://extensions` | ||
1. Enable 'Developer mode' | ||
1. Click on 'Load unpacked' | ||
1. Point it at the `./.output/chrome-mv3` directory and click Open | ||
|
||
### Mozilla Firefox | ||
|
||
1. Open Firefox, then goto `about:debugging` | ||
2. Click on 'This Firefox' then 'Load Temporary Add-on...' | ||
3. Point it at any file with the `./.output/firefox-mv2` and click Open | ||
|
||
## Create ZIP file | ||
|
||
### Google Chrome | ||
|
||
1. Go to the root of the extension package - `cd ./packages/threat-composer-app-browser-extension` | ||
1. Run `yarn run zip` - look in `./.output/` for ZIP file | ||
1. To load locally open Chrome, then goto `chrome://extensions`, enable developer mode, then drag-and-drop the ZIP file onto the page to load. | ||
|
||
### Mozilla Firefox | ||
|
||
1. Go to the root of the extension package - `cd ./packages/threat-composer-app-browser-extension` | ||
1. Run `yarn run zip:firefox` - look in `./.output/` for ZIP file | ||
|
||
## Development | ||
|
||
### Google Chrome | ||
|
||
1. Go to the root of the extension package - `cd ./packages/threat-composer-app-browser-extension` | ||
1. Run `yarn run dev` | ||
1. In your browser navigate to a hosted Threat Composer file on a supported integration - [example1](https://github.com/awslabs/threat-composer/blob/main/packages/threat-composer/src/data/workspaceExamples/ThreatComposer.tc.json), [example2](https://github.com/awslabs/threat-composer/blob/main/packages/threat-composer/src/data/workspaceExamples/GenAIChatbot.tc.json) and [example3](https://raw.githubusercontent.com/awslabs/threat-composer/main/packages/threat-composer/src/data/workspaceExamples/GenAIChatbot.tc.json) | ||
|
||
### Mozilla Firefox | ||
|
||
1. Go to the root of the extension package - `cd ./packages/threat-composer-app-browser-extension` | ||
1. Run `yarn run dev:firefox` | ||
1. In your browser navigate to a hosted Threat Composer file on a supported integration - [example1](https://github.com/awslabs/threat-composer/blob/main/packages/threat-composer/src/data/workspaceExamples/ThreatComposer.tc.json) and [example2](https://github.com/awslabs/threat-composer/blob/main/packages/threat-composer/src/data/workspaceExamples/GenAIChatbot.tc.json). Note: on Firefox it does not work on `githubusercontent.com` due to the `sandbox` CSP directive. |
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
Binary file added
BIN
+64.7 KB
packages/threat-composer-app-browser-extension/src/public/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.