Skip to content

Commit

Permalink
Merge pull request #7 from AikidoSec/feat/improve-docs-and-validation
Browse files Browse the repository at this point in the history
Improve readme and update validation of apikey
  • Loading branch information
willem-delbare authored Feb 27, 2024
2 parents fe31743 + 19c7de0 commit 4afc92b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ The process will report scan progress and will exit with exitCode `0` if the sca

If you want the scan to run quietly (without output), you can add the `--quiet` option to the command.

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.

```sh
# For more options and combinations, check the help output
$ aikido-api-client help scan
Expand Down
4 changes: 3 additions & 1 deletion lib/commands/apiKey.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Argument } from 'commander';
import { setApiKey } from '../configuration.js';
import { outputError, outputLog } from '../output.js';
const API_KEY_REGEX = /^AIK_CI_[a-zA-Z0-9]{64}$/g;
function cli(apiKey) {
if (apiKey && apiKey.trim().length != 128) {
const isValidApiKey = API_KEY_REGEX.test(apiKey) || apiKey.trim().length === 128;
if (apiKey && !isValidApiKey) {
outputError('That does not seem right, please verify your api key');
}
setApiKey(apiKey);
Expand Down
5 changes: 4 additions & 1 deletion src/commands/apiKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { Argument, Command } from 'commander';
import { setApiKey } from '../configuration.js';
import { outputError, outputLog } from '../output.js';

const API_KEY_REGEX = /^AIK_CI_[a-zA-Z0-9]{64}$/g;

function cli(apiKey: string): void {
if (apiKey && apiKey.trim().length != 128) {
const isValidApiKey = API_KEY_REGEX.test(apiKey) || apiKey.trim().length === 128;
if (apiKey && !isValidApiKey) {
outputError('That does not seem right, please verify your api key');
}

Expand Down

0 comments on commit 4afc92b

Please sign in to comment.