@aikidosec/ci-api-client 1.0.8 → 1.0.9
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/README.md +1 -0
- package/lib/aikidoApi.d.ts +1 -0
- package/lib/commands/scan.js +2 -2
- package/lib/commands/scanRelease.d.ts +1 -0
- package/lib/commands/scanRelease.js +6 -2
- package/lib/commands/upload.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/aikidoApi.ts +1 -0
- package/src/commands/scan.ts +2 -2
- package/src/commands/scanRelease.ts +12 -2
- package/src/commands/upload.ts +1 -1
- package/src/index.ts +1 -1
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ Options:
|
|
|
80
80
|
--minimum-severity-level <level> Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL. (choices: "LOW",
|
|
81
81
|
"MEDIUM", "HIGH", "CRITICAL")
|
|
82
82
|
--poll-interval [interval] The poll interval when checking for an updated scan result (preset: 5)
|
|
83
|
+
--base-branch <branchname> Optional: base branch for the release gated scan.
|
|
83
84
|
-h, --help display help for command
|
|
84
85
|
```
|
|
85
86
|
|
package/lib/aikidoApi.d.ts
CHANGED
package/lib/commands/scan.js
CHANGED
|
@@ -6,7 +6,7 @@ import { outputError, outputHttpError, outputLog, startSpinner, } from '../outpu
|
|
|
6
6
|
async function cli(repoId, baseCommitId, headCommitId, branchName, options, command) {
|
|
7
7
|
const apiKey = getApiKey();
|
|
8
8
|
if (!apiKey) {
|
|
9
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
9
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
10
10
|
}
|
|
11
11
|
const { apiOptions, cliOptions } = parseCliOptions(options);
|
|
12
12
|
let loader;
|
|
@@ -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.
|
|
121
|
+
const apiOptions = { version: '1.0.9' };
|
|
122
122
|
const cliOptions = { pollInterval: 5 };
|
|
123
123
|
if (userCliOptions.pullRequestTitle) {
|
|
124
124
|
apiOptions.pull_request_metadata = {
|
|
@@ -23,6 +23,7 @@ type TScanUserCliOptions = {
|
|
|
23
23
|
failOnIacScan?: boolean;
|
|
24
24
|
minimumSeverityLevel?: string;
|
|
25
25
|
pollInterval?: number;
|
|
26
|
+
baseBranch?: string;
|
|
26
27
|
};
|
|
27
28
|
declare function cli(repoId: string, commitId: string, options: TScanUserCliOptions, command: string): Promise<void>;
|
|
28
29
|
export declare const scan: ({ repoId, commitId, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
|
|
@@ -6,7 +6,7 @@ import { outputError, outputHttpError, outputLog, startSpinner, } from '../outpu
|
|
|
6
6
|
async function cli(repoId, commitId, options, command) {
|
|
7
7
|
const apiKey = getApiKey();
|
|
8
8
|
if (!apiKey) {
|
|
9
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
9
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
10
10
|
}
|
|
11
11
|
const { apiOptions, cliOptions } = parseCliOptions(options);
|
|
12
12
|
let loader;
|
|
@@ -120,7 +120,7 @@ export const scan = async ({ repoId, commitId, options, pollInterval = 10, onSta
|
|
|
120
120
|
pollStatus();
|
|
121
121
|
};
|
|
122
122
|
const parseCliOptions = (userCliOptions) => {
|
|
123
|
-
const apiOptions = { version: '1.0.
|
|
123
|
+
const apiOptions = { version: '1.0.9' };
|
|
124
124
|
const cliOptions = { pollInterval: 10 };
|
|
125
125
|
if (userCliOptions.pullRequestTitle) {
|
|
126
126
|
apiOptions.pull_request_metadata = {
|
|
@@ -152,6 +152,9 @@ const parseCliOptions = (userCliOptions) => {
|
|
|
152
152
|
if (userCliOptions.minimumSeverityLevel) {
|
|
153
153
|
apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
|
|
154
154
|
}
|
|
155
|
+
if (userCliOptions.baseBranch) {
|
|
156
|
+
apiOptions.base_branch = userCliOptions.baseBranch;
|
|
157
|
+
}
|
|
155
158
|
if (userCliOptions.pollInterval &&
|
|
156
159
|
(isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)) {
|
|
157
160
|
outputError('Please provide a valid poll interval');
|
|
@@ -182,6 +185,7 @@ export const cliSetup = (program) => program
|
|
|
182
185
|
.addOption(new Option('--poll-interval [interval]', 'The poll interval when checking for an updated scan result')
|
|
183
186
|
.preset(10)
|
|
184
187
|
.argParser(parseFloat))
|
|
188
|
+
.addOption(new Option('--base-branch <branchname>', 'Base branch for the release gated scan.'))
|
|
185
189
|
.description('Run a release scan of an Aikido repo.')
|
|
186
190
|
.action(cli);
|
|
187
191
|
export default { cli, cliSetup, scan };
|
package/lib/commands/upload.js
CHANGED
|
@@ -7,7 +7,7 @@ import { promisify } from 'util';
|
|
|
7
7
|
async function cli(options, command) {
|
|
8
8
|
const apiKey = getApiKey();
|
|
9
9
|
if (!apiKey) {
|
|
10
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
10
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
11
11
|
}
|
|
12
12
|
const { apiOptions, cliOptions } = await parseCliOptions(options);
|
|
13
13
|
let loader = startSpinner('Uploading custom scan');
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export const program = new Command();
|
|
|
11
11
|
program
|
|
12
12
|
.name('Aikido API Client')
|
|
13
13
|
.description('CLI api client to easily integrate the Aikido public CI API into custom deploy scripts')
|
|
14
|
-
.version('1.0.
|
|
14
|
+
.version('1.0.9');
|
|
15
15
|
apiKey.cliSetup(program);
|
|
16
16
|
scan.cliSetup(program);
|
|
17
17
|
scanRelease.cliSetup(program);
|
package/package.json
CHANGED
package/src/aikidoApi.ts
CHANGED
package/src/commands/scan.ts
CHANGED
|
@@ -76,7 +76,7 @@ async function cli(
|
|
|
76
76
|
const apiKey = getApiKey();
|
|
77
77
|
|
|
78
78
|
if (!apiKey) {
|
|
79
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
79
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Process command options and group them into apiOptions hash
|
|
@@ -245,7 +245,7 @@ export const scan = async ({
|
|
|
245
245
|
const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
246
246
|
// Version provided to the API corresponds with the version in package.json
|
|
247
247
|
// of the cli client
|
|
248
|
-
const apiOptions: TScanApiOptions = { version: '1.0.
|
|
248
|
+
const apiOptions: TScanApiOptions = { version: '1.0.9' };
|
|
249
249
|
const cliOptions: TScanCliOptions = { pollInterval: 5 };
|
|
250
250
|
|
|
251
251
|
if (userCliOptions.pullRequestTitle) {
|
|
@@ -61,6 +61,7 @@ type TScanUserCliOptions = {
|
|
|
61
61
|
failOnIacScan?: boolean;
|
|
62
62
|
minimumSeverityLevel?: string;
|
|
63
63
|
pollInterval?: number;
|
|
64
|
+
baseBranch?: string;
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
async function cli(
|
|
@@ -73,7 +74,7 @@ async function cli(
|
|
|
73
74
|
const apiKey = getApiKey();
|
|
74
75
|
|
|
75
76
|
if (!apiKey) {
|
|
76
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
77
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
// Process command options and group them into apiOptions hash
|
|
@@ -242,7 +243,7 @@ export const scan = async ({
|
|
|
242
243
|
const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
243
244
|
// Version provided to the API corresponds with the version in package.json
|
|
244
245
|
// of the cli client
|
|
245
|
-
const apiOptions: TScanApiOptions = { version: '1.0.
|
|
246
|
+
const apiOptions: TScanApiOptions = { version: '1.0.9' };
|
|
246
247
|
const cliOptions: TScanCliOptions = { pollInterval: 10 };
|
|
247
248
|
|
|
248
249
|
if (userCliOptions.pullRequestTitle) {
|
|
@@ -275,6 +276,9 @@ const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
|
275
276
|
if (userCliOptions.minimumSeverityLevel) {
|
|
276
277
|
apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
|
|
277
278
|
}
|
|
279
|
+
if (userCliOptions.baseBranch) {
|
|
280
|
+
apiOptions.base_branch = userCliOptions.baseBranch;
|
|
281
|
+
}
|
|
278
282
|
if (
|
|
279
283
|
userCliOptions.pollInterval &&
|
|
280
284
|
(isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)
|
|
@@ -347,6 +351,12 @@ export const cliSetup = (program: Command) =>
|
|
|
347
351
|
.preset(10)
|
|
348
352
|
.argParser(parseFloat)
|
|
349
353
|
)
|
|
354
|
+
.addOption(
|
|
355
|
+
new Option(
|
|
356
|
+
'--base-branch <branchname>',
|
|
357
|
+
'Base branch for the release gated scan.'
|
|
358
|
+
)
|
|
359
|
+
)
|
|
350
360
|
.description('Run a release scan of an Aikido repo.')
|
|
351
361
|
.action(cli);
|
|
352
362
|
|
package/src/commands/upload.ts
CHANGED
|
@@ -44,7 +44,7 @@ async function cli(options: TUploadUserCliOptions, command: string) {
|
|
|
44
44
|
const apiKey = getApiKey();
|
|
45
45
|
|
|
46
46
|
if (!apiKey) {
|
|
47
|
-
outputError('Please set an api key using: aikido-cli apikey <key>');
|
|
47
|
+
outputError('Please set an api key using: aikido-cli-client apikey <key>');
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// Process command options and group them into apiOptions hash
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ program
|
|
|
20
20
|
.description(
|
|
21
21
|
'CLI api client to easily integrate the Aikido public CI API into custom deploy scripts'
|
|
22
22
|
)
|
|
23
|
-
.version('1.0.
|
|
23
|
+
.version('1.0.9');
|
|
24
24
|
|
|
25
25
|
// Load in all app commands and set them up in the `program` instance
|
|
26
26
|
apiKey.cliSetup(program);
|