Professional security scanning extension for Azure DevOps pipelines with comprehensive vulnerability detection and AI-powered analysis.
- π SAST (Static Application Security Testing) - Source code vulnerability analysis
- π¦ SCA (Software Composition Analysis) - Dependency vulnerability scanning
- π Secrets Detection - Hardcoded credentials and API key detection
- ποΈ Infrastructure as Code (IaC) - Infrastructure security scanning
- π€ AI-Powered Analysis - False positive elimination and intelligent insights
- π Multiple Output Formats - SARIF, JSON, JUnit, CSV, XML
- π Custom Results Tab - Beautiful results visualization in Azure DevOps UI
- π Network Diagnostics - Comprehensive debugging for corporate environments
- π’ On-Premises Support - Works in air-gapped and corporate environments
Install the CodeThreat Security Scan extension from the Azure DevOps Marketplace.
Add the CodeThreat Security Scan task to your azure-pipelines.yml:
trigger:
- main
pool:
vmImage: 'ubuntu-latest' # Recommended: ubuntu-latest, windows-latest, macOS-latest
steps:
- task: CodeThreatSecurityScan@1
displayName: 'CodeThreat Security Scan'
inputs:
# Required
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
# Scan Configuration
scanTypes: 'sast,sca,secrets'
waitForCompletion: true
timeout: 30
# Build Protection
failOnCritical: true
failOnHigh: false
# Output Configuration
outputFormat: 'junit'
outputFile: 'codethreat-results.xml'
- task: PublishTestResults@2
displayName: 'Publish Security Results'
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'codethreat-results.xml'
testRunTitle: 'CodeThreat Security Scan'In your Azure DevOps project, go to Library β Variable groups and add:
| Variable Name | Value | Secret |
|---|---|---|
CODETHREAT_API_KEY |
your_api_key_here |
β Yes |
CODETHREAT_SERVER_URL |
https://app.codethreat.com |
No |
| Input | Description | Example |
|---|---|---|
apiKey |
CodeThreat API key | $(CODETHREAT_API_KEY) |
serverUrl |
CodeThreat server URL | https://app.codethreat.com |
| Input | Description | Default | Options |
|---|---|---|---|
organizationId |
Organization ID | Auto-detected | org-123 |
repositoryUrl |
Repository URL | $(Build.Repository.Uri) |
Git URL |
branch |
Branch to scan | $(Build.SourceBranchName) |
Branch name |
scanTypes |
Scan types | sast,sca,secrets |
sast, sca, secrets, iac |
waitForCompletion |
Wait for completion | true |
true, false |
timeout |
Timeout in minutes | 30 |
1-120 |
pollInterval |
Poll interval in seconds | 10 |
5-60 |
outputFormat |
Output format | json |
json, sarif, junit, csv, xml |
outputFile |
Output file path | codethreat-results.json |
File path |
failOnCritical |
Fail on critical | true |
true, false |
failOnHigh |
Fail on high severity | false |
true, false |
maxViolations |
Max violations | 0 |
Number (0 = no limit) |
skipImport |
Skip repository import | false |
true, false |
cliVersion |
CLI version | latest |
Version number |
verbose |
Verbose logging | false |
true, false |
The task sets the following pipeline variables:
| Variable | Description |
|---|---|
CodeThreat.ScanId |
Scan identifier |
CodeThreat.RepositoryId |
Repository identifier |
CodeThreat.ViolationCount |
Total violations found |
CodeThreat.CriticalCount |
Critical vulnerabilities |
CodeThreat.HighCount |
High severity vulnerabilities |
CodeThreat.SecurityScore |
Security score (0-100) |
CodeThreat.ScanUrl |
Dashboard URL |
CodeThreat.ResultsFile |
Results file path |
- task: CodeThreatSecurityScan@1
name: SecurityScan
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
- script: |
echo "Violations found: $(CodeThreat.ViolationCount)"
echo "Security Score: $(CodeThreat.SecurityScore)/100"
echo "View Results: $(CodeThreat.ScanUrl)"
displayName: 'Display Results'After running the CodeThreat Security Scan task, a "CodeThreat Results" tab will automatically appear in your Azure DevOps pipeline results alongside the default Summary tab.
The custom tab provides:
- π Visual Summary Cards: Interactive cards showing violation counts by severity
- π― Security Score Visualization: Progress bar with color-coded score (0-100)
- π Detailed Scan Information: Complete scan metadata and configuration
- π Violations Breakdown: Detailed table with severity distribution and descriptions
- π¬ Scan Types Analysis: Status and description of each security test performed
- π Quick Actions: Direct links to CodeThreat dashboard and result downloads
The tab displays:
- Summary Cards: Critical, High, Medium, Low violation counts + Security Score + Scan Duration
- Security Score Progress: Visual progress bar with color coding (Red < 60 < Orange < Yellow < Green)
- Scan Details Table: Scan ID, Repository, Branch, Types, Duration, Results file
- Violations Analysis: Severity breakdown with percentages and descriptions
- Scan Types Status: SAST, SCA, Secrets, IaC completion status
- Quick Actions: Links to dashboard, download results, view raw data
π‘οΈ CodeThreat Security Analysis Results
Comprehensive security scan results with AI-powered analysis
[Critical: 1] [High: 3] [Medium: 5] [Low: 2] [Score: 78/100] [Duration: 85s]
π Security Score Analysis
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 78%
π Scan Information
βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β Scan ID β cmf5fitgk003s2mig1efs7cjx β
β Repository β MyApp Repository β
β Branch β main β
β Scan Types β SAST, SCA, Secrets β
β Duration β 85 seconds β
β Total Violationsβ 11 β
βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββ
π Violations by Severity
ββββββββββββ¬ββββββββ¬βββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββ
β Severity β Count β Percentage β Description β
ββββββββββββΌββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββ€
β Critical β 1 β 9% β Immediate attention required β
β High β 3 β 27% β Should be fixed soon β
β Medium β 5 β 46% β Should be addressed β
β Low β 2 β 18% β Consider fixing β
ββββββββββββ΄ββββββββ΄βββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββ
[π View in CodeThreat Dashboard] [π Download Results] [π View Raw Results]
- task: CodeThreatSecurityScan@1
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
scanTypes: 'sast,sca,secrets'- task: CodeThreatSecurityScan@1
inputs:
# Authentication
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
organizationId: '$(CODETHREAT_ORG_ID)'
# Scan Configuration
scanTypes: 'sast,sca,secrets,iac'
waitForCompletion: true
timeout: 45
pollInterval: 15
# Build Protection
failOnCritical: true
failOnHigh: true
maxViolations: 10
# Output Configuration
outputFormat: 'sarif'
outputFile: 'security-results.sarif'
verbose: truestages:
- stage: SecurityScan
displayName: 'Security Analysis'
jobs:
- job: CodeThreatScan
displayName: 'CodeThreat Security Scan'
steps:
- task: CodeThreatSecurityScan@1
displayName: 'Run Security Scan'
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
scanTypes: 'sast,sca,secrets'
failOnCritical: true
outputFormat: 'junit'
outputFile: 'security-results.xml'
- task: PublishTestResults@2
displayName: 'Publish Security Results'
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'security-results.xml'
testRunTitle: 'Security Analysis'
- stage: Deploy
displayName: 'Deploy Application'
dependsOn: SecurityScan
condition: succeeded()
jobs:
- deployment: Deploy
displayName: 'Deploy to Production'
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying secure application..."# Only scan on main branch pushes
- task: CodeThreatSecurityScan@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
scanTypes: 'sast,sca,secrets,iac'
failOnCritical: true
failOnHigh: trueThe extension supports on-premises and air-gapped environments:
- task: CodeThreatSecurityScan@1
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: 'https://codethreat.yourcompany.com' # Your private server
cliVersion: '1.0.3' # Specific version for stabilityFor environments with restricted internet access, you can pre-install the CLI:
# Pre-install CLI in pipeline
- script: |
npm install -g @codethreat/appsec-cli@1.0.3
displayName: 'Install CodeThreat CLI'
- task: CodeThreatSecurityScan@1
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'- Ensure
CODETHREAT_API_KEYis set in your variable group - Verify the variable is marked as secret
- Check variable group is linked to your pipeline
- Verify API key is valid and not expired
- Check server URL is correct and accessible
- Ensure organization has appropriate permissions
- Check if Node.js is available in the build agent
- Verify internet access for npm installation
- For on-premises: ensure binary download URL is accessible
- Increase timeout value for large repositories
- Consider running scans asynchronously (
waitForCompletion: false) - Check repository size and scan types
- β Fixed in v1.1.0+: Extension now uses Node.js 20
- Update to latest extension version from marketplace
- Solution: Update your pipeline YAML to use latest runner images
- Use
vmImage: 'windows-latest'instead ofwindows-2019 - Use
vmImage: 'ubuntu-latest'instead ofubuntu-18.04
# β
Recommended (no warnings)
pool:
vmImage: 'ubuntu-latest' # Latest Ubuntu LTS
# or
vmImage: 'windows-latest' # Latest Windows Server
# or
vmImage: 'macOS-latest' # Latest macOS
# β Deprecated (causes warnings)
pool:
vmImage: 'windows-2019' # Deprecated
vmImage: 'ubuntu-18.04' # Deprecated
vmImage: 'macOS-10.15' # DeprecatedEnable verbose logging:
- task: CodeThreatSecurityScan@1
inputs:
apiKey: '$(CODETHREAT_API_KEY)'
serverUrl: '$(CODETHREAT_SERVER_URL)'
verbose: trueOr enable system debug:
- Set
System.Debugpipeline variable totrue
- Getting Started: https://docs.codethreat.com/azure-devops
- API Documentation: https://docs.codethreat.com/api
- CLI Reference: https://docs.codethreat.com/cli
- Support: https://support.codethreat.com
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Issues: https://github.com/CodeThreat/codethreat-azure-extension/issues
- Documentation: https://docs.codethreat.com
- Email: support@codethreat.com