Documentation

5-Minute CI/CD Integration Guide

Plug AppBreach directly into GitHub Actions, GitLab CI, Bitrise, or Fastlane to scan authorized Android and iOS builds, upload SARIF 2.1.0 alerts, and block regressions before release.

Before you start (2 minutes)

Every CI pipeline authenticates to https://appbreach.io using two secrets stored in your CI secret manager and one built mobile artifact:

  • API token (MDS_API_TOKEN): Your authorized 64-character hex API token from the AppBreach workspace.
  • Pre-signed authorization scope JSON: The signed scope document identifying your app package or bundle ID and permitted checks. Keep it masked in your secret store and write it only to a 0600 temporary file with exit cleanup.
  • Mobile build artifact: An authorized Android .apk or split .apks bundle (if your pipeline produces an .aab, export signed .apks splits via bundletool before live hosted upload), or an unencrypted iOS .ipa produced by your upstream build step.

Never echo tokens or signed scope JSON to build logs, and guard pull-request workflows so untrusted fork PRs cannot access repository secrets.

GitHub Actions (Composite Action + Matrix Gate)

Use the reusable composite action at the repository root to gate both Android and iOS builds in a single workflow. Pin the action reference to a reviewed full 40-character commit SHA (@FULL_COMMIT_SHA).

name: AppBreach Mobile Release Security Gate

