Mobb User Docs
Start NowBlogsWatch NowContact Us
  • What is Mobb?
  • What's New with Mobb
  • Supported Fixes
  • Getting Started
    • System Requirements
    • Onboarding Guide
      • Registering a Mobb account
      • Try Mobb now!
      • Running Mobb against your own code
      • Automate Mobb in a CI/CD pipeline
    • Working with the Fix Report
    • Mobb CLI Overview
      • Analyze Mode
      • Scan Mode
      • Add SCM Token Mode
      • Review Mode
      • Convert-to-SARIF Mode
      • Common Deployment Scenarios
  • Mobb Dashboard
  • Integrating SAST Findings
    • Checkmarx
      • Generating Checkmarx One JSON Report from CLI
    • Snyk
    • SonarQube
      • Generating a SonarQube SAST Report
    • Fortify
    • CodeQL
    • Semgrep/Opengrep
      • Generating a Semgrep SAST Report
      • Generating an Opengrep SAST Report
  • CI/CD Integrations
    • GitHub Actions
      • GitHub Fixer for CxOne
      • GitHub Fixer for Opengrep
    • GitLab Pipeline
    • Azure DevOps
    • Jenkins
    • CircleCI
    • Bamboo
    • Bitbucket Pipeline
    • Harness
  • Administration
    • User Management
    • Project Settings
    • Access Tokens
    • Organization-Level Fix Policy
    • Integrations Page
    • Single Sign-On (SSO)
      • Connecting Okta to Mobb
      • SAML Single Sign-On Flow
  • More Info
    • Mobb Broker
      • Mobb Broker Token Rotation
      • Secure storage of Mobb broker in AWS Secrets Manager
    • Providing Fix Feedback
    • Frequently Asked Questions (FAQ)
    • Data Protection and Retention
    • Service Level Agreement
  • Fixing Guides
    • SQL Injection
    • Path Traversal
    • Log Forging
    • XSS
    • XXE
    • Server Side Request Forgery
    • HttpOnly Cookie Vulnerabilities
    • Hardcoded Domain in HTML
    • Hardcoded Secrets
    • HTTP Response Splitting Attacks
    • Insecure Cookie Vulnerabilities
    • Insecure Randomness
    • Missing Check against Null
    • Missing Rate Limiting
    • Regex Missing Timeout
    • System Information Leakage
  • Mobb REST API Guide
Powered by GitBook
On this page

Was this helpful?

  1. CI/CD Integrations

CircleCI

PreviousJenkinsNextBamboo

Last updated 11 months ago

Was this helpful?

Mobb can be integrated into any CI/CD platform of your choice. In this guide, the process of integration with CircleCI will be demonstrated.

After logging into Mobb, select the last option in the menu: “Connect Mobb to Your Workflow”.

To run Mobb within CircleCI, select “CircleCI”.

You will be presented with a sample yaml script that you can use in CircleCI. This particular example uses Snyk as the SAST scanner, however, you may want to modify the script to use the SAST tool of your choice.

version: 2.1
orbs:
  node: circleci/node@5.2.0
jobs:
  sast-autofixer:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      
      # Installing Node.js 18
      - node/install:
          node-version: '18'
          
      - run:
          name: "Prepare Environment for SAST and Mobb Steps"
          command: |
          
            # Extract the GitHub repo URL
            GITHUBURL=$(echo $CIRCLE_REPOSITORY_URL | sed 's/^git@github.com:/https:\/\/github.com\//;s/\.git$//')
            echo "Extracted GitHub URL: $GITHUBURL"
            echo "export GITHUBURL="$GITHUBURL"" >> $BASH_ENV
            
      - run:
          name: "SAST scan"
          command: |
            # Replace this step with your own SAST scanner
            npx snyk auth $SNYK_API_KEY
            npx snyk code test --sarif-file-output=report.json
            
      - run:
          name: "Mobb Autofixer"
          command: |
            
            # Run Mobb Autofixer against the report.json file generated in the previous step with Snyk SAST scan
            MOBBURL=$(npx mobbdev@latest analyze -f report.json -r $GITHUBURL --ref $CIRCLE_BRANCH --api-key $MOBB_API_KEY --ci)
            echo "Mobb URL: $MOBBURL"
            
            # Store the Mobb URL in a html file and save it as a CircleCI artifact
            echo "<html><body><a href="$MOBBURL">Click here for the Mobb URL</a></body></html>" > mobburl.html
            
            # (Optional Step) Publish the Mobb URL back to GitHub PR page. The script can be found in https://github.com/antonychiu2/mobb-circleci-integration/tree/main/.circleci
            ./.circleci/update_github_status.sh \
              "$GITHUB_PAT_SECRET" \
              "$CIRCLE_USERNAME" \
              "$CIRCLE_PROJECT_REPONAME" \
              "$CIRCLE_SHA1" \
              "success" \
              "$MOBBURL" \
              "Click on \\\"Details\\\" to access the Mobb Fix Link" \
              "Mobb Fix Link"
          when: on_fail
          
      - store_artifacts:
          path: mobburl.html
          destination: /MobbURL
          
      - store_artifacts:
          path: report.json
          destination: /Snyk Report
# Orchestrate jobs using workflows
workflows:
  test-workflow:
    jobs:
      - sast-autofixer

For a demonstration of how this integration works, you can visit the following YouTube video:

Click for a sample CircleCI job run.

Click for a detailed sample implementation guide.

here
here