Skip to content

Commit

Permalink
Merge pull request #58 from Netflix-Skunkworks/browser_extensions
Browse files Browse the repository at this point in the history
Add support to query Browser extensions
  • Loading branch information
rmcvey authored Sep 5, 2018
2 parents bddb4b6 + 70f71e0 commit aa7af73
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
33 changes: 33 additions & 0 deletions resolvers/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,39 @@ const Device = {
return hardwareSerial
},

async extensions (root, args, context) {
const { browser = "all" } = args
let chrome = []
let firefox = []
let safari = []

if (['all', 'chrome'].includes(browser)) {
chrome = await OSQuery.all('chrome_extensions').then(results =>
results.map(({ name, version, identifier, path, author }) =>
({ name, path, version, identifier, author, browser: 'chrome' })
)
)
}

if (['all', 'firefox'].includes(browser)) {
firefox = await OSQuery.all('firefox_addons').then(results =>
results.map(({ name, version, identifier, path, creator: author }) =>
({ name, path, version, identifier, author, browser: 'firefox' })
)
)
}

if (['all', 'safari'].includes(browser)) {
safari = await OSQuery.all('safari_extensions').then(results =>
results.map(({ name, version, identifier, path, creator: author }) =>
({ name, path, version, identifier, author, browser: 'safari' })
)
)
}

return chrome.concat(firefox).concat(safari)
},

async applications (root, args, context) {
const os = PlatformResolvers[context.platform]
if ('applications' in os) {
Expand Down
18 changes: 18 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Device {
hardwareSerial: String
# installed applications
applications: [Application]
# browser extensions
extensions(browser: Browser): [Extension]
# current IP addresses
ipAddresses: [IpAddress]
# interface_details
Expand Down Expand Up @@ -88,6 +90,15 @@ type Application {
installDate: String
}

type Extension {
name: String!
path: String!
version: String!
author: String!
identifier: String!
browser: String!
}

# A DevicePolicy is a description of the desired state of a set of pre-selected device features
input DevicePolicy {
# current operation system version, use [semver](https://www.nodesource.com/blog/semver-a-primer/) strings to define requirement
Expand Down Expand Up @@ -240,6 +251,13 @@ input VersionBracket {
nudge: Semver
}

enum Browser {
chrome
firefox
safari
all
}

# possible states that a device 'feature' can be in
enum FeatureState {
PASS
Expand Down

0 comments on commit aa7af73

Please sign in to comment.