Skip to main content

Use the following instructions to integrate your Bitbucket with Scribe.

YAML Definition

Add the following snippet to the script section of your bitbucket-pipelines.yml file:

- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND_NAME: "<string>"
TARGET: "<string>"
# VERBOSE: '<string>' # Optional
# CONFIG:'<string>' # Optional
# FORMAT: '<string>' # Optional
# INPUT_FORMAT: '<string>' # Optional
# OUTPUT_DIRECTORY: --output-directory # Optional
# OUTPUT_FILE: '<string>' # Optional
# LABEL: '<string>' # Optional
# ENV: '<string>' # Optional
# FILTER_REGEX: '<string>' # Optional
# FILTER_SCOPE: '<string>' # Optional
# PACKAGE_TYPE: '<string>' # Optional
# PACKAGE_GROUP: '<string>' # Optional
# FORCE: --force # Optional
# GIT_BRANCH: '<string>' # Optional
# GIT_COMMIT: '<string>' # Optional
# GIT_TAG: '<string>' # Optional
# ATTEST_CONFIG: '<string>' # Optional
# ATTEST_DEFAULT: '<string>' # Optional
# SCRIBE_ENABLE: '<boolean>' # Optional
# SCRIBE_CLIENT_ID: '<string>' # Optional
# SCRIBE_CLIENT_SECRET: '<string>' # Optional
# ATTESTATION: '<string>' # Optional
# COMPONENTS: '<string>' # Optional
# OCI: '<boolean>' # Optional
# OCI_REPO: '<string>' # Optional
# BUNDLE: '<string>' # Optional
# COMMON_NAME: '<string>' # Optional
# EMAIL: '<string>' # Optional
# RULE: '<string>' # Optional
# SKIP_BUNDLE: '<boolean>' # Optional
# SKIP_REPORT: '<boolean>' # Optional
# URI: --uri
# ALLOW_EXPIRED: '<string>' # Optional
# BACKOFF: '<string>' # Optional
# CA: '<string>' # Optional
# CACHE_ENABLE: '<string>' # Optional
# CERT: '<string>' # Optional
# KEY: '<string>' # Optional
# CONTEXT_DIR: '<string>' # Optional
# CRL: '<string>' # Optional
# CRL_FULL_CHAIN: '<string>' # Optional
# DELIVERABLE: '<string>' # Optional
# DEPTH: <integer>' # Optional
# DISABLE_CRL: '<boolean>' # Optional
# FILTER_SCOPE: '<string>' # Optional
# GIT_TAG: '<string>' # Optional
# LEVEL: '<string>' # Optional
# LOG_CONTEXT: '<string>' # Optional
# LOG_FILE: '<string>' # Optional
# PREDICATE_TYPE: '<string>' # Optional
# PRODUCT_KEY: '<string>' # Optional
# PRODUCT_VERSION: '<string>' # Optional
# RULE_ARGS: '<string>' # Optional
# SCRIBE_AUTH_AUDIENCE: '<string>' # Optional
# SCRIBE_URL: '<string>' # Optional
# STRUCTURED: '<string>' # Optional
# TIMEOUT: '<string>' # Optional

Required Variables

VariableUsage
COMMAND_NAMEName of the command to execute (bom, slsa, evidence, verify)

Common Variables

Flags for all valint subcommands

