@jupiterone/graph-bugcrowd
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -11,6 +11,20 @@ # Changelog | ||
## 0.1.0 - 2020-05-20 | ||
## [0.4.0] - 2021-08-12 | ||
### Changed | ||
- Upgrade to latest dependencies | ||
### Fixed | ||
- Fixed pagination in `ServicesClient` | ||
## [0.3.0] | ||
## [0.2.0] | ||
## [0.1.0] - 2020-05-20 | ||
### Added | ||
- Initial release. |
import { IntegrationInvocationConfig } from '@jupiterone/integration-sdk-core'; | ||
import { ServicesClientInput } from './collector/ServicesClient'; | ||
export declare const invocationConfig: IntegrationInvocationConfig<ServicesClientInput>; | ||
import { IntegrationConfig } from './config'; | ||
export declare const invocationConfig: IntegrationInvocationConfig<IntegrationConfig>; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const instanceConfigFields_1 = __importDefault(require("./instanceConfigFields")); | ||
const validateInvocation_1 = __importDefault(require("./validateInvocation")); | ||
const fetch_account_1 = __importDefault(require("./steps/fetch-account")); | ||
const fetch_all_1 = __importDefault(require("./steps/fetch-all")); | ||
exports.invocationConfig = void 0; | ||
const config_1 = require("./config"); | ||
const fetch_account_1 = require("./steps/fetch-account"); | ||
const fetch_bounties_1 = require("./steps/fetch-bounties"); | ||
exports.invocationConfig = { | ||
instanceConfigFields: instanceConfigFields_1.default, | ||
validateInvocation: validateInvocation_1.default, | ||
integrationSteps: [fetch_account_1.default, fetch_all_1.default], | ||
instanceConfigFields: config_1.instanceConfigFields, | ||
validateInvocation: config_1.validateInvocation, | ||
integrationSteps: [...fetch_account_1.accountSteps, ...fetch_bounties_1.bountySteps], | ||
}; |
@@ -1,4 +0,4 @@ | ||
import { IntegrationStep } from '@jupiterone/integration-sdk-core'; | ||
import { ServicesClientInput } from '../../collector/ServicesClient'; | ||
declare const step: IntegrationStep<ServicesClientInput>; | ||
export default step; | ||
import { IntegrationStep, IntegrationStepExecutionContext } from '@jupiterone/integration-sdk-core'; | ||
import { IntegrationConfig } from '../../config'; | ||
export declare function fetchAccount({ instance, jobState, }: IntegrationStepExecutionContext<IntegrationConfig>): Promise<void>; | ||
export declare const accountSteps: IntegrationStep<IntegrationConfig>[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.accountSteps = exports.fetchAccount = void 0; | ||
const integration_sdk_core_1 = require("@jupiterone/integration-sdk-core"); | ||
const converter_1 = require("../../converter"); | ||
const step = { | ||
id: 'fetch-account', | ||
name: 'Fetch Bugcrowd account and service', | ||
types: [ | ||
'bugcrowd_account', | ||
'bugcrowd_service', | ||
'bugcrowd_account_provides_service', | ||
], | ||
async executionHandler({ instance, jobState, }) { | ||
const accountEntity = converter_1.getAccountEntity(instance); | ||
await jobState.addEntity(accountEntity); | ||
const serviceEntity = converter_1.getServiceEntity(instance); | ||
await jobState.addEntity(serviceEntity); | ||
await jobState.addRelationship(integration_sdk_core_1.createIntegrationRelationship({ | ||
from: accountEntity, | ||
to: serviceEntity, | ||
_class: 'PROVIDES', | ||
})); | ||
const converters_1 = require("./converters"); | ||
const constants_1 = require("../constants"); | ||
const jobState_1 = require("../../util/jobState"); | ||
async function fetchAccount({ instance, jobState, }) { | ||
const accountEntity = await jobState.addEntity(converters_1.createAccountEntity(instance)); | ||
const serviceEntity = await jobState.addEntity(converters_1.createServiceEntity(instance)); | ||
// Cache the account and service entities for quick access later. Both are used | ||
// accross multiple steps | ||
await jobState.setData(jobState_1.ACCOUNT_ENTITY_JOB_STATE_KEY, accountEntity); | ||
await jobState.setData(jobState_1.SERVICE_ENTITY_JOB_STATE_KEY, serviceEntity); | ||
await jobState.addRelationship(integration_sdk_core_1.createDirectRelationship({ | ||
_class: integration_sdk_core_1.RelationshipClass.PROVIDES, | ||
from: accountEntity, | ||
to: serviceEntity, | ||
})); | ||
} | ||
exports.fetchAccount = fetchAccount; | ||
exports.accountSteps = [ | ||
{ | ||
id: constants_1.IntegrationSteps.ACCOUNT, | ||
name: 'Fetch Account', | ||
entities: [constants_1.Entities.ACCOUNT, constants_1.Entities.SERVICE], | ||
relationships: [constants_1.Relationships.ACCOUNT_PROVIDES_SERVICE], | ||
executionHandler: fetchAccount, | ||
}, | ||
}; | ||
exports.default = step; | ||
]; |
{ | ||
"name": "@jupiterone/graph-bugcrowd", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A graph conversion tool for https://bugcrowd.com/", | ||
@@ -15,47 +15,27 @@ "license": "MPL-2.0", | ||
"scripts": { | ||
"collect": "j1-integration collect", | ||
"start": "j1-integration collect", | ||
"graph": "j1-integration visualize", | ||
"start": "yarn collect; yarn graph", | ||
"graph:types": "j1-integration visualize-types", | ||
"lint": "eslint . --cache --fix --ext .ts,.tsx", | ||
"format": "prettier --write '**/*.{ts,js,json,css,md,yml}'", | ||
"type-check": "tsc", | ||
"test": "jest --passWithNoTests", | ||
"test": "jest", | ||
"test:env": "LOAD_ENV=1 yarn test", | ||
"test:ci": "yarn lint && yarn type-check && yarn test", | ||
"prebuild": "yarn test:ci", | ||
"prepush": "yarn test:ci", | ||
"build": "tsc -p tsconfig.dist.json --declaration", | ||
"prepush": "yarn lint && yarn type-check && jest --changedSince main", | ||
"prepack": "yarn build" | ||
}, | ||
"dependencies": { | ||
"@lifeomic/attempt": "^3.0.0", | ||
"base-64": "^0.1.0", | ||
"node-fetch": "^2.6.0" | ||
"peerDependencies": { | ||
"@jupiterone/integration-sdk-core": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@jupiterone/integration-sdk-core": "^2.2.0", | ||
"@jupiterone/integration-sdk-dev-tools": "^2.2.0", | ||
"@jupiterone/integration-sdk-testing": "^2.2.0", | ||
"@types/har-format": "^1.2.4", | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "^13.11.1", | ||
"@typescript-eslint/eslint-plugin": "^2.28.0", | ||
"@typescript-eslint/parser": "^2.28.0", | ||
"dotenv": "^8.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-jest": "^23.8.2", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"husky": "^4.2.5", | ||
"jest": "^25.3.0", | ||
"jest-fetch-mock": "^3.0.3", | ||
"lint-staged": "^10.1.3", | ||
"prettier": "^2.0.4", | ||
"ts-jest": "^25.3.1", | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3", | ||
"wait-for-expect": "^3.0.2" | ||
"@jupiterone/integration-sdk-core": "^6.1.0", | ||
"@jupiterone/integration-sdk-dev-tools": "^6.1.0", | ||
"@jupiterone/integration-sdk-testing": "^6.1.0", | ||
"@types/node-fetch": "^2.5.10" | ||
}, | ||
"peerDependencies": { | ||
"@jupiterone/integration-sdk-core": "^2.2.0" | ||
"dependencies": { | ||
"node-fetch": "^2.6.1" | ||
} | ||
} |
108
README.md
@@ -1,82 +0,52 @@ | ||
# graph-bugcrowd | ||
# JupiterOne Integration | ||
## Development Environment | ||
Learn about the data ingested, benefits of this integration, and how to use it | ||
with JupiterOne in the [integration documentation](docs/jupiterone.md). | ||
## Development | ||
### Prerequisites | ||
You must have Node.JS installed to run this project. If you don't already have | ||
it installed, you can can download the installer | ||
[here](https://nodejs.org/en/download/). You can alternatively install Node.JS | ||
using a version manager like [fnm](https://github.com/Schniz/fnm) or | ||
[nvm](https://github.com/nvm-sh/nvm). | ||
1. Install [Node.js](https://nodejs.org/) using the | ||
[installer](https://nodejs.org/en/download/) or a version manager such as | ||
[nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm). | ||
2. Install [`yarn`](https://yarnpkg.com/getting-started/install) or | ||
[`npm`](https://github.com/npm/cli#installation) to install dependencies. | ||
3. Install dependencies with `yarn install`. | ||
4. Register an account in the system this integration targets for ingestion and | ||
obtain API credentials. | ||
5. `cp .env.example .env` and add necessary values for runtime configuration. | ||
### Setup | ||
When an integration executes, it needs API credentials and any other | ||
configuration parameters necessary for fetching data from the provider. The | ||
names of these parameters are defined in `src/instanceConfigFields.ts`. When | ||
executed in a development environment, values for these parameters are read | ||
from Node's `process.env`, loaded from `.env`. That file has been added to | ||
`.gitignore` to avoid commiting credentials. | ||
#### Installing dependencies | ||
### Running the integration | ||
From the root of this project, run `npm install` to install dependencies. If you | ||
have `yarn` installed, you can install dependencies by running `yarn`. | ||
1. `yarn start` to collect data | ||
2. `yarn graph` to show a visualization of the collected data | ||
3. `yarn j1-integration -h` for additional commands | ||
#### Loading credentials | ||
### Making Contributions | ||
Create a `.env` file at the root of this project and add environment variables | ||
to match what is in `src/instanceConfigFields.json`. The `.env` file is ignored | ||
by git, so you won't have to worry about accidentally pushing credentials. | ||
Start by taking a look at the source code. The integration is basically a set of | ||
functions called steps, each of which ingests a collection of resources and | ||
relationships. The goal is to limit each step to as few resource types as | ||
possible so that should the ingestion of one type of data fail, it does not | ||
necessarily prevent the ingestion of other, unrelated data. That should be | ||
enough information to allow you to get started coding! | ||
Given this example configuration: | ||
See the | ||
[SDK development documentation](https://github.com/JupiterOne/sdk/blob/main/docs/integrations/development.md) | ||
for a deep dive into the mechanics of how integrations work. | ||
```json | ||
{ | ||
"apiToken": { | ||
"type": "string", | ||
"mask": true | ||
} | ||
} | ||
``` | ||
See [docs/development.md](docs/development.md) for any additional details about | ||
developing this integration. | ||
You would provide a `.env` file like this: | ||
### Changelog | ||
```bash | ||
API_TOKEN=<secret> | ||
``` | ||
The snake cased environment variables will automatically be converted and | ||
applied to the camel cased configuration field. So for example, `CLIENT_ID` will | ||
apply to the `clientId` config field, `CLIENT_SECRET` will apply to | ||
`clientSecret`, and `MY_SUPER_SECRET_CONFIGURATION_VALUE` will apply to a | ||
`mySuperSecretConfigurationValue` configuration field. | ||
## Running the integration | ||
To start collecting data, run `yarn start` from the root of the project. This | ||
will load in your configuration and execute the steps stored in `src/steps`. | ||
## Project structure | ||
This is the expected project structure for running integrations. | ||
``` | ||
src/ | ||
/instanceConfigFields.json | ||
/validateInvocation.ts | ||
/getStepStartStates.ts | ||
steps/ | ||
exampleStep.ts | ||
// add additional steps here | ||
``` | ||
Each of the files listed above contribute to creating an | ||
[integration configuration](https://github.com/JupiterOne/integration-sdk/blob/master/docs/development.md#the-integration-framework). | ||
Additional files can be placed under `src` and referenced from each of the | ||
integration files. | ||
The template project hosted | ||
[here](https://github.com/JupiterOne/integration-sdk/tree/master/template) | ||
provides a simple example of how an integration can be setup. | ||
## Development Docs | ||
Please reference the `@jupiterone/integration-sdk` | ||
[development documentation](https://github.com/JupiterOne/integration-sdk/blob/master/docs/development.md) | ||
for more information on how to build integrations. | ||
The history of this integration's development can be viewed at | ||
[CHANGELOG.md](CHANGELOG.md). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
2
4
1
192431
29
623
53
1
+ Added@jupiterone/data-model@0.39.0(transitive)
+ Added@jupiterone/integration-sdk-core@6.22.1(transitive)
+ Addedajv@8.17.1(transitive)
+ Addedajv-formats@2.1.1(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addeduuid@8.3.2(transitive)
- Removed@lifeomic/attempt@^3.0.0
- Removedbase-64@^0.1.0
- Removed@jupiterone/data-model@0.8.1(transitive)
- Removed@jupiterone/integration-sdk-core@2.11.1(transitive)
- Removed@lifeomic/attempt@3.1.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedbase-64@0.1.0(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedpunycode@2.3.1(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@7.0.3(transitive)
Updatednode-fetch@^2.6.1