on:
  pull_request:
    branches: [main, release/*]
  release:
    types: [prereleased, published]

permissions:
  contents: read
  security-events: write

jobs:
  release-security-gate:
    # Fork PRs cannot access secrets; run only on trusted repository branches and releases.
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - platform: android
            artifact_path: build/outputs/apk/release/app-release.apk
            admission_secret: APPBREACH_ANDROID_ADMISSION_JSON
          - platform: ios
            artifact_path: build/ios/App.ipa
            admission_secret: APPBREACH_IOS_ADMISSION_JSON
    steps:
      - uses: actions/checkout@v4

      - name: Run AppBreach release security gate
        id: appbreach
        uses: beyhangll/mobile-deepstrike@FULL_COMMIT_SHA
        with:
          api-url: https://appbreach.io
          api-token: ${{ secrets.APPBREACH_API_TOKEN }}
          admission-json: ${{ secrets[matrix.admission_secret] }}
          artifact-path: ${{ matrix.artifact_path }}
          mode: ${{ github.event_name == 'pull_request' && 'pr' || 'release' }}
          compare-latest: 'true'
          fail-on-regression: 'true'
          threshold: high
          allow-partial: 'true'
          output-dir: appbreach-results-${{ matrix.platform }}

      - name: Upload SARIF to GitHub Code Scanning
        if: always() && steps.appbreach.outputs.sarif-path != ''
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: ${{ steps.appbreach.outputs.sarif-path }}
          category: appbreach-${{ matrix.platform }}

      - name: Upload Release Diff (MD, PDF, DOCX) and Scan Artifacts
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: appbreach-release-gate-${{ matrix.platform }}-${{ github.run_id }}
          path: appbreach-results-${{ matrix.platform }}/
          retention-days: 14

The action exposes six step outputs via $GITHUB_OUTPUT so downstream steps run even when the gate blocks a release: run-id, verdict, sarif-path, diff-md-path, diff-pdf-path, and diff-docx-path. See the full matrix template in integrations/github/release-gate.example.yml.

GitLab CI

Add a dedicated security_gate stage in .gitlab-ci.yml that runs on merge requests and release tags for both Android and iOS builds. Store MDS_API_TOKEN, APPBREACH_ANDROID_ADMISSION_JSON, and APPBREACH_IOS_ADMISSION_JSON as masked, protected CI/CD variables.

.appbreach_release_gate:
  stage: security_gate
  image: python:3.12-slim
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_TAG'
  script:
    - set -euo pipefail
    - umask 077
    - ADMISSION_FILE="$(mktemp /tmp/appbreach-admission.XXXXXX.json)"
    - chmod 600 "${ADMISSION_FILE}"
    - trap 'rm -f "${ADMISSION_FILE}"' EXIT
    - printf '%s' "${ADMISSION_PAYLOAD}" > "${ADMISSION_FILE}"
    - MODE="pr"; if [ -n "${CI_COMMIT_TAG:-}" ]; then MODE="release"; fi
    - |
      PYTHONPATH=.appbreach-scanner python3 -m src.ci_scan \
        --api-url "https://appbreach.io" \
        --artifact "${APPBREACH_ARTIFACT}" \
        --admission "${ADMISSION_FILE}" \
        --mode "${MODE}" \
        --allow-partial --compare-latest --fail-on-regression \
        --sarif-out "appbreach-results/${APPBREACH_PLATFORM}/results.sarif" \
        --diff-output "appbreach-results/${APPBREACH_PLATFORM}/release-diff.md" \
        --diff-pdf-output "appbreach-results/${APPBREACH_PLATFORM}/release-diff.pdf" \
        --diff-docx-output "appbreach-results/${APPBREACH_PLATFORM}/release-diff.docx"
  artifacts:
    when: always
    expire_in: 14 days
    paths:
      - appbreach-results/

The complete copy-paste Android + iOS template with commit-SHA verification lives in integrations/gitlab/release-gate.example.yml.

Bitrise

Drop the AppBreach script@1 step right after your Android Build or Xcode Archive step in bitrise.yml. It automatically detects $BITRISE_APK_PATH, $BITRISE_AAB_PATH, or $BITRISE_IPA_PATH and writes SARIF and Release Diff artifacts into $BITRISE_DEPLOY_DIR/appbreach-results for the standard deploy-to-bitrise-io@2 step.

workflows:
  release-security-gate:
    envs:
      - APPBREACH_API_URL: https://appbreach.io
      - APPBREACH_MODE: release
    steps:
      - script@1:
          title: AppBreach Mobile Release Security Gate
          inputs:
            - content: |
                #!/usr/bin/env bash
                set -euo pipefail
                umask 077
                ARTIFACT_PATH="${APPBREACH_ARTIFACT_PATH:-${BITRISE_APK_PATH:-${BITRISE_AAB_PATH:-${BITRISE_IPA_PATH:-}}}}"
                OUT_DIR="${BITRISE_DEPLOY_DIR:-./appbreach-results}/appbreach-results"
                mkdir -p "${OUT_DIR}"
                PYTHONPATH="${SCANNER_DIR}" python3 -m src.ci_scan \
                  --api-url "${APPBREACH_API_URL}" \
                  --artifact "${ARTIFACT_PATH}" \
                  --admission "${ADMISSION_FILE}" \
                  --mode "${APPBREACH_MODE}" \
                  --allow-partial --compare-latest --fail-on-regression \
                  --sarif-out "${OUT_DIR}/results.sarif" \
                  --diff-output "${OUT_DIR}/release-diff.md" \
                  --diff-pdf-output "${OUT_DIR}/release-diff.pdf" \
                  --diff-docx-output "${OUT_DIR}/release-diff.docx"
      - deploy-to-bitrise-io@2: {}

See the full self-contained Bitrise workflow with secret cleanup and pinned checkout in integrations/bitrise/appbreach-step.example.yml.

Fastlane

Add lane :security_release_gate to your fastlane/Fastfile to run the gate immediately after gradle (Android) or gym (iOS). The lane reads the built artifact path directly from Fastlane lane_context, writes the signed scope to a 0600 temporary file cleaned up in an ensure block, and fails the lane cleanly on policy violations.

platform :android do
  lane :release_with_gate do
    gradle(task: "assembleRelease")
    security_release_gate(mode: "release")
  end
end

platform :ios do
  lane :release_with_gate do
    gym(export_method: "ad-hoc")
    security_release_gate(mode: "release")
  end
end

Copy the complete lane implementation from integrations/fastlane/Fastfile.appbreach.example.

Exit codes and release gating semantics

src/ci_scan.py uses deterministic exit codes so CI pipelines can distinguish a clean pass, a security policy block, and an operational configuration error:

AppBreach CI runner exit codes
Exit code Meaning Typical CI action
0 Passed: No blocking confirmed findings at or above --threshold in pr mode, and release diff verdict is held or waived. Allow merge or promote release candidate.
2 Policy gate failed: Confirmed finding at or above --threshold in pr mode, or release diff verdict is regressed (with --fail-on-regression) or unmeasured (with --fail-on-unmeasured). Block release, keep if: always() artifact uploads running, and triage SARIF + Release Diff reports.
3 Operational error: Invalid token, malformed scope JSON, unreachable API, invalid baseline ID, or timeout. Check CI secrets, artifact path, and API connectivity before retrying.

When comparing against a baseline, the release verdict is one of held (all expected controls held with no new confirmed regressions), waived (regressions are covered by active, unexpired waivers), regressed (new confirmed security regressions detected), or unmeasured (required controls could not be observed in this build).

SARIF 2.1.0 upload and Code Scanning

Every completed assessment writes a standards-compliant SARIF 2.1.0 file (--sarif-out). Upload it with github/codeql-action/upload-sarif@v3 under if: always() so security reviewers see findings inside GitHub Security → Code Scanning even when a build is blocked.

  • Low-noise severity mapping: Only confirmed findings map to blocking error (critical/high) or warning (medium) alerts. Unconfirmed candidates and verified configuration facts export as note items so they remain visible for review without breaking delivery.
  • Stable finding fingerprints: Each SARIF result carries stable cross-release fingerprints so GitHub Code Scanning tracks fixed, unchanged, and newly introduced issues accurately across builds.
  • Separate Android and iOS categories: Set category: appbreach-${{ matrix.platform }} in matrix workflows so Android and iOS SARIF uploads do not overwrite each other.

Release Diff artifacts (Markdown, PDF & DOCX)

Pass --compare-latest (or an explicit 32-hex --baseline-run-id) to compare the new release candidate against your last assessed build and export audience-ready artifacts in a single step:

Release Diff export options
Flag Format Best used for
--diff-output release-diff.md Markdown Pull request summaries, release notes, and engineering triage in CI logs.
--diff-pdf-output release-diff.pdf PDF Immutable executive sign-off packets, change-advisory reviews, and release-review archives.
--diff-docx-output release-diff.docx Word (DOCX) Editable security review deliverables for audit teams and external stakeholders.

Both --diff-pdf-output and --diff-docx-output fetch the rendered binary directly from https://appbreach.io using the same pinned baseline run ID as your Markdown verdict, validate a non-empty response, and save with 0600 permissions.

Documentation

Related reading