@aikidosec/ci-api-client 1.0.11 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikidosec/ci-api-client",
3
- "version": "1.0.11",
3
+ "version": "1.0.15",
4
4
  "description": "CLI api client to easily integrate the Aikido public CI API into custom deploy scripts",
5
5
  "license": "MIT",
6
6
  "author": "Bert Devriese <bert@builtinbruges.com>",
@@ -17,35 +17,38 @@
17
17
  "scripts": {
18
18
  "start": "nodemon --watch 'src/**/*.ts' --esm --exec 'ts-node' src/index.ts",
19
19
  "build": "tsc -p .",
20
- "local": "yarn build && yarn global add file:$PWD; aikido-api-client",
21
- "local-rm": "yarn global remove aikido-api-client",
20
+ "local": "npm run build && npm install -g file:$PWD; aikido-api-client",
21
+ "local-rm": "npm uninstall -g @aikidosec/ci-api-client",
22
22
  "format": "prettier --write 'src/**/*.ts'",
23
23
  "//": {
24
- "refresh": "rm -rf ./node_modules ./yarn.lock && yarn"
24
+ "refresh": "rm -rf ./node_modules ./npm-shrinkwrap.json && npm install && npm shrinkwrap"
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "axios": "^1.4.0",
29
- "chalk": "^5.3.0",
30
- "commander": "^11.0.0",
31
- "configstore": "^6.0.0",
32
- "dotenv": "^16.3.1",
33
- "ora": "^6.3.1"
28
+ "axios": "1.8.3",
29
+ "chalk": "5.3.0",
30
+ "commander": "11.0.0",
31
+ "configstore": "6.0.0",
32
+ "dotenv": "16.3.1",
33
+ "ora": "6.3.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/chalk": "^2.2.0",
37
- "@types/commander": "^2.12.2",
38
- "@types/configstore": "^6.0.0",
39
- "@types/dotenv": "^8.2.0",
40
- "@types/node": "^20.3.3",
41
- "nodemon": "^2.0.22",
42
- "prettier": "^2.8.8",
43
- "ts-node": "^10.9.1",
44
- "typescript": "^5.1.6"
36
+ "@types/chalk": "2.2.0",
37
+ "@types/commander": "2.12.2",
38
+ "@types/configstore": "6.0.0",
39
+ "@types/dotenv": "8.2.0",
40
+ "@types/node": "20.3.3",
41
+ "nodemon": "2.0.22",
42
+ "prettier": "2.8.8",
43
+ "ts-node": "10.9.1",
44
+ "typescript": "5.1.6"
45
45
  },
46
46
  "keywords": [
47
47
  "aikido",
48
48
  "security",
49
49
  "cli"
50
- ]
50
+ ],
51
+ "overrides": {
52
+ "form-data@<=4.0.4": "4.0.4"
53
+ }
51
54
  }
package/src/aikidoApi.ts CHANGED
@@ -39,6 +39,7 @@ export type TScanApiOptions = {
39
39
  version: string;
40
40
  is_release_gating?: boolean;
41
41
  base_branch?: string;
42
+ sla_mode?: boolean;
42
43
  };
43
44
 
44
45
  export type TStartScanResult = {
@@ -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.11' };
248
+ const apiOptions: TScanApiOptions = { version: '1.0.15' };
249
249
  const cliOptions: TScanCliOptions = { pollInterval: 5 };
250
250
 
251
251
  if (userCliOptions.pullRequestTitle) {
@@ -62,6 +62,7 @@ type TScanUserCliOptions = {
62
62
  minimumSeverityLevel?: string;
63
63
  pollInterval?: number;
64
64
  baseBranch?: string;
65
+ slaMode?: boolean;
65
66
  };
66
67
 
67
68
  async function cli(
@@ -114,7 +115,12 @@ async function cli(
114
115
  } else {
115
116
  loader?.fail('Scan completed with issues');
116
117
 
117
- if (pollResult.new_issues_found) {
118
+ if (apiOptions.sla_mode) {
119
+ outputLog(
120
+ chalk.gray(
121
+ chalk.bold('Issues outside of SLA found: ') + pollResult.issues_outside_sla)
122
+ );
123
+ } else if (pollResult.new_issues_found) {
118
124
  outputLog(
119
125
  chalk.gray(
120
126
  chalk.bold('Open issues found: ') + pollResult.new_issues_found
@@ -239,7 +245,7 @@ export const scan = async ({
239
245
  const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
240
246
  // Version provided to the API corresponds with the version in package.json
241
247
  // of the cli client
242
- const apiOptions: TScanApiOptions = { version: '1.0.11' };
248
+ const apiOptions: TScanApiOptions = { version: '1.0.15' };
243
249
  const cliOptions: TScanCliOptions = { pollInterval: 10 };
244
250
 
245
251
  if (userCliOptions.pullRequestTitle) {
@@ -275,6 +281,9 @@ const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
275
281
  if (userCliOptions.baseBranch) {
276
282
  apiOptions.base_branch = userCliOptions.baseBranch;
277
283
  }
284
+ if (userCliOptions.slaMode) {
285
+ apiOptions.sla_mode = true;
286
+ }
278
287
  if (
279
288
  userCliOptions.pollInterval &&
280
289
  (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)
@@ -350,6 +359,10 @@ export const cliSetup = (program: Command) =>
350
359
  'Base branch for the release gated scan.'
351
360
  )
352
361
  )
362
+ .option(
363
+ '--sla-mode',
364
+ 'Let Aikido only fail only on open issues that have gone out of SLA.'
365
+ )
353
366
  .description('Run a release scan of an Aikido repo.')
354
367
  .action(cli);
355
368
 
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.11');
23
+ .version('1.0.15');
24
24
 
25
25
  // Load in all app commands and set them up in the `program` instance
26
26
  apiKey.cliSetup(program);