For the complete documentation index, see llms.txt. This page is also available as Markdown.

Enforce policies with GitHub Actions

Use SCS GitHub Actions to implement SBOM Verification and Policy Enforcement.

Harness GitHub Actions provide a seamless way to integrate Harness's Software Supply Chain Security (SCS) capabilities directly into GitHub workflows. You can use this GitHub Action to perform various supply chain security tasks. The Harness GitHub Action includes multiple sub-actions, each designed for specific tasks. This document focuses on the harness/github-actions/sbom-policy-enforcement sub-action, which is used to generate an SBOM and attest it if needed.

The harness/github-actions/sbom-policy-enforcement verifies the SBOM attestation and enforces policies on the SBOM. The policies applied are Harness SBOM Policies. Go to Create SBOM Policies to create and manage SBOM policies.

Before you begin

Here are the prerequisites for using the GitHub Action.

  1. Harness Account: Ensure you have a Harness account with the SCS license enabled.

  2. Harness Account Details: Save the following Harness account details, which are required for all sub-actions. It is recommended to securely store these values using GitHub Secrets.

Key

Value Example

Description

Required

HARNESS_ACCOUNT_URL

https://example.harness.io

The URL of your Harness account.

Yes

HARNESS_ACCOUNT_ID

ppdfedDDDL_dharzdPs_JtWT7g

The unique identifier for your Harness account.

Yes

HARNESS_ORG_ID

SCS

The identifier for your Harness organization.

Yes

HARNESS_PROJECT_ID

SCS_ORG

The identifier for your Harness project within the organization.

Yes

HARNESS_API_KEY

${{ secrets.SCS_API_KEY }}

The API key for authenticating with Harness. Create an API key using a Service Account (recommended) or a Personal Account , and then add the key to GitHub Actions Secrets with "HARNESS_API_KEY" as the key name.

Yes

VAULT_ADDR

https://myvault.example.com

The URL of your Vault

No

  1. Security Keys: For attestation generation and verification, Key pair is required. The key should be generated using Cosign of type ecdsa-P256. Currently, HashiCorp Vault is supported for storing and retrieving the key. Additional Key Management Services (KMS) will be supported in the future.

Usage example

- name: SBOM Policy Enforcement
  uses: harness/github-actions/sbom-policy-enforcement@1.1.0
  with:
    HARNESS_ACCOUNT_URL: https://myaccount.harness.io
    HARNESS_ACCOUNT_ID: my_account_id_9YpRharzPs
    HARNESS_ORG_ID: my_org_id_default
    HARNESS_PROJECT_ID: example_project_id
    HARNESS_API_KEY: ${{ secrets.API_KEY_SAVED_AS_GH_SECRET }}
    VAULT_ADDR: ${{ secrets.VAULT_URL }}
    TARGET: example_image:latest
    VERIFY: true
    POLICY_SET_REF: github_opa_policy
    KMS_KEY: path/to/your/key

Configuration

Make sure to include the required configurations from the Before you begin section in your workflow. Below are the specific configurations for the sbom-policy-enforcement sub-action.

Key

Value Example

Description

Required

TARGET

example_image:latest

The target artifact (Docker image) for SBOM verification and policy enforcement.

Yes

VERIFY

true or false

Boolean flag to determine if attestation verification is required.

Yes

POLICY_SET_REF

github_opa_policy

The reference to the Harness SBOM policy set to be enforced.

Yes

KMS_KEY

path/to/your/key

Path to the Public key used for verifying the attestation.

Yes

Sample workflow

The following sample workflow uses the harness/github-actions/sbom-policy-enforcement sub-action.

Next steps

Go to Ingest SBOM with Harness GitHub Actions to upload an externally generated SBOM to Harness SCS.

Last updated

Was this helpful?