HUB
Sign inSign up
eze-cli logo

riversafe/eze-cli

By riversafe

•Updated almost 4 years ago

Eze the one stop solution for security testing in modern development, image with pre installed tools

Image
0

3.9K

riversafe/eze-cli repository overview

Eze the one stop solution developed by RiverSafe Ltd⁠ for security testing in modern development

The eze-cli Dockerfile contains the eze cli, and a selection of common opensource tools out the box

Eze cli scans can help you find vulnerable dependencies, insecure code, hardcoded secrets, and license violations across a range of languages

Please contact [email protected]⁠ for help/enquires with Eze cli

⁠How to Run Eze in Docker

Simple usage, mount your codebase into volume /data, then run docker with "test" argument, and generate a configuration file ".ezerc.toml" based off the current codebase

docker run -t -v FOLDER_TO_SCAN:/data riversafe/eze-cli test

add -t to docker to enable terminal colours

add --debug to docker to enable terminal colours

for sysadmin and power users wanting to build their own images, see the README-DEVELOPMENT.md⁠

⁠Docker cli shortcuts

These commands will run a security scan against code in the current folder

CLICommand
linux/mac os bashdocker run -it -v "$(pwd)":/data riversafe/eze-cli test
windows git bashdocker run -it -v $(pwd -W):/data riversafe/eze-cli test
windows powershelldocker run -it -v ${PWD}:/data riversafe/eze-cli test
windows cmddocker run -it -v %cd%:/data riversafe/eze-cli test

⁠Language Support

LanguageSBOMSCASAST
JavaYYY
NodeYYY
PythonYYY
C#YYY
DockerY*Y*Y
TerraformY
GoY
RubyY
ocamlY
PHPY
  • Auto Configured = Y
  • Manually Configured = Y*

⁠Configuring Eze

⁠Custom configuration

Eze runs off a local .ezerc.toml file, when this config is not present, a sample config will be generated automatically by scanning the codebase (eze test). You can customise it to:

  • Add/remove a scanning tool
  • Customise the arguments passed to a specific tool

⁠Autoconfig .ezerc.toml

When .ezerc.toml is not present, Eze will auto configure tools according to a "autoconfig.json" file, and generated a .ezerc.toml for you

The default autoconfig settings is in "eze/data/default_autoconfig.json"

Can be set to a custom file with --autoconfig flag

docker run -t -v FOLDER_TO_SCAN:/data riversafe/eze-cli test --autoconfig PATH

⁠Autoconfig JSON format
{
  "_help_message": "<DEVELOPER COMMENTS>",
  "license": {
    "_help_message": "eze.enums.LicenseScanType value",
    "license_mode": "PROPRIETARY|PERMISSIVE|OPENSOURCE|OFF"
  },
  "tools": {
    "<tool-id>": {
      "_help_message": "<DEVELOPER COMMENTS>",
      "enabled_always": "true or false",
      "enable_on_file": [
        "<LIST OF FILE NAMES IF FOUND WILL ENABLE TOOL>"
      ],
      "enable_on_file_ext": [
        "<LIST OF FILE EXTENSIONS IF FOUND WILL ENABLE TOOL>"
      ],
      "config": {
        "<FIELD>": "<VALUE>"
      }
    }
  },
  "reporters": {
    "<reporter-id>": {
      "_help_message": "LISTED REPORTERS ARE ALWAYS ENABLED",
      "config": {
        "<FIELD>": "<VALUE>"
      }
    }
  }
}
⁠CI Servers: Howto detect Headless Git

Normally when a project is checked out of git, the location can be read from the .git folder.

For CI servers git is check out headlessly (with no .git) and environments are provided for git repo / build number etc, eze will read these environment variables when detecting headless git repos.

These environment variables will need to be feed to eze's docker image.

aka for ado pipeline

docker run --rm -e "BUILD_SOURCEBRANCHNAME=$BUILD_SOURCEBRANCHNAME" -e "BUILD_REPOSITORY_URI=$BUILD_REPOSITORY_URI" -e "SYSTEM_PULLREQUEST_SOURCEBRANCH=$SYSTEM_PULLREQUEST_SOURCEBRANCH" -v "$(pwd)":/data riversafe/eze-cli test
CI serverEnvironment Variables
ADOBUILD_SOURCEBRANCH BUILD_SOURCEBRANCHNAME SYSTEM_PULLREQUEST_SOURCEBRANCH
AWS AmplifyAWS_BRANCH
AWS CodebuildAWS_BRANCH
JENKINSGIT_LOCAL_BRANCH GIT_BRANCH
IBMCLOUD toolchainGIT_BRANCH
GCPBRANCH_NAME
Gitlab CICI_COMMIT_BRANCH CI_MERGE_REQUEST_TARGET_BRANCH_NAME CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME CI_DEFAULT_BRANCH
Github CIGITHUB_REF

