# GitHub Actions example for SecureFlag CI Runner
name: Generate Threat Model with ThreatCanvas
on:
push:
tags:
- '*'
jobs:
threat-model:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: secureflag/actions/.github/actions/repo_to_threat_model@main
with:
SECUREFLAG_API_KEY: ${{ secrets.SECUREFLAG_API_KEY }}
SECUREFLAG_MODEL_UUID: ${{ vars.SECUREFLAG_MODEL_UUID }}
# AI Provider - choose ONE of the following options:
# Option 1 - Anthropic:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# ANTHROPIC_MODEL: claude-sonnet-4-20250514 # optional
# Option 2 - OpenAI:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# OPENAI_MODEL: gpt-4o # optional
# Option 3 - Azure OpenAI:
# AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
# AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
# AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
# AZURE_OPENAI_API_VERSION: 2024-02-15-preview # optional
# Option 4 - Gemini:
# GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
# GEMINI_MODEL: gemini-2.5-flash # optional# GitLab CI example for SecureFlag CI Runner
#
# Add this to your repository's .gitlab-ci.yml
#
# Required CI/CD variables (set as masked/protected):
# - SECUREFLAG_API_KEY: SecureFlag API authentication
#
# Required CI/CD variables:
# - SECUREFLAG_MODEL_UUID: SecureFlag model UUID
#
# AI Provider variables (choose one, set as masked/protected):
# Option 1 - Anthropic:
# - ANTHROPIC_API_KEY: Anthropic API key
# - ANTHROPIC_MODEL: (optional) Model name, default: claude-sonnet-4-20250514
# Option 2 - OpenAI:
# - OPENAI_API_KEY: OpenAI API key
# - OPENAI_MODEL: (optional) Model name, default: gpt-4o
# Option 3 - Azure OpenAI:
# - AZURE_OPENAI_KEY: Azure OpenAI API key
# - AZURE_OPENAI_ENDPOINT: Azure endpoint URL (e.g., https://your-resource.openai.azure.com/)
# - AZURE_OPENAI_DEPLOYMENT: Azure deployment name
# - AZURE_OPENAI_API_VERSION: (optional) API version, default: 2024-02-15-preview
# Option 4 - Gemini:
# - GEMINI_API_KEY: Google Gemini API key
# - GEMINI_MODEL: (optional) Model name, default: gemini-2.5-flash
#
# Optional CI/CD variables:
# - SECUREFLAG_REPO_PATH: Absolute path to restrict analysis to a directory (prepend with $CI_PROJECT_DIR)
# - SECUREFLAG_COMPONENT_LIMIT: (for 'model-repo') Hinted number of nodes in TC diagrams
stages:
- tests
secureflag_ci:
stage: tests
image: registry.gitlab.com/secureflag-community/sf-runner:latest
variables:
SECUREFLAG_COMMANDS: model-repo
script:
- /app/entrypoint.sh
rules:
# Run on tags
- if: $CI_COMMIT_TAG
# Run on schedules
- if: '$CI_PIPELINE_SOURCE == "schedule"'
allow_failure: true
# Bitbucket Pipelines example for SecureFlag CI Runner## Add this to your repository at: bitbucket-pipelines.yml## Required repository variables (set as secured):# - SECUREFLAG_API_KEY: SecureFlag API authentication## Required repository variables:# - SECUREFLAG_MODEL_UUID: SecureFlag model UUID## AI Provider variables (choose one, set as secured):# Option 1 - Anthropic:# - ANTHROPIC_API_KEY: Anthropic API key# - ANTHROPIC_MODEL: (optional) Model name, default: claude-sonnet-4-20250514# Option 2 - OpenAI:# - OPENAI_API_KEY: OpenAI API key# - OPENAI_MODEL: (optional) Model name, default: gpt-4o# Option 3 - Azure OpenAI:# - AZURE_OPENAI_KEY: Azure OpenAI API key# - AZURE_OPENAI_ENDPOINT: Azure endpoint URL (e.g., https://your-resource.openai.azure.com/)# - AZURE_OPENAI_DEPLOYMENT: Azure deployment name# - AZURE_OPENAI_API_VERSION: (optional) API version, default: 2024-02-15-preview# Option 4 - Gemini:# - GEMINI_API_KEY: Google Gemini API key# - GEMINI_MODEL: (optional) Model name, default: gemini-2.5-flash## Optional repository variables:# - SECUREFLAG_REPO_PATH: Absolute path to restrict analysis to a directory (prepend with $BITBUCKET_CLONE_DIR)# - SECUREFLAG_COMPONENT_LIMIT: (for 'model-repo') Hinted number of nodes in TC diagrams
image: registry.gitlab.com/secureflag-community/sf-runner:latest
# Fetch full history so commit metrics are accurateclone: depth: full
definitions: steps: - step: &secureflag_ci name: SecureFlag CI script: - export SECUREFLAG_COMMANDS=model-repo # Bitbucket has no native "allow_failure"; the trailing `|| true` keeps # the pipeline green if SecureFlag analysis fails. Remove it if you # want the pipeline to fail on errors. - /app/entrypoint.sh || true
pipelines: # Run on tags tags: '*': - step: *secureflag_ci
# Run on a schedule (configure in Bitbucket: Repository settings -> Pipelines -> Schedules) custom: secureflag-scheduled: - step: *secureflag_ci