SAST CLI for scanning Java, JavaScript, and .NET applications plus AWS Lambda functions, detecting code vulnerabilities and over-permissive IAM policies.
CodeSec delivers:
NPM:
npm install --location=global @contrast/contrast
Homebrew:
brew tap contrastsecurity/tap
brew install contrast
Binaries:
Go to https://pkg.contrastsecurity.com/ui/repos/tree/General/cli
Select your operating system under the cli folder and download the package.
You must allow execute permissions on the file depending on your OS.
Authenticate by entering contrast auth in the terminal.
In the resulting browser window, log in and authenticate with your GitHub or Google credentials.
Make sure you have the correct file types to scan.
Start scanning
Use the Contrast scan command contrast scan
export AWS_DEFAULT_REGION=<YOUR_AWS_REGION>
export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>
AWS credentials should be available on your local configure (usually ~/.aws/credentials). You have an option to run a lambda scan with your aws-profile to pass --profile. You also can export different credentials.
These permissions are required to gather all required information on an AWS Lambda to use the contrast lambda command:
Use contrast lambda to scan your AWS Lambda functions.
contrast lambda --function-name MyFunctionName --region my-aws-region
Authenticate Contrast using your GitHub or Google account. A new browser window will open for login.
Usage: contrast auth
Displays stored credentials.
Usage: contrast config
Options:
Performs a security SAST scan.
Usage: contrast scan [option]
Options:
contrast scan --file
contrast scan --name
contrast scan --save
contrast scan --timeout
Name of AWS lambda function to scan.
Usage: contrast lambda --function-name
Options:
contrast lambda --function-name --endpoint-url AWS Endpoint override. Similar to AWS CLI. Alias: -e
contrast lambda --function-name --region Region override. Defaults to AWS_DEFAULT_REGION. Similar to AWS CLI. Alias: -r
contrast lambda --function-name --profile AWS configuration profile override. Similar to AWS CLI. Alias: -p
contrast lambda --function-name --json Return response in JSON (versus default human-readable format). Alias: -j
contrast lambda -–function-name -–verbose Returns extended information to the terminal. Alias: -v
contrast lambda -–function-name --list-functions Lists all available lambda functions to scan.
contrast lambda --function-name -–help Displays usage guide. Alias: -h
Displays usage guide. To list detailed help for any CLI command, add the -h or --help flag to the command.
Usage: contrast scan --help
Alias: -h
Displays version of Contrast CLI.
Usage: contrast version Alias: -v, --version