⁠Advanced Configuration: .ezerc.toml

On top of the auto-configuration, you can edit your local .ezerc.toml to run custom tools with custom configuration

When a .ezerc.toml is present, this will be used instead of the autoconfiguration settings

see list of available tools and reporters using these commands

docker run -t riversafe/eze-cli tools list
docker run -t riversafe/eze-cli tools help <TOOL>
docker run -t riversafe/eze-cli reporters list
docker run -t riversafe/eze-cli reporters help <TOOL>

⁠Advanced Configuration: .ezerc.toml format

⁠basic .ezerc.toml TOML format

https://en.wikipedia.org/wiki/TOML⁠

# create template with "docker run -t --rm -v DIRECTORY:/data riversafe/eze-cli housekeeping create-local-config'"

# ===================================
# GLOBAL CONFIG
# ===================================
[global]
# LICENSE_CHECK
LICENSE_CHECK = "PROPRIETARY|PERMISSIVE|OPENSOURCE|OFF"
# LICENSE_ALLOWLIST, list of licenses to exempt from license checks
LICENSE_ALLOWLIST = []
# LICENSE_DENYLIST, list of licenses to always report usage as a error
LICENSE_DENYLIST = []

# ========================================
# TOOL CONFIG
# ========================================
[TOOL_1]
# Full List of Fields and Tool Help available "docker run riversafe/eze-cli tools help <TOOL_NAME>"
TOOL_CONFIG_FIELD = "TOOL_CONFIG_VALUE"

[TOOL_2]
"..." = "..."

# ========================================
# REPORT CONFIG
# ========================================
[REPORTER_1]
# Full List of Fields and Reporter Help available "docker run riversafe/eze-cli reporters help REPORTER_NAME"
REPORTER_CONFIG_FIELD = "REPORTER_CONFIG_VALUE"

[REPORTER_2]
"..." = "..."

# ========================================
# SCAN CONFIG
# ========================================
[scan]
tools = ["TOOL_1","..."]
reporters = ["REPORTER_1", "..."]

⁠Tools and Reporters available

⁠Opensource Tools in Eze

TypeNameVersionLicenseDescription
SCAanchore-grype0.33.1Apache-2.0opensource multi language SCA and container scanner
SBOManchore-syft0.39.3Apache-2.0opensource multi language and container bill of materials (SBOM) generation utility
SCAcontainer-trivy0.18.2Apache-2.0opensource container scanner
SBOMdotnet-cyclonedx2.3.0.0Apache-2.0opensource C#/dotnet bill of materials (SBOM) generation utility
SECRETgitleaks7.5.0MITopensource static key scanner
SCAkics1.5.2Apache-2.0opensource infrastructure scanner
SBOMjava-cyclonedx2.5.3Apache-2.0opensource java bill of materials (SBOM) generation utility, also runs SCA via osv
SCAjava-dependencycheck7.0.0Apache-2.0opensource java SCA tool class
SASTjava-spotbugs4.5.3LGPLopensource java SAST tool class
SCAnode-npmaudit8.5.1NPMopensource node SCA scanner
SCAnode-npmoutdated8.5.1NPMopensource node outdated dependency scanner
SBOMnode-cyclonedx3.4.1Apache-2.0opensource node bill of materials (SBOM) generation utility
SASTpython-safety1.10.3MITopensource python SCA scanner
SCApython-piprot0.9.11MITopensource python outdated dependency scanner
SASTpython-bandit1.7.3Apache-2.0opensource python SAST scanner
SBOMpython-cyclonedx3.0.0Apache-2.0opensource python bill of materials (SBOM) generation utility, also runs SCA via pypi
MISCraw0.15.0-alphainbuiltinput for saved eze json reports
SASTsemgrep0.82.0LGPLopensource multi language SAST scanner
SECRETtrufflehog3.0.4GPLopensource secret scanner

