Workflow Engine

Build workflow-engine

Workflow Engine Splash Logo

Workflow Engine is a security and delivery pipeline designed to orchestrate the process of building and scanning an application image for security vulnerabilities. It solves the problem of having to configure a hardened-predefined security pipeline using traditional CI/CD. Workflow Engine can be statically compiled as a binary and run on virtually any platform, CI/CD environment, or locally.

Getting Started

Install Prerequisites:

  • Container Engine
  • Docker or Podman CLI
  • Golang >= v1.22.0
  • Just (optional)

Compiling Workflow Engine

Running the just recipe will put the compiled-binary into ./bin

just build

OR compile manually

git clone <this-repo> <target-dir>
cd <target-dir>
mkdir bin
go build -o bin/workflow-engine ./cmd/workflow-engine

Optionally, if you care to include metadata you use build arguments

go build -ldflags="-X 'main.cliVersion=$(git describe --tags)' -X 'main.gitCommit=$(git rev-parse HEAD)' -X 'main.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)' -X 'main.gitDescription=$(git log -1 --pretty=%B)'" -o ./bin ./cmd/workflow-engine

Running A Pipeline

You can run the executable directory

workflow-engine run debug

Configuring a Pipeline

Configuration Options:

  • Configuration via CLI flags
  • Environment Variables
  • Config File in JSON
  • Config File in YAML
  • Config File in TOML

Configuration Order-of-Precedence:

  1. CLI Flag
  2. Environment Variable
  3. Config File Value
  4. Default Value

Note: (none) means unset, left blank

Config KeyEnvironment VariableDefault ValueDescription
codescan.enabledWFE_CODE_SCAN_ENABLED1Enable/Disable the code scan pipeline
codescan.gitleaksfilenameWFE_CODE_SCAN_GITLEAKS_FILENAMEgitleaks-secrets-report.jsonThe filename for the gitleaks secret report - must contain 'gitleaks'
codescan.gitleakssrcdirWFE_CODE_SCAN_GITLEAKS_SRC_DIR.The target directory for the gitleaks scan
codescan.semgrepfilenameWFE_CODE_SCAN_SEMGREP_FILENAMEsemgrep-sast-report.jsonThe filename for the semgrep SAST report - must contain 'semgrep'
codescan.semgreprulesWFE_CODE_SCAN_SEMGREP_RULESp/defaultSemgrep ruleset manual override
deploy.enabledWFE_IMAGE_PUBLISH_ENABLED1Enable/Disable the deploy pipeline
deploy.gatecheckconfigfilenameWFE_DEPLOY_GATECHECK_CONFIG_FILENAME-The filename for the gatecheck config
gatecheckbundlefilenameWFE_GATECHECK_BUNDLE_FILENAMEartifacts/gatecheck-bundle.tar.gzThe filename for the gatecheck bundle, a validatable archive of security artifacts
imagebuild.argsWFE_IMAGE_BUILD_ARGS-Comma seperated list of build time variables
imagebuild.builddirWFE_IMAGE_BUILD_DIR.The build directory to using during an image build
imagebuild.cachefromWFE_IMAGE_BUILD_CACHE_FROM-External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir")
imagebuild.cachetoWFE_IMAGE_BUILD_CACHE_TO-Cache export destinations (e.g., "user/app:cache", "type=local,src=path/to/dir")
imagebuild.dockerfileWFE_IMAGE_BUILD_DOCKERFILEDockerfileThe Dockerfile/Containerfile to use during an image build
imagebuild.enabledWFE_IMAGE_BUILD_ENABLED1Enable/Disable the image build pipeline
imagebuild.platformWFE_IMAGE_BUILD_PLATFORM-The target platform for build
imagebuild.squashlayersWFE_IMAGE_BUILD_SQUASH_LAYERS0squash image layers - Only Supported with Podman CLI
imagebuild.targetWFE_IMAGE_BUILD_TARGET-The target build stage to build (e.g., [linux/amd64])
imagepublish.bundlepublishenabledWFE_IMAGE_BUNDLE_PUBLISH_ENABLED1Enable/Disable gatecheck artifact bundle publish task
imagepublish.bundletagWFE_IMAGE_PUBLISH_BUNDLE_TAGmy-app/artifact-bundle:latestThe full image tag for the target gatecheck bundle image blob
imagepublish.enabledWFE_IMAGE_PUBLISH_ENABLED1Enable/Disable the image publish pipeline
imagescan.clamavfilenameWFE_IMAGE_SCAN_CLAMAV_FILENAMEclamav-virus-report.txtThe filename for the clamscan virus report - must contain 'clamav'
imagescan.enabledWFE_IMAGE_SCAN_ENABLED1Enable/Disable the image scan pipeline
imagescan.grypeconfigfilenameWFE_IMAGE_SCAN_GRYPE_CONFIG_FILENAME-The config filename for the grype vulnerability report
imagescan.grypefilenameWFE_IMAGE_SCAN_GRYPE_FILENAMEgrype-vulnerability-report-full.jsonThe filename for the grype vulnerability report - must contain 'grype'
imagescan.syftfilenameWFE_IMAGE_SCAN_SYFT_FILENAMEsyft-sbom-report.jsonThe filename for the syft SBOM report - must contain 'syft'

Running in Docker

When running workflow-engine in a docker container there are some pipelines that need to run docker commands. In order for the docker CLI in the workflow-engine to connect to the docker daemon running on the host machine, you must either mount the /var/run/docker.sock in the workflow-engine container, or provide configuration for accessing the docker daemon remotely with the DOCKER_HOST environment variable.

If you don't have access to Artifactory to pull in the Omnibus base image, you can build the image manually which is in images/omnibus/Dockerfile.

Using /var/run/docker.sock

This approach assumes you have the docker daemon running on your host machine.

Example:

docker run -it --rm \
  `# Mount your Dockerfile and supporting files in the working directory: /app` \
  -v "$(pwd):/app:ro" \
  `# Mount docker.sock for use by the docker CLI running inside the container` \
  -v "/var/run/docker.sock:/var/run/docker.sock" \
  `# Run the workflow-engine container with the desired arguments` \
  workflow-engine run image-build

Using a Remote Daemon

For more information see the Docker CLI and Docker Daemon documentation pages.

Using Podman in Docker

In addition to building images with Docker it is also possible to build them with podman. When running podman in docker it is necessary to either launch the container in privileged mode, or to run as the podman user:

docker run --user podman -it --rm \
  `# Mount your Dockerfile and supporting files in the working directory: /app` \
  -v "$(pwd):/app:ro" \
  `# Run the workflow-engine container with the desired arguments` \
  workflow-engine:local run image-build -i podman

If root access is needed, the easiest solution for using podman inside a docker container is to run the container in "privileged" mode:

docker run -it --rm \
  `# Mount your Dockerfile and supporting files in the working directory: /app` \
  -v "$(pwd):/app:ro" \
  `# Run the container in privileged mode so that podman is fully functional` \
  --privileged \
  `# Run the workflow-engine container with the desired arguments` \
  workflow-engine run image-build -i podman

Using Podman in Podman

To run the workflow-engine container using podman the process is quite similar, but there are a few additional security options required:

podman run --user podman  -it --rm \
  `# Mount your Dockerfile and supporting files in the working directory: /app` \
  -v "$(pwd):/app:ro" \
  `# Run the container with additional security options so that podman is fully functional` \
  --security-opt label=disable --device /dev/fuse \
  `# Run the workflow-engine container with the desired arguments` \
  workflow-engine:local run image-build -i podman