forked from Netflix-Skunkworks/stethoscope-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit on open-source stethoscope
- Loading branch information
0 parents
commit 71e8894
Showing
86 changed files
with
26,455 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} |
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 @@ | ||
NODE_ENV=development |
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,36 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
# built dmg/exe/etc | ||
/dist | ||
|
||
.python-version | ||
|
||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
*.provisionprofile | ||
latest/ |
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,2 @@ | ||
react: PORT=12000 npm run react-start | ||
electron: PORT=12000 npm run electron-start |
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 @@ | ||
# Stethoscope app | ||
|
||
- [Testing Instructions](docs/TESTING.md) | ||
- [Creating & Signing Builds](docs/BUILDS.md) | ||
- [GraphQL Server](docs/GRAPHQL.md) | ||
- [Stethoscope Policies](docs/POLICIES.md) | ||
|
||
## Setup & Development | ||
|
||
Run the app + graphql server (currently requires port 3000) | ||
|
||
``` | ||
yarn install | ||
yarn run | ||
``` |
Binary file not shown.
Binary file not shown.
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,2 @@ | ||
provider: generic | ||
url: https://s3-us-west-2.amazonaws.com/nflx-stethoscope-public-securityprod-us-west-2/ |
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,18 @@ | ||
# Creating Builds | ||
|
||
You can create builds for all platforms by running: | ||
|
||
``` | ||
yarn run build | ||
``` | ||
|
||
**Note**: This will not work on Windows machines, you will need to manually delete the `dist/` directory and run: | ||
|
||
```bash | ||
./node_modules/.bin/react-scripts build && ./node_modules/.bin/electron-builder | ||
``` | ||
|
||
The build process copies assets from the `public/` directory into `build/` via `react-scripts`, `electron` picks up assets from the `build/` directory to bundle into native applications. | ||
|
||
## Signing Builds (Mac) | ||
|
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,200 @@ | ||
When running in development, the graphql server (and graphiql) can be access at [http://localhost:37370](http://localhost:37370) | ||
|
||
# Querying GraphQL | ||
|
||
### Pass/Fail validation: | ||
|
||
GraphiQL link: http://localhost:37370/graphiql?query=query%20ValidateDevice(%24policy%3A%20DevicePolicy!)%20%7B%0A%20%20policy%20%7B%0A%20%20%20%20validate(policy%3A%24policy)%0A%20%20%7D%0A%7D&variables=%7B%0A%20%20%22policy%22%3A%20%7B%0A%20%20%20%20%22osVersion%22%3A%20%7B%0A%20%20%20%20%20%20%22darwin%22%3A%20%22%3E%3D10.3%22%2C%0A%20%20%20%20%20%20%22win32%22%3A%20%22%3E%3D10.0.1%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22firewall%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22diskEncryption%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22automaticUpdates%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22screenLock%22%3A%20%22IF_SUPPORTED%22%2C%0A%20%20%20%20%22remoteLogin%22%3A%20%22NEVER%22%0A%20%20%7D%0A%7D&operationName=ValidateDevice | ||
|
||
GraphQL Query | ||
|
||
```javascript | ||
query ValidateDevice($policy: DevicePolicy!) { | ||
policy { | ||
validate(policy:$policy) | ||
} | ||
} | ||
``` | ||
|
||
Parameters | ||
|
||
```javascript | ||
{ | ||
"policy": { | ||
"osVersion": { | ||
"darwin": ">=10.3", | ||
"win32": ">=10.0.1" | ||
}, | ||
"firewall": "ALWAYS", | ||
"diskEncryption": "ALWAYS", | ||
"automaticUpdates": "ALWAYS", | ||
"screenLock": "IF_SUPPORTED", | ||
"remoteLogin": "NEVER" | ||
} | ||
} | ||
``` | ||
|
||
Response: | ||
|
||
```javascript | ||
{ | ||
"data": { | ||
"policy": { | ||
"validate": "PASS" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Verbose validation (device info in response) | ||
|
||
GraphiQL link: | ||
|
||
http://localhost:37370/graphiql?query=query%20ValidateDevice(%24policy%3A%20DevicePolicy!)%20%7B%0A%20%20policy%20%7B%0A%20%20%20%20validateWithDetails(policy%3A%24policy)%20%7B%0A%20%20%20%20%20%20status%0A%20%20%20%20%20%20osVersion%0A%20%20%20%20%20%20firewall%0A%20%20%20%20%20%20diskEncryption%0A%20%20%20%20%20%20screenLock%0A%20%20%20%20%20%20automaticUpdates%0A%20%20%20%20%20%20remoteLogin%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D&variables=%7B%0A%20%20%22policy%22%3A%20%7B%0A%20%20%20%20%22osVersion%22%3A%20%7B%0A%20%20%20%20%20%20%22darwin%22%3A%20%22%3E%3D10.3%22%2C%0A%20%20%20%20%20%20%22win32%22%3A%20%22%3E%3D10.0.1%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22firewall%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22diskEncryption%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22automaticUpdates%22%3A%20%22ALWAYS%22%2C%0A%20%20%20%20%22screenLock%22%3A%20%22IF_SUPPORTED%22%2C%0A%20%20%20%20%22remoteLogin%22%3A%20%22NEVER%22%0A%20%20%7D%0A%7D&operationName=ValidateDevice | ||
|
||
GraphQL query: | ||
|
||
```javascript | ||
query ValidateDevice($policy: DevicePolicy!) { | ||
policy { | ||
validateWithDetails(policy:$policy) { | ||
status | ||
osVersion | ||
firewall | ||
diskEncryption | ||
screenLock | ||
automaticUpdates | ||
remoteLogin | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Query params: | ||
|
||
```javascript | ||
{ | ||
"policy": { | ||
"osVersion": { | ||
"darwin": ">=10.3", | ||
"win32": ">=10.0.1" | ||
}, | ||
"firewall": "ALWAYS", | ||
"diskEncryption": "ALWAYS", | ||
"automaticUpdates": "ALWAYS", | ||
"screenLock": "IF_SUPPORTED", | ||
"remoteLogin": "NEVER" | ||
} | ||
} | ||
``` | ||
|
||
Result: | ||
|
||
```javascript | ||
{ | ||
"data": { | ||
"policy": { | ||
"validateWithDetails": { | ||
"status": "PASS", | ||
"osVersion": "PASS", | ||
"firewall": "PASS", | ||
"diskEncryption": "PASS", | ||
"screenLock": "PASS", | ||
"automaticUpdates": "PASS", | ||
"remoteLogin": "PASS" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Full device information | ||
|
||
GraphiQL link: http://localhost:37370/graphiql?query=%7B%0A%20%20device%20%7B%0A%20%20%20%20deviceId%0A%20%20%20%20deviceName%0A%20%20%20%20platform%0A%20%20%20%20platformName%0A%20%20%20%20osVersion%0A%20%20%20%20firmwareVersion%0A%20%20%20%20hardwareModel%0A%20%20%20%20hardwareSerial%0A%20%20%20%20stethoscopeVersion%0A%20%20%20%20osqueryVersion%0A%0A%20%20%20%20ipAddresses%20%7B%0A%20%20%20%20%20%20interface%0A%20%20%20%20%20%20address%0A%20%20%20%20%20%20mask%0A%20%20%20%20%20%20broadcast%0A%20%20%20%20%7D%0A%0A%20%20%20%20macAddresses%20%7B%0A%20%20%20%20%20%20interface%0A%20%20%20%20%20%20type%0A%20%20%20%20%20%20mac%0A%20%20%20%20%20%20lastChange%0A%20%20%20%20%7D%0A%0A%20%20%20%20security%20%7B%0A%20%20%20%20%20%20firewall%0A%20%20%20%20%20%20automaticUpdates%0A%20%20%20%20%20%20diskEncryption%0A%20%20%20%20%20%20screenLock%0A%20%20%20%20%20%20remoteLogin%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D&variables=&operationName=null | ||
|
||
|
||
GraphQL query | ||
|
||
```javascript | ||
{ | ||
device { | ||
deviceId | ||
deviceName | ||
platform | ||
platformName | ||
osVersion | ||
firmwareVersion | ||
hardwareModel | ||
hardwareSerial | ||
stethoscopeVersion | ||
osqueryVersion | ||
|
||
ipAddresses { | ||
interface | ||
address | ||
mask | ||
broadcast | ||
} | ||
|
||
macAddresses { | ||
interface | ||
type | ||
mac | ||
lastChange | ||
} | ||
|
||
security { | ||
firewall | ||
automaticUpdates | ||
diskEncryption | ||
screenLock | ||
remoteLogin | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Response: | ||
|
||
```javascript | ||
{ | ||
"data": { | ||
"device": { | ||
"deviceId": "abcdefg-abcd-1234-abcd-aa12bb34cc56", | ||
"deviceName": "machine-host-name", | ||
"platform": "darwin", | ||
"platformName": "Apple Inc.", | ||
"osVersion": "10.13.1", | ||
"firmwareVersion": "167 (B&I)", | ||
"hardwareModel": "MacBookPro14,3 ", | ||
"hardwareSerial": "C02TP3Y4HTD6", | ||
"stethoscopeVersion": "0.1.0", | ||
"osqueryVersion": "2.9.0", | ||
"ipAddresses": [ | ||
{ | ||
"interface": "lo0", | ||
"address": "127.0.0.1", | ||
"mask": "255.0.0.0", | ||
"broadcast": "" | ||
}, | ||
... | ||
], | ||
"macAddresses": [ | ||
{ | ||
"interface": "lo0", | ||
"type": "24", | ||
"mac": "00:00:00:00:00:00", | ||
"lastChange": null | ||
}, | ||
... | ||
], | ||
"security": { | ||
"firewall": "ON", | ||
"automaticUpdates": "ON", | ||
"diskEncryption": "ON", | ||
"screenLock": "UNSUPPORTED", | ||
"remoteLogin": "OFF" | ||
} | ||
} | ||
} | ||
}``` |
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 @@ | ||
// todo |
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 @@ | ||
# Stethoscope Testing instructions | ||
|
||
- [unit tests](#unit-tests) | ||
- [functional tests](#functional-tests) | ||
- [authflow tests](#authflow-tests) | ||
|
||
## Unit Tests | ||
Available unit tests can be run using: | ||
|
||
```bash | ||
yarn test | ||
``` | ||
|
||
## Functional Tests | ||
|
||
These tests should cover the following features: | ||
- Installers | ||
- Window management | ||
- Tray applications | ||
- Local scanning | ||
- "Remote" scanning | ||
- Notifications | ||
- CORS controls | ||
|
||
1. Download the current version of the application from [GDrive](https://drive.google.com/drive/u/0/folders/1BNMwdeNRsUjOIJyie7byssaw6Dsqi_cW) and run the installer | ||
2. Launch the application [click here to launch](stethoscope://main) | ||
3. If all default policy items are passing, disable the Firewall, wait ~5 seconds and click the "rescan" button | ||
4. Verify that the app is now showing the firewall is disabled | ||
5. To verify notifications, open terminal and execute the following curl request: | ||
|
||
```bash | ||
curl -H "Origin: stethoscope://main" --verbose 'http://127.0.0.1:37370/graphql?query=query%20ValidateDevice(%24policy%3A%20DevicePolicy!)%20%7B%0A%20%20%20%20%20%20policy%20%7B%0A%20%20%20%20%20%20%20%20validate(policy%3A%20%24policy)%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20device%20%7B%0A%20%20%20%20%20%20%20%20deviceId%0A%20%20%20%20%20%20%20%20deviceName%0A%20%20%20%20%20%20%20%20platform%0A%20%20%20%20%20%20%20%20platformName%0A%20%20%20%20%20%20%20%20osVersion%0A%20%20%20%20%20%20%20%20firmwareVersion%0A%20%20%20%20%20%20%20%20hardwareModel%0A%20%20%20%20%20%20%20%20hardwareSerial%0A%20%20%20%20%20%20%20%20stethoscopeVersion%0A%20%20%20%20%20%20%20%20osqueryVersion%0A%20%20%20%20%20%20%20%20ipAddresses%20%7B%0A%20%20%20%20%20%20%20%20%20%20interface%0A%20%20%20%20%20%20%20%20%20%20address%0A%20%20%20%20%20%20%20%20%20%20mask%0A%20%20%20%20%20%20%20%20%20%20broadcast%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20macAddresses%20%7B%0A%20%20%20%20%20%20%20%20%20%20interface%0A%20%20%20%20%20%20%20%20%20%20type%0A%20%20%20%20%20%20%20%20%20%20mac%0A%20%20%20%20%20%20%20%20%20%20lastChange%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20security%20%7B%0A%20%20%20%20%20%20%20%20%20%20firewall%0A%20%20%20%20%20%20%20%20%20%20automaticUpdates%0A%20%20%20%20%20%20%20%20%20%20diskEncryption%0A%20%20%20%20%20%20%20%20%20%20screenLock%0A%20%20%20%20%20%20%20%20%20%20remoteLogin%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D&variables=%7B%22policy%22%3A%7B%22osVersion%22%3A%7B%22darwin%22%3A%22%3E%3D10.3.0%22%2C%22win32%22%3A%22%3E%3D10.0.1%22%2C%22linux%22%3A%22%3E%3D4.3.3%22%7D%2C%22firewall%22%3A%22ALWAYS%22%2C%22diskEncryption%22%3A%22ALWAYS%22%2C%22automaticUpdates%22%3A%22ALWAYS%22%2C%22screenLock%22%3A%22IF_SUPPORTED%22%2C%22remoteLogin%22%3A%22NEVER%22%7D%7D&sessionId=fa8b411b-e241-5b83-e1c2-a18aa58143b4' | ||
``` | ||
|
||
6. Click the notification that pops up, verifying that the main application window is brought into focus | ||
7. Run the curl request again to verify that only one notification is issued | ||
8. Turn the Firewall back on | ||
9. Run the curl request again, verifying that the Tray icon is no longer red and the application no longer is reporting the issue | ||
10. Close the main window (mac only) by clicking the red orb, click the Tray icon and verify the application window is restored and focused | ||
11. Minimize the main window (mac only) by click the yellow orb, click the Tray icon and verify the application is maximized and focused | ||
|
||
## Authflow Tests | ||
|
||
### Case 1: Device is in compliance | ||
|
||
1. Open Stethoscope and verify device is compliant with policy | ||
2. Close Stethoscope app | ||
3. In a new incognito session, navigate to [https://stethoscope-authflow.test.netflix.net](https://stethoscope-authflow.test.netflix.net) | ||
4. Click the "Launch" link on the Meechum page | ||
5. Verify that you are successfully redirected to demo app success page | ||
|
||
### Case 2: Device is out of compliance | ||
|
||
1. Ensure device's Do Not Disturb mode is OFF | ||
2. Disable the firewall in system preferences | ||
3. Open Stethoscope and verify device is reporting problem | ||
4. In a new incognito session, navigate to [https://stethoscope-authflow.test.netflix.net](https://stethoscope-authflow.test.netflix.net) | ||
5. Click the "Launch" link on the Meechum page | ||
6. Verify that Stethoscope shows a Notification | ||
7. Click Notification and verify app is brought into focus | ||
8. Follow in-app instructions (and links) to re-enable the firewall | ||
9. Verify that Meechum detects the change in state and redirects you to demo app success page |
Oops, something went wrong.