@jupiterone/integration-sdk-cli 9.5.0 → 9.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/src/commands/generate.d.ts +1 -0
  2. package/dist/src/commands/generate.js +29 -0
  3. package/dist/src/commands/generate.js.map +1 -0
  4. package/dist/src/commands/index.d.ts +1 -0
  5. package/dist/src/commands/index.js +1 -0
  6. package/dist/src/commands/index.js.map +1 -1
  7. package/dist/src/generator/actions.d.ts +4 -0
  8. package/dist/src/generator/actions.js +38 -0
  9. package/dist/src/generator/actions.js.map +1 -0
  10. package/dist/src/generator/configFieldsFlow.d.ts +7 -0
  11. package/dist/src/generator/configFieldsFlow.js +53 -0
  12. package/dist/src/generator/configFieldsFlow.js.map +1 -0
  13. package/dist/src/generator/entitiesFlow.d.ts +7 -0
  14. package/dist/src/generator/entitiesFlow.js +175 -0
  15. package/dist/src/generator/entitiesFlow.js.map +1 -0
  16. package/dist/src/generator/helpers.d.ts +2 -0
  17. package/dist/src/generator/helpers.js +9 -0
  18. package/dist/src/generator/helpers.js.map +1 -0
  19. package/dist/src/generator/newIntegration.d.ts +1 -0
  20. package/dist/src/generator/newIntegration.js +124 -0
  21. package/dist/src/generator/newIntegration.js.map +1 -0
  22. package/dist/src/generator/relationshipsFlow.d.ts +7 -0
  23. package/dist/src/generator/relationshipsFlow.js +65 -0
  24. package/dist/src/generator/relationshipsFlow.js.map +1 -0
  25. package/dist/src/generator/stepTemplate/index.ts.hbs +24 -0
  26. package/dist/src/generator/stepsFlow.d.ts +10 -0
  27. package/dist/src/generator/stepsFlow.js +94 -0
  28. package/dist/src/generator/stepsFlow.js.map +1 -0
  29. package/dist/src/generator/template/.env.example.hbs +3 -0
  30. package/dist/src/generator/template/.eslintignore.hbs +1 -0
  31. package/dist/src/generator/template/.eslintrc.hbs +6 -0
  32. package/dist/src/generator/template/.github/pull_request_template.md.hbs +17 -0
  33. package/dist/src/generator/template/.github/workflows/build.yml.hbs +53 -0
  34. package/dist/src/generator/template/.github/workflows/codeql-analysis.yml.hbs +69 -0
  35. package/dist/src/generator/template/.github/workflows/integration-deployment.yml.hbs +36 -0
  36. package/dist/src/generator/template/.github/workflows/peril.yml.hbs +90 -0
  37. package/dist/src/generator/template/.github/workflows/questions.yml.hbs +40 -0
  38. package/dist/src/generator/template/.gitignore.hbs +8 -0
  39. package/dist/src/generator/template/.node-version.hbs +1 -0
  40. package/dist/src/generator/template/.prettierignore.hbs +5 -0
  41. package/dist/src/generator/template/CHANGELOG.md.hbs +9 -0
  42. package/dist/src/generator/template/CODEOWNERS.hbs +3 -0
  43. package/dist/src/generator/template/Dockerfile.hbs +25 -0
  44. package/dist/src/generator/template/LICENSE.hbs +373 -0
  45. package/dist/src/generator/template/README.md.hbs +114 -0
  46. package/dist/src/generator/template/docs/development.md.hbs +28 -0
  47. package/dist/src/generator/template/docs/jupiterone.md.hbs +1 -0
  48. package/dist/src/generator/template/husky.config.js.hbs +1 -0
  49. package/dist/src/generator/template/jest.config.js.hbs +1 -0
  50. package/dist/src/generator/template/jupiterone/questions/questions.yaml.hbs +16 -0
  51. package/dist/src/generator/template/lint-staged.config.js.hbs +1 -0
  52. package/dist/src/generator/template/package.json.hbs +63 -0
  53. package/dist/src/generator/template/prettier.config.js.hbs +1 -0
  54. package/dist/src/generator/template/scripts/execute.sh.hbs +7 -0
  55. package/dist/src/generator/template/src/client.ts.hbs +23 -0
  56. package/dist/src/generator/template/src/config.ts.hbs +39 -0
  57. package/dist/src/generator/template/src/index.ts.hbs +14 -0
  58. package/dist/src/generator/template/src/steps/constants.ts.hbs +34 -0
  59. package/dist/src/generator/template/src/steps/index.ts.hbs +7 -0
  60. package/dist/src/generator/template/src/validateInvocation.ts.hbs +23 -0
  61. package/dist/src/generator/template/test/README.md.hbs +4 -0
  62. package/dist/src/generator/template/test/config.ts.hbs +30 -0
  63. package/dist/src/generator/template/test/recording.ts.hbs +74 -0
  64. package/dist/src/generator/template/tsconfig.dist.json.hbs +13 -0
  65. package/dist/src/generator/template/tsconfig.json.hbs +7 -0
  66. package/dist/src/generator/util.d.ts +9 -0
  67. package/dist/src/generator/util.js +35 -0
  68. package/dist/src/generator/util.js.map +1 -0
  69. package/dist/src/index.js +2 -1
  70. package/dist/src/index.js.map +1 -1
  71. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  72. package/package.json +12 -6
  73. package/src/commands/generate.ts +28 -0
  74. package/src/commands/index.ts +1 -0
  75. package/src/generator/actions.ts +37 -0
  76. package/src/generator/configFieldsFlow.ts +60 -0
  77. package/src/generator/entitiesFlow.ts +185 -0
  78. package/src/generator/helpers.ts +6 -0
  79. package/src/generator/newIntegration.ts +137 -0
  80. package/src/generator/relationshipsFlow.ts +73 -0
  81. package/src/generator/stepTemplate/index.ts.hbs +24 -0
  82. package/src/generator/stepsFlow.ts +123 -0
  83. package/src/generator/template/.env.example.hbs +3 -0
  84. package/src/generator/template/.eslintignore.hbs +1 -0
  85. package/src/generator/template/.eslintrc.hbs +6 -0
  86. package/src/generator/template/.github/pull_request_template.md.hbs +17 -0
  87. package/src/generator/template/.github/workflows/build.yml.hbs +53 -0
  88. package/src/generator/template/.github/workflows/codeql-analysis.yml.hbs +69 -0
  89. package/src/generator/template/.github/workflows/integration-deployment.yml.hbs +36 -0
  90. package/src/generator/template/.github/workflows/peril.yml.hbs +90 -0
  91. package/src/generator/template/.github/workflows/questions.yml.hbs +40 -0
  92. package/src/generator/template/.gitignore.hbs +8 -0
  93. package/src/generator/template/.node-version.hbs +1 -0
  94. package/src/generator/template/.prettierignore.hbs +5 -0
  95. package/src/generator/template/CHANGELOG.md.hbs +9 -0
  96. package/src/generator/template/CODEOWNERS.hbs +3 -0
  97. package/src/generator/template/Dockerfile.hbs +25 -0
  98. package/src/generator/template/LICENSE.hbs +373 -0
  99. package/src/generator/template/README.md.hbs +114 -0
  100. package/src/generator/template/docs/development.md.hbs +28 -0
  101. package/src/generator/template/docs/jupiterone.md.hbs +1 -0
  102. package/src/generator/template/husky.config.js.hbs +1 -0
  103. package/src/generator/template/jest.config.js.hbs +1 -0
  104. package/src/generator/template/jupiterone/questions/questions.yaml.hbs +16 -0
  105. package/src/generator/template/lint-staged.config.js.hbs +1 -0
  106. package/src/generator/template/package.json.hbs +63 -0
  107. package/src/generator/template/prettier.config.js.hbs +1 -0
  108. package/src/generator/template/scripts/execute.sh.hbs +7 -0
  109. package/src/generator/template/src/client.ts.hbs +23 -0
  110. package/src/generator/template/src/config.ts.hbs +39 -0
  111. package/src/generator/template/src/index.ts.hbs +14 -0
  112. package/src/generator/template/src/steps/constants.ts.hbs +34 -0
  113. package/src/generator/template/src/steps/index.ts.hbs +7 -0
  114. package/src/generator/template/src/validateInvocation.ts.hbs +23 -0
  115. package/src/generator/template/test/README.md.hbs +4 -0
  116. package/src/generator/template/test/config.ts.hbs +30 -0
  117. package/src/generator/template/test/recording.ts.hbs +74 -0
  118. package/src/generator/template/tsconfig.dist.json.hbs +13 -0
  119. package/src/generator/template/tsconfig.json.hbs +7 -0
  120. package/src/generator/util.ts +39 -0
  121. package/src/index.ts +3 -1
  122. package/tsconfig.dist.json +3 -1
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stepsFlow = void 0;
4
+ const util_1 = require("./util");
5
+ const integration_sdk_core_1 = require("@jupiterone/integration-sdk-core");
6
+ async function stepsFlow(inquirer, entities, relationships) {
7
+ const steps = [];
8
+ const { doPrompt } = await inquirer.prompt({
9
+ type: 'confirm',
10
+ name: 'doPrompt',
11
+ message: 'Do you want to declare any steps?',
12
+ });
13
+ if (!doPrompt)
14
+ return steps;
15
+ await (0, util_1.askRepeatedly)(inquirer, async () => {
16
+ const step = await createStep(inquirer, entities, relationships);
17
+ steps.push(step);
18
+ });
19
+ if (steps.length < 1)
20
+ return steps;
21
+ const useStepDependenciesFlow = await (0, util_1.confirmPrompt)(inquirer, 'Do you want to declare any step dependencies?');
22
+ if (!useStepDependenciesFlow)
23
+ return steps;
24
+ for (const [i, step] of steps.entries()) {
25
+ const { dependsOn } = await inquirer.prompt({
26
+ type: 'checkbox-plus',
27
+ name: 'dependsOn',
28
+ message: `Which steps does '${step.name}' directly depend on?`,
29
+ searchable: true,
30
+ pageSize: 10,
31
+ validate(input) {
32
+ return true;
33
+ },
34
+ source(ans, input) {
35
+ return new Promise((resolve) => {
36
+ const choices = choicesWithoutSelf(steps, i);
37
+ if (input) {
38
+ const filteredChoices = searchSteps(steps, input);
39
+ resolve(filteredChoices);
40
+ }
41
+ else {
42
+ resolve(choices);
43
+ }
44
+ });
45
+ },
46
+ });
47
+ step.dependsOn = dependsOn;
48
+ }
49
+ return steps;
50
+ }
51
+ exports.stepsFlow = stepsFlow;
52
+ function choicesWithoutSelf(steps, stepIndex) {
53
+ return steps
54
+ .filter((_, ix) => ix !== stepIndex)
55
+ .map((v) => ({ name: v.name, value: v.name }));
56
+ }
57
+ function searchSteps(steps, searchString) {
58
+ return steps.filter((v) => v.name.toLowerCase().includes(searchString.toLowerCase()));
59
+ }
60
+ async function createStep(inquirer, entities, relationships) {
61
+ const { name } = await inquirer.prompt({
62
+ type: 'input',
63
+ name: 'name',
64
+ message: 'What should the steps name be?',
65
+ });
66
+ const { stepEntities } = await inquirer.prompt({
67
+ type: 'checkbox',
68
+ name: 'stepEntities',
69
+ message: 'What entities will this step produce?',
70
+ choices: (0, util_1.generateChoicesFromEntities)(entities),
71
+ });
72
+ const { stepRelationships } = await inquirer.prompt({
73
+ type: 'checkbox',
74
+ name: 'stepRelationships',
75
+ message: 'What relationships will this step produce?',
76
+ choices: generateRelationshipChoices(relationships),
77
+ });
78
+ return {
79
+ name,
80
+ entities: stepEntities,
81
+ relationships: stepRelationships,
82
+ };
83
+ }
84
+ function generateRelationshipChoices(relationships) {
85
+ const choices = [];
86
+ for (const rel of relationships) {
87
+ choices.push({
88
+ name: (0, integration_sdk_core_1.generateRelationshipType)(rel._class, rel.from, rel.to),
89
+ value: rel,
90
+ });
91
+ }
92
+ return choices;
93
+ }
94
+ //# sourceMappingURL=stepsFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepsFlow.js","sourceRoot":"","sources":["../../../src/generator/stepsFlow.ts"],"names":[],"mappings":";;;AAAA,iCAIgB;AAChB,2EAA4E;AAW5E,KAAK,UAAU,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa;IACxD,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACzC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,mCAAmC;KAC7C,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,IAAA,oBAAa,EAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QACjE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAEnC,MAAM,uBAAuB,GAAG,MAAM,IAAA,oBAAa,EACjD,QAAQ,EACR,+CAA+C,CAChD,CAAC;IAEF,IAAI,CAAC,uBAAuB;QAAE,OAAO,KAAK,CAAC;IAE3C,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;QACvC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YAC1C,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,qBAAqB,IAAI,CAAC,IAAI,uBAAuB;YAC9D,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,EAAE;YACZ,QAAQ,CAAC,KAAK;gBACZ,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,CAAC,GAAG,EAAE,KAAK;gBACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC7B,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;oBAC7C,IAAI,KAAK,EAAE;wBACT,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;wBAClD,OAAO,CAAC,eAAe,CAAC,CAAC;qBAC1B;yBAAM;wBACL,OAAO,CAAC,OAAO,CAAC,CAAC;qBAClB;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAuDQ,8BAAS;AArDlB,SAAS,kBAAkB,CAAC,KAAa,EAAE,SAAS;IAClD,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,YAAoB;IACtD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACxB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa;IACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,gCAAgC;KAC1C,CAAC,CAAC;IAEH,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,uCAAuC;QAChD,OAAO,EAAE,IAAA,kCAA2B,EAAC,QAAQ,CAAC;KAC/C,CAAC,CAAC;IAEH,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAClD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,2BAA2B,CAAC,aAAa,CAAC;KACpD,CAAC,CAAC;IAEH,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,iBAAiB;KACjC,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,aAAa;IAChD,MAAM,OAAO,GAA4C,EAAE,CAAC;IAE5D,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;QAC/B,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,IAAA,+CAAwB,EAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YAC5D,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;KACJ;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ {{#each configFields}}
2
+ {{constantCase field}}=
3
+ {{/each}}
@@ -0,0 +1,6 @@
1
+ {
2
+ "root": true,
3
+ "extends": [
4
+ "./node_modules/@jupiterone/integration-sdk-dev-tools/config/eslint.json"
5
+ ]
6
+ }
@@ -0,0 +1,17 @@
1
+ # Description
2
+
3
+ Thank you for contributing to a JupiterOne integration!
4
+
5
+ ## Summary
6
+
7
+ <!-- Summary here! -->
8
+
9
+ ## Type of change
10
+
11
+ Please leave any irrelevant options unchecked.
12
+
13
+ - [ ] Bug fix (non-breaking change which fixes an issue)
14
+ - [ ] New feature (non-breaking change which adds functionality)
15
+ - [ ] Breaking change (fix or feature that would cause existing functionality to
16
+ not work as expected)
17
+ - [ ] This change requires a documentation update
@@ -0,0 +1,53 @@
1
+ name: Build
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Check out code repository source code
13
+ uses: actions/checkout@v3
14
+
15
+ - id: setup-node
16
+ name: Setup Node
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 18.x
20
+ cache: yarn
21
+
22
+ - name: Install dependencies
23
+ run: yarn --frozen-lockfile
24
+
25
+ - name: Run tests
26
+ run: yarn test:ci
27
+
28
+ - name: Run build
29
+ run: yarn build
30
+
31
+ # Publishing is done in a separate job to allow
32
+ # for all matrix builds to complete.
33
+ BuildRelease:
34
+ needs: test
35
+ runs-on: ubuntu-latest
36
+ if: github.ref == 'refs/heads/main'
37
+ name: Checkout Code
38
+ steps:
39
+ - name: Check out repo
40
+ uses: actions/checkout@v3
41
+ with:
42
+ fetch-depth: 0
43
+ token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}
44
+ - name: Setup Node
45
+ uses: actions/setup-node@v3
46
+ with:
47
+ node-version: 18.x
48
+ cache: yarn
49
+ - name: Build and Release
50
+ uses: jupiterone/action-npm-build-release@v1
51
+ with:
52
+ npm_auth_token: ${{ secrets.NPM_AUTH_TOKEN }}
53
+ gh_token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}
@@ -0,0 +1,69 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: 'CodeQL'
13
+
14
+ on:
15
+ push:
16
+ branches: ['main']
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: ['main']
20
+
21
+ jobs:
22
+ analyze:
23
+ name: Analyze
24
+ runs-on: ubuntu-latest
25
+ permissions:
26
+ actions: read
27
+ contents: read
28
+ security-events: write
29
+
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ language: ['javascript']
34
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
35
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
36
+
37
+ steps:
38
+ - name: Checkout repository
39
+ uses: actions/checkout@v3
40
+
41
+ # Initializes the CodeQL tools for scanning.
42
+ - name: Initialize CodeQL
43
+ uses: github/codeql-action/init@v2
44
+ with:
45
+ languages: ${{ matrix.language }}
46
+ # If you wish to specify custom queries, you can do so here or in a config file.
47
+ # By default, queries listed here will override any specified in a config file.
48
+ # Prefix the list here with "+" to use these queries and those in the config file.
49
+
50
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
51
+ queries: security-extended,security-and-quality
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v2
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60
+
61
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
62
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63
+
64
+ # - run: |
65
+ # echo "Run, Build Application using script"
66
+ # ./location_of_script_within_repo/buildscript.sh
67
+
68
+ - name: Perform CodeQL Analysis
69
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,36 @@
1
+ name: J1 Integration deployment
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ jobs:
9
+ j1-integration-deployment:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Get integration name
13
+ id: get-integration-name
14
+ uses: actions/github-script@0.9.0
15
+ with:
16
+ script: |
17
+ const repositoryName = context.payload.repository.name
18
+ const integrationName = repositoryName.replace("graph-", "")
19
+ core.setOutput('integrationName', integrationName)
20
+ - name: Get version number
21
+ id: get-version-number
22
+ uses: actions/github-script@0.9.0
23
+ with:
24
+ script: |
25
+ const tagName = context.payload.release.tag_name
26
+ const versionNumber = tagName.replace("v", "")
27
+ core.setOutput('versionNumber', versionNumber)
28
+ - name: Bump integration deployment version
29
+ uses: JupiterOne/integration-github-actions/create-integration-deployment@v1
30
+ with:
31
+ integrationName:
32
+ ${{ steps.get-integration-name.outputs.integrationName }}
33
+ releaseNotes: ${{ github.event.release.body }}
34
+ version: ${{ steps.get-version-number.outputs.versionNumber }}
35
+ githubToken: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}
36
+ npmAuthToken: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -0,0 +1,90 @@
1
+ name: 'Peril'
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ env:
7
+ TRANSPONDER_DOCKER_IMAGE: 081157560428.dkr.ecr.us-east-1.amazonaws.com/transponder:1
8
+ SECURITY_SCAN_IMAGE: ghcr.io/jupiterone/security-scan:latest
9
+
10
+ jobs:
11
+ Peril:
12
+ name: Peril
13
+ permissions:
14
+ id-token: write
15
+ contents: read
16
+ packages: read
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v3
22
+
23
+ - name: Setup Node
24
+ uses: actions/setup-node@v1
25
+ with:
26
+ node-version: 18.x
27
+
28
+ - name: Run build
29
+ run: yarn install
30
+
31
+ - name: Get Variables
32
+ id: get-vars
33
+ run: |
34
+ if [[ "${GITHUB_REF}" == 'ref/head/main' && "${GITHUB_EVENT_NAME}" == 'push' ]];
35
+ then
36
+ echo ::set-output name=aws-oidc-role::arn:aws:iam::081157560428:role/github-main-role
37
+ else
38
+ echo ::set-output name=aws-oidc-role::arn:aws:iam::081157560428:role/github-pull-request-role
39
+ fi
40
+
41
+ - name: Configure aws credentials
42
+ uses: aws-actions/configure-aws-credentials@v1
43
+ with:
44
+ role-to-assume: ${{ steps.get-vars.outputs.aws-oidc-role }}
45
+ role-session-name: pr-role-session
46
+ aws-region: us-east-1
47
+
48
+ - name: ECR login
49
+ uses: aws-actions/amazon-ecr-login@v1
50
+ id: amazon-ecr-login
51
+
52
+ - name: Login to GHCR
53
+ uses: docker/login-action@v2
54
+ with:
55
+ registry: ghcr.io
56
+ username: ${{ github.actor }}
57
+ password: ${{ secrets.PACKAGE_TOKEN }}
58
+
59
+ - name: Pull security-scan
60
+ run: |
61
+ docker pull $SECURITY_SCAN_IMAGE
62
+
63
+ - name: Run security-scan
64
+ run: |
65
+ docker run \
66
+ --user root \
67
+ -v /var/run/docker.sock:/var/run/docker.sock \
68
+ -v `pwd`:`pwd` \
69
+ -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} \
70
+ -e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
71
+ -e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
72
+ -e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
73
+ -e GITHUB_REF_NAME=$GITHUB_REF_NAME \
74
+ -e GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER \
75
+ -e GITHUB_SERVER_URL=$GITHUB_SERVER_URL \
76
+ -e GITHUB_RUN_ID=$GITHUB_RUN_ID \
77
+ -e MODE=ci \
78
+ -w `pwd` $SECURITY_SCAN_IMAGE
79
+
80
+ - name: Pull transponder
81
+ run: |
82
+ docker pull $TRANSPONDER_DOCKER_IMAGE
83
+
84
+ - name: Run transponder
85
+ run: |
86
+ docker run --rm -v `pwd`:`pwd` -w `pwd` \
87
+ -e J1_API_KEY=${{ secrets.J1_API_KEY_TRANSPONDER }} \
88
+ -e J1_API_DOMAIN=${{ secrets.J1_API_DOMAIN_TRANSPONDER }} \
89
+ -e J1_ACCOUNT_ID=${{ secrets.J1_ACCOUNT_ID_TRANSPONDER }} \
90
+ $TRANSPONDER_DOCKER_IMAGE
@@ -0,0 +1,40 @@
1
+ name: Questions
2
+ on: [pull_request_target]
3
+
4
+ jobs:
5
+ validate:
6
+ runs-on: ubuntu-latest
7
+
8
+ steps:
9
+ - name: Check out `main` branch
10
+ uses: actions/checkout@v3
11
+ with:
12
+ path: source
13
+
14
+ - name: Check out target branch questions
15
+ uses: actions/checkout@v3
16
+ with:
17
+ ref: ${{github.event.pull_request.head.ref}}
18
+ repository: ${{github.event.pull_request.head.repo.full_name}}
19
+ path: target
20
+
21
+ - id: setup-node
22
+ name: Setup Node
23
+ uses: actions/setup-node@v3
24
+ with:
25
+ node-version: 18.x
26
+
27
+ - name: Install dependencies for `main` branch
28
+ run: yarn install --cwd source --frozen-lockfile
29
+
30
+ - name: Validate questions on target branch
31
+ env:
32
+ MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID:
33
+ ${{ secrets.MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID }}
34
+ MANAGED_QUESTIONS_JUPITERONE_API_KEY:
35
+ ${{ secrets.MANAGED_QUESTIONS_JUPITERONE_API_KEY }}
36
+ run:
37
+ yarn --cwd source j1-integration validate-question-file -a
38
+ --frozen-lockfile $MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k
39
+ $MANAGED_QUESTIONS_JUPITERONE_API_KEY -p
40
+ ../target/jupiterone/questions/questions.yaml
@@ -0,0 +1,8 @@
1
+ node_modules/
2
+ dist/
3
+ .j1-integration/
4
+ .j1-integration-cache/
5
+ .env
6
+ .eslintcache
7
+ tsconfig.tsbuildinfo
8
+ .npmrc
@@ -0,0 +1,5 @@
1
+ dist
2
+ coverage/
3
+ .j1-integration
4
+ .j1-integration-cache
5
+ .gitleaks.yml
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to
7
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [Unreleased]
@@ -0,0 +1,3 @@
1
+ * @jupiterone/integrations
2
+
3
+ CODEOWNERS @jupiterone/security
@@ -0,0 +1,25 @@
1
+ FROM node:18-bullseye-slim as builder
2
+
3
+ ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration
4
+
5
+ COPY package.json yarn.lock tsconfig.dist.json tsconfig.json LICENSE ${JUPITERONE_INTEGRATION_DIR}/
6
+ COPY src/ ${JUPITERONE_INTEGRATION_DIR}/src
7
+ WORKDIR ${JUPITERONE_INTEGRATION_DIR}
8
+ RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/api/lists/*
9
+ RUN yarn install
10
+ RUN yarn build:docker
11
+
12
+
13
+ FROM node:18-bullseye-slim
14
+ ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration
15
+ COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/dist ${JUPITERONE_INTEGRATION_DIR}
16
+ COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/yarn.lock ${JUPITERONE_INTEGRATION_DIR}
17
+ COPY scripts/ ${JUPITERONE_INTEGRATION_DIR}/scripts
18
+ WORKDIR ${JUPITERONE_INTEGRATION_DIR}
19
+ RUN apt-get update && apt-get install -y python3
20
+ RUN yarn install --production --fronzen-lockfile --cache-folder ./ycache && yarn global add --cache-folder ./ycache @jupiterone/integration-sdk-cli && rm -rf ./ycache && chown -R node:node /opt/jupiterone
21
+ RUN export PATH="$(yarn global bin):$PATH"
22
+
23
+ USER node
24
+
25
+ CMD ["sh", "scripts/execute.sh"]