An updated list of tools, licenses, and sizes pre-installed in latest Eze Cli Dockerimage can be found using the command

docker run -t --rm riversafe/eze-cli tools list
docker run -t --rm riversafe/eze-cli tools help <tool-name>
# aka docker run -t --rm riversafe/eze-cli tools help trufflehog

⁠Reporters in Eze

NameVersionLicenseDescription
console0.15.0-alphainbuiltstandard command line reporter
json0.15.0-alphainbuiltjson output file reporter
s30.15.0-alphainbuilts3 uploader reporter
junit0.15.0-alphainbuiltjunit output file reporter
quality0.15.0-alphainbuiltquality gate check reporter
eze0.15.0-alphainbuilteze management console reporter
bom0.15.0-alphainbuiltjson cyclonedx bill of materials reporter
bom-formatted0.22.0Apache-2.0bill of materials multiformat reporter
sarif0.15.0-alphainbuiltsarif output file reporter
markdown0.15.0-alphainbuiltmarkdown output file formatter
html0.15.0-alphainbuilthtml output file formatter

An updated list of reporters can be found using the command

docker run -t --rm riversafe/eze-cli reporters list
docker run -t --rm riversafe/eze-cli reporters help <reporter-name>
# aka docker run -t --rm riversafe/eze-cli reporters help console

⁠Other Common commands

⁠Stopping a docker image

Started a local eze scan but want to stop the scan without waiting the 30-40 seconds for the scan to complete

To immediately stop a docker image do the following

# get docker container id
$ docker stats
CONTAINER ID   NAME                 CPU %     MEM USAGE / LIMIT     MEM %     NET I/O          BLOCK I/O   PIDS
f0bef6e0bba7   optimistic_burnell   0.01%     104.8MiB / 12.33GiB   0.83%     221MB / 4.73MB   0B / 0B     17
# docker stop container id
$ docker stop -t 0 f0bef6e0bba7

⁠Running SAST against only Source

(Windows) Mounted volumes are extremely slow, by default eze will copy source files into a tmp folder for use by SAST tools, this will speed up scans be as much as 80%, as don't need to needlessly scan depedencies or compiled assets

You can turn this off with

docker run -t -e "USE_SOURCE_COPY=false" -v FOLDER_TO_SCAN:/data riversafe/eze-cli test

⁠Asset Caching

Many tools such as maven and npm download dependencies from the internet

⁠Maven .m2 sharing

Maven can be slow downloading all the artifacts it requires

When you provide a persistent .m2 folder which will speed up scans from 100s to as low as 20s per tool

# example of sharing your local .m2
docker run -t -v LOCATION:/data  -v ~/.m2/:/home/ezeuser/.m2/ eze-cli test
⁠Dotnet sharing

Dotnet can be slow downloading all the artifacts it requires

When you provide a persistent .nuget/packages/ folder which will speed up scans

# example of sharing your local .nuget/packages/
docker run -t -v LOCATION:/data  -v ~/.nuget/packages/:/home/ezeuser/.nuget/packages/ eze-cli test
⁠NPM cache sharing

NPM can be slow downloading all the artifacts it requires

When you provide a persistent .npm/ folder which will speed up scans

ps your local node_modules will help as well

# example of sharing your local .npm
docker run -t -v LOCATION:/data  -v ~/.npm/:/home/ezeuser/.npm/ eze-cli test
⁠terraform cache sharing

terraform can be slow downloading all the artifacts it requires

When you provide a persistent .terraform.d/ folder which will speed up scans

ps your local node_modules will help as well

# example of sharing your local .terraform.d
docker run -t -v LOCATION:/data  -v ~/.terraform.d/:/home/ezeuser/.terraform.d/ eze-cli test

⁠Tailoring Image

It's recommended for organisations with mature devops teams to download and tailor this Docker image, adding/removing the pre-installed security tools as needed to optimise size of the image, as well as making their own .ezerc.toml files.

*Aka: Some tools for example semgrep are upto 200mb by themselves, tailoring the image to remove unused tools will save significant amounts of space

Dockerfile Source: https://github.com/RiverSafeUK/eze-cli⁠

Tag summary

Content type

Image

Digest

sha256:9355cc62c…

Size

574.8 MB

Last updated

almost 4 years ago

docker pull riversafe/eze-cli