Skip to content

CI/CD integration

Running Sentrasec in GitHub Actions, GitLab CI, Jenkins, CircleCI and Azure Pipelines.

The same binary that runs locally runs in your pipeline. Gating follows your severity threshold, so the build fails on what you define as blocking.

GitHub Actions

name: Security

on: [push, pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4

      - name: Install Sentrasec
        run: curl -fsSL https://cli.sentrasec.ai/install.sh | bash

      - name: Scan
        run: sentrasec scan . --format sarif > results.sarif
        env:
          SENTRASEC_TOKEN: ${{ secrets.SENTRASEC_TOKEN }}

      - name: Upload results
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results.sarif

Uploading SARIF puts findings in GitHub code scanning, which shows them in the Security tab and on the pull request.

GitLab CI

security_scan:
  image: ubuntu:latest
  before_script:
    - apt-get update && apt-get install -y curl
    - curl -fsSL https://cli.sentrasec.ai/install.sh | bash
  script:
    - sentrasec scan . --format json > gl-sast-report.json
  artifacts:
    reports:
      sast: gl-sast-report.json

Jenkins

pipeline {
  agent any
  stages {
    stage('Security scan') {
      steps {
        sh 'curl -fsSL https://cli.sentrasec.ai/install.sh | bash'
        sh 'sentrasec scan . --format sarif > results.sarif'
      }
    }
  }
  post {
    always {
      archiveArtifacts artifacts: 'results.sarif'
    }
  }
}

CircleCI

version: 2.1
jobs:
  security:
    docker:
      - image: cimg/base:current
    steps:
      - checkout
      - run: curl -fsSL https://cli.sentrasec.ai/install.sh | bash
      - run: sentrasec scan . --format sarif > results.sarif
      - store_artifacts:
          path: results.sarif

Azure Pipelines

steps:
  - script: curl -fsSL https://cli.sentrasec.ai/install.sh | bash
    displayName: Install Sentrasec
  - script: sentrasec scan . --format sarif > results.sarif
    displayName: Security scan
    env:
      SENTRASEC_TOKEN: $(SentrasecToken)

Gating strategy

Failing the build on every finding trains people to bypass the check. A pattern that survives contact with a real team:

  • Pull requests: scan changed files only, fail on critical and high.
  • Main branch: full scan, fail on critical.
  • Nightly: full scan plus DAST against staging, report without gating.
# Pull request
sentrasec scan . --since origin/main --severity high

# Main
sentrasec scan . --severity critical

Authentication

Store the workspace token as a secret in your CI system and expose it as SENTRASEC_TOKEN. For forked pull requests where secrets are unavailable, check whether your workspace allows unauthenticated scans before relying on them.

CI/CD integration · Sentrasec