@aikidosec/ci-api-client 1.0.1 → 1.0.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.
- package/.editorconfig +18 -18
- package/.env +1 -1
- package/.prettierrc +10 -10
- package/CONTRIBUTING.md +30 -30
- package/LICENSE +21 -21
- package/README.md +80 -78
- package/RELEASING.md +26 -26
- package/lib/aikidoApi.d.ts +60 -60
- package/lib/aikidoApi.js +52 -52
- package/lib/commands/apiKey.d.ts +8 -8
- package/lib/commands/apiKey.js +20 -18
- package/lib/commands/scan.d.ts +36 -36
- package/lib/commands/scan.js +188 -188
- package/lib/commands/upload.d.ts +23 -23
- package/lib/commands/upload.js +94 -94
- package/lib/configuration.d.ts +4 -4
- package/lib/configuration.js +13 -13
- package/lib/index.d.ts +12 -12
- package/lib/index.js +31 -31
- package/lib/output.d.ts +7 -7
- package/lib/output.js +53 -53
- package/package.json +51 -51
- package/src/aikidoApi.ts +148 -148
- package/src/commands/apiKey.ts +33 -30
- package/src/commands/scan.ts +370 -370
- package/src/commands/upload.ts +184 -184
- package/src/configuration.ts +21 -21
- package/src/index.ts +64 -64
- package/src/output.ts +87 -87
- package/tsconfig.json +27 -27
package/.editorconfig
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
indent_style = space
|
|
6
|
-
indent_size = 2
|
|
7
|
-
end_of_line = lf
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.{json,iml}]
|
|
12
|
-
indent_style = space
|
|
13
|
-
indent_size = 2
|
|
14
|
-
insert_final_newline = false
|
|
15
|
-
|
|
16
|
-
[*.{diff,md,markdown}]
|
|
17
|
-
trim_trailing_whitespace = false
|
|
18
|
-
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
indent_style = space
|
|
6
|
+
indent_size = 2
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.{json,iml}]
|
|
12
|
+
indent_style = space
|
|
13
|
+
indent_size = 2
|
|
14
|
+
insert_final_newline = false
|
|
15
|
+
|
|
16
|
+
[*.{diff,md,markdown}]
|
|
17
|
+
trim_trailing_whitespace = false
|
|
18
|
+
|
package/.env
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
AIKIDO_API=https://app.aikido.dev
|
|
1
|
+
AIKIDO_API=https://app.aikido.dev
|
package/.prettierrc
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"trailingComma": "es5",
|
|
3
|
-
"printWidth": 80,
|
|
4
|
-
"tabWidth": 2,
|
|
5
|
-
"semi": true,
|
|
6
|
-
"singleQuote": true,
|
|
7
|
-
"arrowParens": "avoid",
|
|
8
|
-
"bracketSameLine": false,
|
|
9
|
-
"bracketSpacing": true
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"trailingComma": "es5",
|
|
3
|
+
"printWidth": 80,
|
|
4
|
+
"tabWidth": 2,
|
|
5
|
+
"semi": true,
|
|
6
|
+
"singleQuote": true,
|
|
7
|
+
"arrowParens": "avoid",
|
|
8
|
+
"bracketSameLine": false,
|
|
9
|
+
"bracketSpacing": true
|
|
10
|
+
}
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# Contributing to aikido-api-client
|
|
2
|
-
|
|
3
|
-
Are you missing functionality or have you found a bug? Please feel free to add an issue or submit a PR. We try to be responsive and release updates and fixes as fast as possible.
|
|
4
|
-
|
|
5
|
-
## Reporting issues
|
|
6
|
-
|
|
7
|
-
This package uses the [GitHub Issue Tracker](https://github.com/AikidoSec/aikido-api-client/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
|
|
8
|
-
|
|
9
|
-
## Contributing code
|
|
10
|
-
|
|
11
|
-
If you want to add additional tags, attributes or functionality to the library, please feel free to create a [pull request](https://github.com/AikidoSec/aikido-api-client/pulls) with your changes.
|
|
12
|
-
|
|
13
|
-
Please try to follow this workflow:
|
|
14
|
-
|
|
15
|
-
- Fork the project
|
|
16
|
-
- Create a new branch forked from the main branch with a title for your feature (e.g. feature-that-i-want)
|
|
17
|
-
- Commit all your code into this branch until you are happy with your contribution
|
|
18
|
-
- Create a pull request with your commits
|
|
19
|
-
|
|
20
|
-
## Formatting ⚠️
|
|
21
|
-
|
|
22
|
-
Please try to follow editor settings provided in `.editorconfig` and `.prettierrc`. If you are using an editor like VS Code your editor should automatically parse these files and auto-format your files on save. If not, you can re-format all source files with the following command:
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
$ yarn format
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Unit testing ⚠️
|
|
29
|
-
|
|
30
|
-
No unit tests are currently available for the cli tool.
|
|
1
|
+
# Contributing to aikido-api-client
|
|
2
|
+
|
|
3
|
+
Are you missing functionality or have you found a bug? Please feel free to add an issue or submit a PR. We try to be responsive and release updates and fixes as fast as possible.
|
|
4
|
+
|
|
5
|
+
## Reporting issues
|
|
6
|
+
|
|
7
|
+
This package uses the [GitHub Issue Tracker](https://github.com/AikidoSec/aikido-api-client/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
|
|
8
|
+
|
|
9
|
+
## Contributing code
|
|
10
|
+
|
|
11
|
+
If you want to add additional tags, attributes or functionality to the library, please feel free to create a [pull request](https://github.com/AikidoSec/aikido-api-client/pulls) with your changes.
|
|
12
|
+
|
|
13
|
+
Please try to follow this workflow:
|
|
14
|
+
|
|
15
|
+
- Fork the project
|
|
16
|
+
- Create a new branch forked from the main branch with a title for your feature (e.g. feature-that-i-want)
|
|
17
|
+
- Commit all your code into this branch until you are happy with your contribution
|
|
18
|
+
- Create a pull request with your commits
|
|
19
|
+
|
|
20
|
+
## Formatting ⚠️
|
|
21
|
+
|
|
22
|
+
Please try to follow editor settings provided in `.editorconfig` and `.prettierrc`. If you are using an editor like VS Code your editor should automatically parse these files and auto-format your files on save. If not, you can re-format all source files with the following command:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
$ yarn format
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Unit testing ⚠️
|
|
29
|
+
|
|
30
|
+
No unit tests are currently available for the cli tool.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Aikido Security BV and contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Aikido Security BV and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,78 +1,80 @@
|
|
|
1
|
-
# Aikido Security CI API client
|
|
2
|
-
|
|
3
|
-
<!-- [](https://www.npmjs.org/package/aikido-api-client)
|
|
4
|
-
[](https://npmcharts.com/compare/aikido-api-client?minimal=true)
|
|
5
|
-
[](https://packagephobia.now.sh/result?p=aikido-api-client) -->
|
|
6
|
-
|
|
7
|
-
CLI helper for the public [Aikido CI API](https://aikido-dev.notion.site/aikido-dev/Aikido-CI-API-78d318b5f5f7477ab072e12f94b21374). This cli tool can help integrate Aikido into a custom CI pipeline without having to implement the Aikido CI API yourself.
|
|
8
|
-
|
|
9
|
-
## Installation and setup
|
|
10
|
-
|
|
11
|
-
The quickest way to get started is to install the cli tool as a global package.
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
# npm users
|
|
15
|
-
$ npm install -g @aikidosec/ci-api-client
|
|
16
|
-
|
|
17
|
-
# yarn users
|
|
18
|
-
$ yarn global add @aikidosec/ci-api-client
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
After installation, you'll need to setup your Aikido API key. You can add your key by requesting a token on the [Continuous Integrations page](https://app.aikido.dev/settings/integrations/continuous-integration) in the [Integrations](https://app.aikido.dev/settings/integrations) section of the Aikido web platform. Click the "Start integrating" link and setup your key globally by executing
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
$ aikido-api-client apikey <your-api-key-here>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
⚠️ Your Aikido API key is stored in `~/.config/configstore/aikido-api-client.json`. If you don't want this behaviour (e.g. for security related issues), you can also provide your API key to `aikido-api-client` by adding `--apikey <your-api-key-here>` to every command. However, for the examples below, we'll assume you've used `aikido-api-client apikey <your-api-key-here>` to save your API key. If `--apikey` is provided while a key is set in the configuration file on disk, the key that was provided with `--apikey` will be used.
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
Using the `aikido-api-client` to start new scans is very straightforward.
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
$ aikido-api-client scan <repository_id> <base_commit_id> <head_commit_id>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The process will report scan progress and will exit with exitCode `0` if the scan was successfull (`gate_passed: true`). The process will exit with exitCode `10` if the scan was unsuccesfull (`gate_passed: false`). If anything else goes wrong (e.g. API unavailable, scanning unavailable, other unexpected issue) the process will exit with exitCode `1`.
|
|
38
|
-
|
|
39
|
-
If you want the scan to run quietly (without output), you can add the `--quiet` option to the command.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- [Aikido
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
# Aikido Security CI API client
|
|
2
|
+
|
|
3
|
+
<!-- [](https://www.npmjs.org/package/aikido-api-client)
|
|
4
|
+
[](https://npmcharts.com/compare/aikido-api-client?minimal=true)
|
|
5
|
+
[](https://packagephobia.now.sh/result?p=aikido-api-client) -->
|
|
6
|
+
|
|
7
|
+
CLI helper for the public [Aikido CI API](https://aikido-dev.notion.site/aikido-dev/Aikido-CI-API-78d318b5f5f7477ab072e12f94b21374). This cli tool can help integrate Aikido into a custom CI pipeline without having to implement the Aikido CI API yourself.
|
|
8
|
+
|
|
9
|
+
## Installation and setup
|
|
10
|
+
|
|
11
|
+
The quickest way to get started is to install the cli tool as a global package.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
# npm users
|
|
15
|
+
$ npm install -g @aikidosec/ci-api-client
|
|
16
|
+
|
|
17
|
+
# yarn users
|
|
18
|
+
$ yarn global add @aikidosec/ci-api-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
After installation, you'll need to setup your Aikido API key. You can add your key by requesting a token on the [Continuous Integrations page](https://app.aikido.dev/settings/integrations/continuous-integration) in the [Integrations](https://app.aikido.dev/settings/integrations) section of the Aikido web platform. Click the "Start integrating" link and setup your key globally by executing
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
$ aikido-api-client apikey <your-api-key-here>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
⚠️ Your Aikido API key is stored in `~/.config/configstore/aikido-api-client.json`. If you don't want this behaviour (e.g. for security related issues), you can also provide your API key to `aikido-api-client` by adding `--apikey <your-api-key-here>` to every command. However, for the examples below, we'll assume you've used `aikido-api-client apikey <your-api-key-here>` to save your API key. If `--apikey` is provided while a key is set in the configuration file on disk, the key that was provided with `--apikey` will be used.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Using the `aikido-api-client` to start new scans is very straightforward.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
$ aikido-api-client scan <repository_id> <base_commit_id> <head_commit_id>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The process will report scan progress and will exit with exitCode `0` if the scan was successfull (`gate_passed: true`). The process will exit with exitCode `10` if the scan was unsuccesfull (`gate_passed: false`). If anything else goes wrong (e.g. API unavailable, scanning unavailable, other unexpected issue) the process will exit with exitCode `1`.
|
|
38
|
+
|
|
39
|
+
If you want the scan to run quietly (without output), you can add the `--quiet` option to the command.
|
|
40
|
+
|
|
41
|
+
Please note that the repository_id which you need to provide to the CLI is the unique ID of the Git provider you are using, not the ID of the repository in Aikido. You can also find this ID in Aikido, by going to the repository's detail page and clicking on the Git provider's icon in the header.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
# For more options and combinations, check the help output
|
|
45
|
+
$ aikido-api-client help scan
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Uploading custom test results:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
$ aikido-api-client upload --repository-id <repository_id> --type checkov --file <path_to_payload_file>
|
|
52
|
+
|
|
53
|
+
# For more options and combinations, check the help output
|
|
54
|
+
$ aikido-api-client help upload
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For more information about these parameters, please refer to `aikido-api-client help`, `aikido-api-client help scan` or `aikido-api-client help upload`, or [the public ci api page](https://aikido-dev.notion.site/aikido-dev/Aikido-CI-API-78d318b5f5f7477ab072e12f94b21374).
|
|
58
|
+
|
|
59
|
+
## Help & contributing
|
|
60
|
+
|
|
61
|
+
For more information about all available commands and options, execute:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
$ aikido-api-client help
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
$ aikido-api-client help <command>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If you are missing functionality in this cli tool, please feel free to add it. If you've detected a bug, please submit a PR. Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Other resources
|
|
75
|
+
|
|
76
|
+
- [Aikido Official Website](https://aikido.dev)
|
|
77
|
+
- [Aikido Github Actions Workflow](https://github.com/AikidoSec/github-actions-workflow)
|
|
78
|
+
- [Aikido on Twitter](https://twitter.com/AikidoSecurity)
|
|
79
|
+
|
|
80
|
+
|
package/RELEASING.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Releasing
|
|
2
|
-
|
|
3
|
-
## Creating a new version
|
|
4
|
-
|
|
5
|
-
Increment the version of the package by updating the version in `package.json`
|
|
6
|
-
or by updating the package using `npm version`.
|
|
7
|
-
|
|
8
|
-
```sh
|
|
9
|
-
$ cd aikido-api-client
|
|
10
|
-
$ npm version
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Releasing a new version
|
|
14
|
-
|
|
15
|
-
Make sure to re-buidl all Typescript files using `yarn build`. Release a new version by publishing the package to npm using `npm publish`.
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
$ cd aikido-api-client
|
|
19
|
-
$ yarn build
|
|
20
|
-
$ npm publish
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
*or*
|
|
24
|
-
|
|
25
|
-
Setup the "Publish Node.js Package" action in the aikido-api-client Github.com repo.
|
|
26
|
-
See also: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
## Creating a new version
|
|
4
|
+
|
|
5
|
+
Increment the version of the package by updating the version in `package.json`
|
|
6
|
+
or by updating the package using `npm version`.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
$ cd aikido-api-client
|
|
10
|
+
$ npm version
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Releasing a new version
|
|
14
|
+
|
|
15
|
+
Make sure to re-buidl all Typescript files using `yarn build`. Release a new version by publishing the package to npm using `npm publish`.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
$ cd aikido-api-client
|
|
19
|
+
$ yarn build
|
|
20
|
+
$ npm publish
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
*or*
|
|
24
|
+
|
|
25
|
+
Setup the "Publish Node.js Package" action in the aikido-api-client Github.com repo.
|
|
26
|
+
See also: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
package/lib/aikidoApi.d.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
export type TScanApiOptions = {
|
|
2
|
-
repository_id?: string | number;
|
|
3
|
-
base_commit_id?: string;
|
|
4
|
-
head_commit_id?: string;
|
|
5
|
-
branch_name?: string;
|
|
6
|
-
pull_request_metadata?: {
|
|
7
|
-
title?: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
};
|
|
10
|
-
self_managed_scanners?: string[];
|
|
11
|
-
fail_on_dependency_scan?: boolean;
|
|
12
|
-
fail_on_sast_scan?: boolean;
|
|
13
|
-
fail_on_iac_scan?: boolean;
|
|
14
|
-
minimum_severity?: string;
|
|
15
|
-
version: string;
|
|
16
|
-
};
|
|
17
|
-
export type TStartScanResult = {
|
|
18
|
-
scan_id: number;
|
|
19
|
-
};
|
|
20
|
-
export declare function startScan(data: TScanApiOptions): Promise<TStartScanResult>;
|
|
21
|
-
export type TPollIsScanningResult = {
|
|
22
|
-
all_scans_completed: boolean;
|
|
23
|
-
dependency_scan_completed: boolean;
|
|
24
|
-
sast_scan_completed: boolean;
|
|
25
|
-
iac_scan_completed: boolean;
|
|
26
|
-
sbom_scan_completed?: boolean;
|
|
27
|
-
};
|
|
28
|
-
type TPollScanCompletedOptions = {
|
|
29
|
-
gate_passed: boolean;
|
|
30
|
-
};
|
|
31
|
-
type TPollScanFeatureBranchCompletedOptions = {
|
|
32
|
-
new_issues_found: number;
|
|
33
|
-
new_dependency_issues_found: number;
|
|
34
|
-
new_sast_issues_found: number;
|
|
35
|
-
new_iac_issues_found: number;
|
|
36
|
-
diff_url: string;
|
|
37
|
-
};
|
|
38
|
-
type TPollScanDefaultBranchCompletedOptions = {
|
|
39
|
-
open_issues_found: number;
|
|
40
|
-
issue_links: string[];
|
|
41
|
-
};
|
|
42
|
-
export type TPollScanFeatureBranchCompletedResult = TPollIsScanningResult & TPollScanCompletedOptions & TPollScanFeatureBranchCompletedOptions;
|
|
43
|
-
export type TPollScanCompletedDefaultBranchResult = TPollIsScanningResult & TPollScanCompletedOptions & TPollScanDefaultBranchCompletedOptions;
|
|
44
|
-
export declare function pollScanStatus(scanId: number): Promise<TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult>;
|
|
45
|
-
export declare enum TUploadPayloadType {
|
|
46
|
-
Checkov = "checkov",
|
|
47
|
-
JsonSbom = "json-sbom"
|
|
48
|
-
}
|
|
49
|
-
export type TUploadApiOptions = {
|
|
50
|
-
scan_id?: number;
|
|
51
|
-
repository_id: string | number;
|
|
52
|
-
container_image_name?: string;
|
|
53
|
-
payload_type: TUploadPayloadType;
|
|
54
|
-
payload: string;
|
|
55
|
-
};
|
|
56
|
-
export type TUploadResult = {
|
|
57
|
-
success: number;
|
|
58
|
-
};
|
|
59
|
-
export declare function uploadCustomScanResult(data: TUploadApiOptions): Promise<TUploadResult>;
|
|
60
|
-
export {};
|
|
1
|
+
export type TScanApiOptions = {
|
|
2
|
+
repository_id?: string | number;
|
|
3
|
+
base_commit_id?: string;
|
|
4
|
+
head_commit_id?: string;
|
|
5
|
+
branch_name?: string;
|
|
6
|
+
pull_request_metadata?: {
|
|
7
|
+
title?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
};
|
|
10
|
+
self_managed_scanners?: string[];
|
|
11
|
+
fail_on_dependency_scan?: boolean;
|
|
12
|
+
fail_on_sast_scan?: boolean;
|
|
13
|
+
fail_on_iac_scan?: boolean;
|
|
14
|
+
minimum_severity?: string;
|
|
15
|
+
version: string;
|
|
16
|
+
};
|
|
17
|
+
export type TStartScanResult = {
|
|
18
|
+
scan_id: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function startScan(data: TScanApiOptions): Promise<TStartScanResult>;
|
|
21
|
+
export type TPollIsScanningResult = {
|
|
22
|
+
all_scans_completed: boolean;
|
|
23
|
+
dependency_scan_completed: boolean;
|
|
24
|
+
sast_scan_completed: boolean;
|
|
25
|
+
iac_scan_completed: boolean;
|
|
26
|
+
sbom_scan_completed?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type TPollScanCompletedOptions = {
|
|
29
|
+
gate_passed: boolean;
|
|
30
|
+
};
|
|
31
|
+
type TPollScanFeatureBranchCompletedOptions = {
|
|
32
|
+
new_issues_found: number;
|
|
33
|
+
new_dependency_issues_found: number;
|
|
34
|
+
new_sast_issues_found: number;
|
|
35
|
+
new_iac_issues_found: number;
|
|
36
|
+
diff_url: string;
|
|
37
|
+
};
|
|
38
|
+
type TPollScanDefaultBranchCompletedOptions = {
|
|
39
|
+
open_issues_found: number;
|
|
40
|
+
issue_links: string[];
|
|
41
|
+
};
|
|
42
|
+
export type TPollScanFeatureBranchCompletedResult = TPollIsScanningResult & TPollScanCompletedOptions & TPollScanFeatureBranchCompletedOptions;
|
|
43
|
+
export type TPollScanCompletedDefaultBranchResult = TPollIsScanningResult & TPollScanCompletedOptions & TPollScanDefaultBranchCompletedOptions;
|
|
44
|
+
export declare function pollScanStatus(scanId: number): Promise<TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult>;
|
|
45
|
+
export declare enum TUploadPayloadType {
|
|
46
|
+
Checkov = "checkov",
|
|
47
|
+
JsonSbom = "json-sbom"
|
|
48
|
+
}
|
|
49
|
+
export type TUploadApiOptions = {
|
|
50
|
+
scan_id?: number;
|
|
51
|
+
repository_id: string | number;
|
|
52
|
+
container_image_name?: string;
|
|
53
|
+
payload_type: TUploadPayloadType;
|
|
54
|
+
payload: string;
|
|
55
|
+
};
|
|
56
|
+
export type TUploadResult = {
|
|
57
|
+
success: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function uploadCustomScanResult(data: TUploadApiOptions): Promise<TUploadResult>;
|
|
60
|
+
export {};
|
package/lib/aikidoApi.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { getApiKey } from './configuration.js';
|
|
3
|
-
import { outputDebug } from './output.js';
|
|
4
|
-
const getApiUrl = () => process.env.AIKIDO_API || 'https://app.aikido.dev';
|
|
5
|
-
const getApiHeaders = () => ({
|
|
6
|
-
'Content-Type': 'application/json',
|
|
7
|
-
'X-AIK-API-SECRET': getApiKey(),
|
|
8
|
-
});
|
|
9
|
-
export async function startScan(data) {
|
|
10
|
-
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/repository`;
|
|
11
|
-
const requestConfig = {
|
|
12
|
-
method: 'POST',
|
|
13
|
-
data,
|
|
14
|
-
headers: getApiHeaders(),
|
|
15
|
-
};
|
|
16
|
-
outputDebug(`API request: ${requestUrl}`);
|
|
17
|
-
outputDebug(requestConfig);
|
|
18
|
-
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
19
|
-
outputDebug(resultData);
|
|
20
|
-
return resultData;
|
|
21
|
-
}
|
|
22
|
-
export async function pollScanStatus(scanId) {
|
|
23
|
-
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/repository`;
|
|
24
|
-
const requestConfig = {
|
|
25
|
-
method: 'GET',
|
|
26
|
-
params: { scan_id: scanId },
|
|
27
|
-
headers: getApiHeaders(),
|
|
28
|
-
};
|
|
29
|
-
outputDebug(`API request: ${requestUrl}`);
|
|
30
|
-
outputDebug(requestConfig);
|
|
31
|
-
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
32
|
-
outputDebug(resultData);
|
|
33
|
-
return resultData;
|
|
34
|
-
}
|
|
35
|
-
export var TUploadPayloadType;
|
|
36
|
-
(function (TUploadPayloadType) {
|
|
37
|
-
TUploadPayloadType["Checkov"] = "checkov";
|
|
38
|
-
TUploadPayloadType["JsonSbom"] = "json-sbom";
|
|
39
|
-
})(TUploadPayloadType || (TUploadPayloadType = {}));
|
|
40
|
-
export async function uploadCustomScanResult(data) {
|
|
41
|
-
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/custom`;
|
|
42
|
-
const requestConfig = {
|
|
43
|
-
method: 'POST',
|
|
44
|
-
data,
|
|
45
|
-
headers: getApiHeaders(),
|
|
46
|
-
};
|
|
47
|
-
outputDebug(`API request: ${requestUrl}`);
|
|
48
|
-
outputDebug(requestConfig);
|
|
49
|
-
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
50
|
-
outputDebug(resultData);
|
|
51
|
-
return resultData;
|
|
52
|
-
}
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getApiKey } from './configuration.js';
|
|
3
|
+
import { outputDebug } from './output.js';
|
|
4
|
+
const getApiUrl = () => process.env.AIKIDO_API || 'https://app.aikido.dev';
|
|
5
|
+
const getApiHeaders = () => ({
|
|
6
|
+
'Content-Type': 'application/json',
|
|
7
|
+
'X-AIK-API-SECRET': getApiKey(),
|
|
8
|
+
});
|
|
9
|
+
export async function startScan(data) {
|
|
10
|
+
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/repository`;
|
|
11
|
+
const requestConfig = {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
data,
|
|
14
|
+
headers: getApiHeaders(),
|
|
15
|
+
};
|
|
16
|
+
outputDebug(`API request: ${requestUrl}`);
|
|
17
|
+
outputDebug(requestConfig);
|
|
18
|
+
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
19
|
+
outputDebug(resultData);
|
|
20
|
+
return resultData;
|
|
21
|
+
}
|
|
22
|
+
export async function pollScanStatus(scanId) {
|
|
23
|
+
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/repository`;
|
|
24
|
+
const requestConfig = {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
params: { scan_id: scanId },
|
|
27
|
+
headers: getApiHeaders(),
|
|
28
|
+
};
|
|
29
|
+
outputDebug(`API request: ${requestUrl}`);
|
|
30
|
+
outputDebug(requestConfig);
|
|
31
|
+
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
32
|
+
outputDebug(resultData);
|
|
33
|
+
return resultData;
|
|
34
|
+
}
|
|
35
|
+
export var TUploadPayloadType;
|
|
36
|
+
(function (TUploadPayloadType) {
|
|
37
|
+
TUploadPayloadType["Checkov"] = "checkov";
|
|
38
|
+
TUploadPayloadType["JsonSbom"] = "json-sbom";
|
|
39
|
+
})(TUploadPayloadType || (TUploadPayloadType = {}));
|
|
40
|
+
export async function uploadCustomScanResult(data) {
|
|
41
|
+
const requestUrl = `${getApiUrl()}/api/integrations/continuous_integration/scan/custom`;
|
|
42
|
+
const requestConfig = {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
data,
|
|
45
|
+
headers: getApiHeaders(),
|
|
46
|
+
};
|
|
47
|
+
outputDebug(`API request: ${requestUrl}`);
|
|
48
|
+
outputDebug(requestConfig);
|
|
49
|
+
const resultData = (await axios(requestUrl, requestConfig)).data;
|
|
50
|
+
outputDebug(resultData);
|
|
51
|
+
return resultData;
|
|
52
|
+
}
|
package/lib/commands/apiKey.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
declare function cli(apiKey: string): void;
|
|
3
|
-
export declare const cliSetup: (program: Command) => Command;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
cli: typeof cli;
|
|
6
|
-
cliSetup: (program: Command) => Command;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
declare function cli(apiKey: string): void;
|
|
3
|
+
export declare const cliSetup: (program: Command) => Command;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
cli: typeof cli;
|
|
6
|
+
cliSetup: (program: Command) => Command;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|