Use this if
Embed Trivy, Syft, and TruffleHog into every commit with a single workflow file. Semgrep remains available when you provide local or customer-owned rules.
Embed Trivy, Syft, and TruffleHog into every commit with a single workflow file. Semgrep remains available when you provide local or customer-owned rules. लक्षित पाठक: DevOps engineers, platform engineers, and security engineers. सामान्य सेटअप समय: 2 minutes.
Embed Trivy, Syft, and TruffleHog into every commit with a single workflow file. Semgrep remains available when you provide local or customer-owned rules.
Start here
चरण 1
Generate a scoped key for the pipeline scanner and store it in your CI secret manager.
What success looks like
Add BLACKSHIELD_API_KEY as a masked CI secret and BLACKSHIELD_API_URL as a CI variable.
चरण 2
Drop one file into your repository. The default matrix runs the safe baseline scanners in parallel.
What success looks like
The optional gate job blocks PR merges when critical findings are open.
चरण 3
Confirm findings appear in the platform, then roll out to more repositories.
What success looks like
For GitLab: copy .gitlab-ci.yml snippet; for Bitbucket: copy bitbucket-pipelines.yml snippet.
Demonstration only
This configuration is designed for ease of use. To deploy scanner clients at scale, please plan your deployment architecture accordingly or contact us for enterprise best practices.
Download the exact source files referenced on this page, or run the one-command installer to write them locally before following the deployment steps.
Writes `.github/workflows/security-scan.yml` with Trivy, Syft, and TruffleHog defaults plus an optional local-rule Semgrep job.
BLACKSHIELD_PIPELINE_IMAGE=public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9 \
bash <(curl -fsSL https://blackshield.chaplau.com/source-bundles/github-security-scan.sh)Writes `.gitlab-ci.yml` with Trivy, Syft, and TruffleHog defaults, schedule support, and optional local-rule Semgrep guidance.
BLACKSHIELD_PIPELINE_IMAGE=public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9 \
BLACKSHIELD_API_URL=https://api.blackshield.chaplau.com \
bash <(curl -fsSL https://blackshield.chaplau.com/source-bundles/gitlab-ci.sh)Writes `bitbucket-pipelines.yml`, configures repository variables through the Bitbucket API, and optionally commits a BlackShield branch.
BLACKSHIELD_PIPELINE_IMAGE=public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9 \
BLACKSHIELD_API_URL=https://api.blackshield.chaplau.com \
bash <(curl -fsSL https://blackshield.chaplau.com/source-bundles/bitbucket-pipelines.sh)name: Security Scan
on:
push:
branches: [main, develop]
pull_request:
jobs:
pipeline-scan:
name: "${{ matrix.tool }}"
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
tool: [trivy, trufflehog, syft]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ matrix.tool == 'trufflehog' && 0 || 1 }}
- name: "Run ${{ matrix.tool }}"
run: |
docker run --rm \
-e BLACKSHIELD_API_URL="${{ vars.BLACKSHIELD_API_URL }}" \
-e BLACKSHIELD_API_KEY="${{ secrets.BLACKSHIELD_API_KEY }}" \
-e SCAN_TOOL="${{ matrix.tool }}" \
-e SCAN_TARGET="/workspace" \
-e REPOSITORY_NAME="${{ github.repository }}" \
-e SCAN_INTERVAL_SECONDS="0" \
-v "${{ github.workspace }}:/workspace:ro" \
public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9variables:
BLACKSHIELD_API_URL: "https://api.blackshield.chaplau.com"
# BLACKSHIELD_API_KEY: set in CI/CD → Variables (masked)
.scanner-base: &scanner-base
stage: security
image: public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9
script: [python -m pipeline.entrypoint]
variables:
SCAN_TARGET: "$CI_PROJECT_DIR"
REPOSITORY_NAME: "$CI_PROJECT_PATH"
SCAN_INTERVAL_SECONDS: "0"
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
scan:trivy: { <<: *scanner-base, variables: { SCAN_TOOL: trivy } }
scan:syft: { <<: *scanner-base, variables: { SCAN_TOOL: syft } }
scan:trufflehog:
<<: *scanner-base
before_script: [git fetch --unshallow || true]
variables: { SCAN_TOOL: trufflehog }docker run --rm \
-e BLACKSHIELD_API_URL=https://api.blackshield.chaplau.com \
-e BLACKSHIELD_API_KEY=sp_xxxx \
-e SCAN_TOOL=semgrep \
-e SCAN_TARGET=/workspace \
-e SEMGREP_CONFIG=/workspace/.semgrep/customer-rules.yml \
-e SCAN_INTERVAL_SECONDS=0 \
-v "$(pwd):/workspace:ro" \
public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9docker run --rm \
-e BLACKSHIELD_API_URL=https://api.blackshield.chaplau.com \
-e BLACKSHIELD_API_KEY=sp_xxxx \
-e SCAN_TOOL=trivy \
-e SCAN_TARGET=/workspace \
-e SCAN_INTERVAL_SECONDS=0 \
-v "$(pwd):/workspace:ro" \
public.ecr.aws/blackshield-security/pipeline-scanner:1.0.9Keep your rollout moving with the next recommended step.
अपनी पहली फाइंडिंग्स इनजेस्ट करें