VariableUsageDefault
ALLOW_EXPIREDAllow expired certs
ATTEST_CONFIGAttestation config path
ATTEST_DEFAULTAttestation default config, options=[sigstore sigstore-github x509 x509-env]"sigstore"
BACKOFFBackoff duration"15s"
CAx509 CA Chain path
CACHE_ENABLEEnable local cachetrue
CERTx509 Cert path
CONFIGConfiguration file path
CONTEXT_DIRContext dir
CONTEXT_TYPECI context type, options=[jenkins github circleci azure gitlab travis tekton bitbucket local]"local"
CRLx509 CRL path
CRL_FULL_CHAINEnable Full chain CRL verification
DELIVERABLEMark as deliverable, options=[true, false]
DEPTHGit clone depth
DISABLE_CRLDisable certificate revocation verification
ENVEnvironment keys to include in sbom
FILTER_REGEXFilter out files by regex[/*.pyc,/.git/**]
FILTER_SCOPEFilter packages by scope
GIT_BRANCHGit branch in the repository
GIT_COMMITGit commit hash in the repository
GIT_TAGGit tag in the repository
KEYx509 Private key path
LABELAdd Custom labels
LEVELLog depth level, options=[panic fatal error warning info debug trace]
LOG_CONTEXTAttach context to all logs
LOG_FILEOutput log to file
OCIEnable OCI store
OCI_REPOSelect OCI custom attestation repo
OUTPUT_DIRECTORYOutput directory path"${XDG_CACHE_HOME}/valint"
OUTPUT_FILEOutput file name
PIPELINE_NAMEPipeline name
PLATFORMSelect target platform, examples=windows/armv6, arm64 ..)
POLICY_ARGSPolicy arguments[]
PREDICATE_TYPECustom Predicate type (generic evidence format)"http://scribesecurity.com/evidence/generic/v0.1"
PRODUCT_KEYProduct Key
PRODUCT_VERSIONProduct Version
QUIETSuppress all logging output
SCRIBE_CLIENT_SECRETScribe Client Secret
SCRIBE_ENABLEEnable scribe client
SCRIBE_URLScribe API Url"https://api.scribesecurity.com"
SHOWPrint evidence to stdout
STRUCTUREDEnable structured logger
TIMEOUTTimeout duration"120s"
VERBOSELog verbosity level [-v,--verbose=1] = info, [-vv,--verbose=2] = debug

Bom Command Variables

if COMMAND is set to bom:

VariableUsageDefault
TARGET (*)Target object name format=[docker:{image:tag}, dir:{dir_path}, git:{git_path}, docker-archive:{archive_path}, oci-archive:archive_path, registry:image:tag]
ATTACH_REGEXAttach files content by regex
AUTHOR_EMAILSet author email
AUTHOR_NAMESet author name
AUTHOR_PHONESet author phone
COMPONENTSSelect sbom components groups, options=[metadata layers packages syft files dep commits][metadata,layers,packages,syft,dep,commits]
FORCEForce overwrite cache
FORMATEvidence format, options=[cyclonedx-json cyclonedx-xml attest-cyclonedx-json statement-cyclonedx-json attest-slsa statement-slsa statement-generic attest-generic][cyclonedx-json]
PACKAGE_EXCLUDE_TYPEExclude package type, options=[ruby python javascript java dpkg apk rpm go-module dotnet r-package rust binary sbom nix conan alpm graalvm cocoapods swift dart elixir php erlang github portage haskell kernel]
PACKAGE_GROUPSelect package group, options=all
PACKAGE_TYPESelect package type, options=[ruby python javascript java dpkg apk rpm go-module dotnet r-package rust binary sbom nix conan alpm graalvm cocoapods swift dart elixir php erlang github portage haskell kernel][ruby,python,javascript,java,dpkg,apk,rpm,go-module,dotnet,r-package,rust,binary,sbom,nix,conan,alpm,graalvm,cocoapods,swift,dart,elixir,php,erlang,github,portage,haskell,kernel]
SUPPLIER_EMAILSet supplier email
SUPPLIER_NAMESet supplier name
SUPPLIER_PHONESet supplier phone
SUPPLIER_URLSet supplier URL
(*) = required variable.

SLSA Command Variables

if COMMAND is set to slsa:

VariableUsageDefault
TARGET (*)Target object name format=[docker:{image:tag}, dir:{dir_path}, git:{git_path}, docker-archive:{archive_path}, oci-archive:archive_path, registry:image:tag]
ALL_ENVAttach all environment variables
BUILD_TYPESet build type
BUILDER_IDSet builder id
BY_PRODUCTAttach by product path
COMPONENTSSelect by products components groups, options=[metadata layers packages syft files dep commits]
EXTERNALAdd build external parameters
FINISHED_ONSet metadata finished time (YYYY-MM-DDThh:mm:ssZ)
FORCEForce overwrite cache
FORMATEvidence format, options=[statement attest predicate]
INVOCATIONSet metadata invocation ID
PREDICATEImport predicate path
STARTED_ONSet metadata started time (YYYY-MM-DDThh:mm:ssZ)
STATEMENTImport statement path
(*) = required variable.

Evidence Command Variables

if COMMAND is set to evidence:

VariableUsageDefault
TARGET (*)Target object name format=`[file-path]
COMPRESSCompress content
FORMATEvidence format, options=[statement attest][statement]
FORMAT_ENCODINGFormat encoding
FORMAT_TYPEFormat type
FORMAT_VERSIONFormat version
HELPShow help message
TOOLTool name
TOOL_VENDORTool vendor
TOOL_VERSIONTool version
(*) = required variable.

Verify Command Variables

if COMMAND is set to verify:

VariableUsageDefault
ATTESTATIONAttestation for target
BUNDLEPolicy bundle uri/path (early-availability)"https://github.com/scribe-public/sample-policies"
COMMON_NAMEDefault policy allowed common names
EMAILDefault policy allowed emails
FORCEForce skip cache
HELPShow help message
INPUT_FORMATEvidence format, options=[attest-cyclonedx-json attest-slsa statement-slsa statement-cyclonedx-json statement-generic attest-generic]"attest-cyclonedx-json"
RULERule configuration file path (early-availability)
SKIP_BUNDLESkip bundle download
SKIP_REPORTSkip Policy report stage
URIDefault policy allowed uris

Usage

 - pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND_NAME: bom
TARGET: busybox:latest
VERBOSE: 2
FORCE: "true"

Scribe integration

1. Obtain a Scribe Hub API Token

  1. Sign in to Scribe Hub. If you don't have an account you can sign up for free here.

  2. Create an API token in Scribe Hub > Settings > Tokens. Copy it to a safe temporary notepad until you complete the integration.

Important

The token is a secret and will not be accessible from the UI after you finalize the token generation.

2. Add the API token to the Bitbucket secrets

Add the Scribe Hub API token as SCRIBE_TOKEN by following the Bitbucket instructions.

3. Install Scribe CLI

Valint - Scribe CLI is required to generate evidence such as SBOMs and SLSA provenance. Install the Valint-pipe.

4. Instrument your build scripts

Examples

Generate an SBOM for an image in a public registry
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: bom
TARGET: busybox:latest
Generate SLSA provenance for an image in a public registry
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: slsa
TARGET: busybox:latest
Generate evidence from a third party tool output
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: evidence
TARGET: some_security_report.json
Generate an SBOM for an image built with local docker
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: bom
TARGET: image_name:latest
VERBOSE: 2
Generate SLSA provenance for an image built with local docker
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: slsa
TARGET: image_name:latest
Generate an SBOM for an image in a private registry

Add a docker login task before adding the following task:

- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: bom
TARGET: scribesecurity.jfrog.io/scribe-docker-local/example:latest
Generate SLSA provenance for an image in a private registry

Add a docker login task before adding the following task:

- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: slsa
TARGET: scribesecurity.jfrog.io/scribe-docker-local/example:latest
VERBOSE: 2
Add custom metadata to SBOM
- step:
name: valint-image-step
script:
- export test_env=test_env_value
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: bom
TARGET: busybox:latest
ENV: test_env
LABEL: test_label
Add custom metadata to SLSA provenance
- step:
name: valint-image-step
script:
- export test_env=test_env_value


- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: slsa
TARGET: busybox:latest
ENV: test_env
LABEL: test_label
Export SBOM as an artifact

Use FORMAT input argument to set the format.

- step:
name: save-artifact-step
script:
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: bom
OUTPUT_FILE: my_sbom.json
TARGET: busybox:latest

artifacts:
- scribe/**
- my_sbom.json
Export SLSA provenance as an artifact

Use format input argument to set the format.

- step:
name: save-artifact-step
script:
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: slsa
OUTPUT_FILE: my_slsa.json
TARGET: busybox:latest

artifacts:
- scribe/**
- my_slsa.json
Generate an SBOM of a local file directory
step:
name: dir-sbom-step
script:
- mkdir testdir
- echo "test" > testdir/test.txt
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: bom
TARGET: dir:./testdir
SCRIBE_CLIENT_SECRET: $SCRIBE_TOKEN
Generate SLSA provenance of a local file directory
step:
name: dir-sbom-step
script:
- mkdir testdir
- echo "test" > testdir/test.txt
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND: slsa
TARGET: dir:./testdir
SCRIBE_CLIENT_SECRET: $SCRIBE_TOKEN
Details

Generate an SBOM of a git repo For a remote git repo:

- step:
name: valint-git-step
script:
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: bom
TARGET: git:https://github.com/mongo-express/mongo-express.git

For a local git repo:

    - step:
name: valint-git-step
script:
- git clone https://github.com/mongo-express/mongo-express.git scm_mongo_express
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: bom
TARGET: dir:scm_mongo_express
Generate SLSA provenance for a git repo

For a remote git repo:

- step:
name: valint-git-step
script:
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: slsa
TARGET: git:https://github.com/mongo-express/mongo-express.git

For a local git repo:

    - step:
name: valint-git-step
script:
- git clone https://github.com/mongo-express/mongo-express.git scm_mongo_express
- pipe: docker://scribesecurity/valint-pipe:latest
variables:
COMMAND_NAME: slsa
TARGET: dir:scm_mongo_express

Alternative evidence stores

You can learn more about alternative stores here.

Details

OCI Evidence store Valint supports both storage and verification flows for attestations and statement objects utilizing OCI registry as an evidence store.

Using OCI registry as an evidence store allows you to upload, download and verify evidence across your supply chain in a seamless manner.

Related flags:

  • OCI Enable OCI store.
  • OCI_REPO - Evidence store location.

Before you begin

Evidence can be stored in any accusable registry.

  • Write access is required for upload (generate).
  • Read access is required for download (verify).

You must first login with the required access privileges to your registry before calling Valint. For example, using docker login command.

Usage

pipelines:
default:
- step:
name: scribe-bitbucket-oci-pipeline
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD [my_registry]
- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND_NAME: [bom,slsa,evidence]
TARGET: [target]
FORMAT: [attest, statement]
OCI: true
OCI_REPO: [oci_repo]

- pipe: scribe-security/valint-pipe:1.1.0
variables:
COMMAND_NAME: verify
TARGET: [target]
INPUT_FORMAT: [attest, statement, attest-slsa, statement-slsa, attest-generic, statement-generic]
OCI: true
OCI_REPO: [oci_repo]