@aikidosec/ci-api-client 1.0.4 → 1.0.6

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 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
@@ -0,0 +1,40 @@
1
+ name: Build and release
2
+ on:
3
+ release:
4
+ types: [published]
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: read
11
+ id-token: write
12
+ timeout-minutes: 15
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: "20.x"
18
+ registry-url: "https://registry.npmjs.org"
19
+ scope: "@aikidosec"
20
+ cache: 'yarn'
21
+
22
+ - name: Install dependencies
23
+ run: yarn install
24
+
25
+ - name: Build the library
26
+ run: yarn build
27
+
28
+ - name: Get the version
29
+ id: get_version
30
+ run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
31
+
32
+ - name: Set the version
33
+ run: npm --no-git-tag-version version ${{ steps.get_version.outputs.tag }}
34
+
35
+ - name: Publish to NPM
36
+ run: |
37
+ echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM"
38
+ npm publish --provenance --access public
39
+ env:
40
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
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,80 +1,137 @@
1
- # Aikido Security CI API client
2
-
3
- <!-- [![NPM Version](http://img.shields.io/npm/v/aikido-api-client.svg?style=flat)](https://www.npmjs.org/package/aikido-api-client)
4
- [![NPM Downloads](https://img.shields.io/npm/dm/aikido-api-client.svg?style=flat)](https://npmcharts.com/compare/aikido-api-client?minimal=true)
5
- [![Install Size](https://packagephobia.now.sh/badge?p=aikido-api-client)](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
-
1
+ # Aikido Security CI client
2
+
3
+ <!-- [![NPM Version](http://img.shields.io/npm/v/aikido-api-client.svg?style=flat)](https://www.npmjs.org/package/aikido-api-client)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/aikido-api-client.svg?style=flat)](https://npmcharts.com/compare/aikido-api-client?minimal=true)
5
+ [![Install Size](https://packagephobia.now.sh/badge?p=aikido-api-client)](https://packagephobia.now.sh/result?p=aikido-api-client) -->
6
+
7
+ This CLI tool can help integrate Aikido Security scans into any custom CI pipeline such as Jenkins, CircleCI,...
8
+ If you are looking to add checks to a Github, Azure Repos,.. pull request, you do not need this package and you can use our native plugins.
9
+
10
+ ## Installation and setup
11
+
12
+ The quickest way to get started is to install the cli tool as a global package.
13
+
14
+ ```sh
15
+ # npm users
16
+ $ npm install -g @aikidosec/ci-api-client
17
+
18
+ # yarn users
19
+ $ yarn global add @aikidosec/ci-api-client
20
+ ```
21
+
22
+ 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
23
+
24
+ ```sh
25
+ $ aikido-api-client apikey <your-api-key-here>
26
+ ```
27
+
28
+ ⚠️ 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.
29
+
30
+ ## Use case: release gating
31
+
32
+ The example below shows how to use the `scan-release` command. The use case here is to block a new build or a new release as long as issues are still open.
33
+
34
+ ```sh
35
+ $ aikido-api-client scan-release <repository_id or repository_name> <commit_id>
36
+ ```
37
+ ```
38
+ Usage: Aikido API Client scan-release [options] <repository_id> <commit_id>
39
+ Run a release scan of an Aikido repo.
40
+ Arguments:
41
+ repository_id The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.
42
+ commit_id The commit you want to scan
43
+ Options:
44
+ --no-fail-on-dependency-scan Don't fail when scanning depedencies. Default is to fail on new CVE
45
+ --fail-on-sast-scan Let Aikido fail when new static code analysis issues have been detected
46
+ --fail-on-iac-scan Let Aikido fail when new infrastructure as code issues have been detected
47
+ --fail-on-secrets-scan Let Aikido fail when new exposed secrets have been detected
48
+ --minimum-severity-level <level> Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL. (choices: "LOW", "MEDIUM",
49
+ "HIGH", "CRITICAL")
50
+ --poll-interval [interval] The poll interval when checking for an updated scan result (preset: 10)
51
+ -h, --help display help for command
52
+ ```
53
+
54
+ ## Use case: pull request checks & gating
55
+
56
+ The example below shows how to use the 'scan' command. The use case here is to add a red/green check to a pull request based on the difference in files (head vs base commit).
57
+
58
+ ```sh
59
+ $ aikido-api-client scan <repository_id or repository_name> <base_commit_id> <head_commit_id>
60
+ ```
61
+ ```
62
+ Usage: Aikido API Client scan [options] <repository_id> <base_commit_id> <head_commit_id> [branch_name]
63
+ Run a scan of an Aikido repo.
64
+ Arguments:
65
+ repository_id The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.
66
+ base_commit_id The base commit of the code you want to scan (e.g. the commit where you branched from for your PR or the
67
+ initial commit of your repo)
68
+ head_commit_id The latest commit you want to include in your scan (e.g. the latest commit id of your pull request)
69
+ branch_name The branch name (default: "main")
70
+ Options:
71
+ --pull-request-title <title> Your pull request title
72
+ --pull-request-url <url> Your pull request URL
73
+ --self-managed-scanners <scanners...> Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL. (choices: "checkov",
74
+ "json-sbom")
75
+ --expected-amount-json-sboms <amount> The expected amount of json sbombs
76
+ --no-fail-on-dependency-scan Don't fail when scanning depedencies. Default is to fail on new CVE
77
+ --fail-on-sast-scan Let Aikido fail when new static code analysis issues have been detected
78
+ --fail-on-iac-scan Let Aikido fail when new infrastructure as code issues have been detected
79
+ --fail-on-secrets-scan Let Aikido fail when new exposed secrets have been detected
80
+ --minimum-severity-level <level> Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL. (choices: "LOW",
81
+ "MEDIUM", "HIGH", "CRITICAL")
82
+ --poll-interval [interval] The poll interval when checking for an updated scan result (preset: 5)
83
+ -h, --help display help for command
84
+ ```
85
+
86
+
87
+
88
+ ## How it works
89
+
90
+ The CLI will spawn a cloud-based scan and then report scan progress. It 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`.
91
+
92
+ If you want the scan to run quietly (without output), you can add the `--quiet` option to the command.
93
+
94
+ 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. Alternatively, you can pass the repository name as it is defined in Aikido.
95
+
96
+ ```sh
97
+ # For more options and combinations, check the help output
98
+ $ aikido-api-client help scan
99
+ $ aikido-api-client help scan-release
100
+ ```
101
+
102
+ Uploading custom test results (supported by the `scan` command only):
103
+
104
+ ```sh
105
+ $ aikido-api-client upload --repository-id <repository_id> --type checkov --file <path_to_payload_file>
106
+
107
+ # For more options and combinations, check the help output
108
+ $ aikido-api-client help upload
109
+ ```
110
+
111
+ For more information about these parameters, please refer to `aikido-api-client help`, `aikido-api-client help scan`, `aikido-api-client help scan-release` or `aikido-api-client help upload`, or [the public ci api page](https://aikido-dev.notion.site/aikido-dev/Aikido-CI-API-78d318b5f5f7477ab072e12f94b21374).
112
+
113
+ ## Help & contributing
114
+
115
+ For more information about all available commands and options, execute:
116
+
117
+ ```sh
118
+ $ aikido-api-client help
119
+ ```
120
+
121
+ ```sh
122
+ $ aikido-api-client help <command>
123
+ ```
124
+
125
+ 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.
126
+
127
+
128
+ # Other resources
129
+
130
+ - [Aikido Official Website](https://aikido.dev)
131
+ - [Aikido Github Actions Workflow](https://github.com/AikidoSec/github-actions-workflow)
132
+ - [Aikido GitLab CI Integration](https://gitlab.com/aikido-security/gitlab-ci-integration)
133
+ - [Aikido Bitbucket Pipe](https://bitbucket.org/aikido-production/bitbucket-pipe)
134
+ - [Aikido Azure Pipelines](https://marketplace.visualstudio.com/items?itemName=AikidoSecurity.aikido-security-scanner)
135
+ - [Aikido on Twitter](https://twitter.com/AikidoSecurity)
136
+
137
+
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
@@ -11,8 +11,10 @@ export type TScanApiOptions = {
11
11
  fail_on_dependency_scan?: boolean;
12
12
  fail_on_sast_scan?: boolean;
13
13
  fail_on_iac_scan?: boolean;
14
+ fail_on_secrets_scan?: boolean;
14
15
  minimum_severity?: string;
15
16
  version: string;
17
+ is_release_gating?: boolean;
16
18
  };
17
19
  export type TStartScanResult = {
18
20
  scan_id: number;
@@ -23,6 +25,7 @@ export type TPollIsScanningResult = {
23
25
  dependency_scan_completed: boolean;
24
26
  sast_scan_completed: boolean;
25
27
  iac_scan_completed: boolean;
28
+ secrets_scan_completed: boolean;
26
29
  sbom_scan_completed?: boolean;
27
30
  };
28
31
  type TPollScanCompletedOptions = {
@@ -33,6 +36,7 @@ type TPollScanFeatureBranchCompletedOptions = {
33
36
  new_dependency_issues_found: number;
34
37
  new_sast_issues_found: number;
35
38
  new_iac_issues_found: number;
39
+ new_leaked_secret_issues_found: number;
36
40
  diff_url: string;
37
41
  };
38
42
  type TPollScanDefaultBranchCompletedOptions = {
@@ -21,6 +21,7 @@ type TScanUserCliOptions = {
21
21
  selfManagedScanners?: string[];
22
22
  failOnDependencyScan?: boolean;
23
23
  failOnSastScan?: boolean;
24
+ failOnSecretsScan?: boolean;
24
25
  failOnIacScan?: boolean;
25
26
  minimumSeverityLevel?: string;
26
27
  pollInterval?: number;
@@ -118,7 +118,7 @@ export const scan = async ({ repoId, baseCommitId, headCommitId, branchName, opt
118
118
  pollStatus();
119
119
  };
120
120
  const parseCliOptions = (userCliOptions) => {
121
- const apiOptions = { version: '1.0.5' };
121
+ const apiOptions = { version: '1.0.6' };
122
122
  const cliOptions = { pollInterval: 5 };
123
123
  if (userCliOptions.pullRequestTitle) {
124
124
  apiOptions.pull_request_metadata = {
@@ -144,6 +144,9 @@ const parseCliOptions = (userCliOptions) => {
144
144
  if (userCliOptions.failOnIacScan != undefined) {
145
145
  apiOptions.fail_on_iac_scan = userCliOptions.failOnIacScan;
146
146
  }
147
+ if (userCliOptions.failOnSecretsScan != undefined) {
148
+ apiOptions.fail_on_secrets_scan = userCliOptions.failOnSecretsScan;
149
+ }
147
150
  if (userCliOptions.minimumSeverityLevel) {
148
151
  apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
149
152
  }
@@ -182,6 +185,7 @@ export const cliSetup = (program) => program
182
185
  .addOption(new Option('--no-fail-on-dependency-scan', "Don't fail when scanning depedencies..."))
183
186
  .option('--fail-on-sast-scan', 'Let Aikido fail when new static code analysis issues have been detected...')
184
187
  .option('--fail-on-iac-scan', 'Let Aikido fail when new infrastructure as code issues have been detected...')
188
+ .option('--fail-on-secrets-scan', 'Let Aikido fail when new exposed secrets have been detected...')
185
189
  .addOption(new Option('--minimum-severity-level <level>', 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.').choices(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']))
186
190
  .addOption(new Option('--poll-interval [interval]', 'The poll interval when checking for an updated scan result')
187
191
  .preset(5)
@@ -0,0 +1,35 @@
1
+ import { Command } from 'commander';
2
+ import { TPollIsScanningResult, TPollScanCompletedDefaultBranchResult, TPollScanFeatureBranchCompletedResult, TScanApiOptions } from '../aikidoApi.js';
3
+ type TScanArguments = {
4
+ repoId: string | number;
5
+ commitId: string;
6
+ options: TScanApiOptions;
7
+ pollInterval: number;
8
+ onStart?: () => void | null;
9
+ onStartComplete?: (startResult: any) => void | null;
10
+ onStartFail?: (error: any) => void | null;
11
+ onScanStart?: (startResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
12
+ onNextPoll?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
13
+ onScanComplete?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
14
+ onScanFail?: (error: any) => void | null;
15
+ };
16
+ type TScanUserCliOptions = {
17
+ pullRequestTitle?: string;
18
+ pullRequestUrl?: string;
19
+ selfManagedScanners?: string[];
20
+ failOnDependencyScan?: boolean;
21
+ failOnSastScan?: boolean;
22
+ failOnSecretsScan?: boolean;
23
+ failOnIacScan?: boolean;
24
+ minimumSeverityLevel?: string;
25
+ pollInterval?: number;
26
+ };
27
+ declare function cli(repoId: string, commitId: string, options: TScanUserCliOptions, command: string): Promise<void>;
28
+ export declare const scan: ({ repoId, commitId, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
29
+ export declare const cliSetup: (program: Command) => Command;
30
+ declare const _default: {
31
+ cli: typeof cli;
32
+ cliSetup: (program: Command) => Command;
33
+ scan: ({ repoId, commitId, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
34
+ };
35
+ export default _default;