Azure DevOps Advanced Security Executor¶
Category: Source Code Analysis
Script: azure_devops_security.py
Integration: REST API
Faraday Plugin: Raw JSON
Website: https://learn.microsoft.com/en-us/rest/api/azure/devops/advancedsecurity/
Description¶
Imports GitHub Advanced Security for Azure DevOps alerts (code scanning, secret scanning and dependency scanning) for one repository into Faraday. Each alert becomes a vulnerability on a host that represents the repository.
Prerequisites¶
- An Azure DevOps organization with Advanced Security enabled for the repository
- A personal access token with the
Advanced Security: ReadandCode: Readscopes - Network access to
advsec.dev.azure.comanddev.azure.com(or your Azure DevOps Server)
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
ADO_HOST |
No | Azure DevOps Advanced Security API host (default: https://advsec.dev.azure.com). Change it only for Azure DevOps Server or a custom endpoint. |
ADO_ORG |
Yes | Azure DevOps organization name (the {org} in https://dev.azure.com/{org}) |
ADO_PAT |
Yes | Personal access token with the Advanced Security: Read (vso.advsec) and Code: Read (vso.code) scopes |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
ADO_PROJECT |
string | Yes | Azure DevOps project name (e.g., faraday-platform) |
ADO_REPO |
string | Yes | Repository name (e.g., dispatcher-core), the segment after _git/ in the repository URL |
ADO_ALERT_TYPE |
string | No | Comma-separated alert families to import: code (code scanning), secret (secret scanning) and dependency (dependency scanning). Default: all three. |
ADO_MIN_SEVERITY |
string | No | Minimum severity to import: info, low, medium, high or critical (default: info) |
ADO_INCLUDE_CLOSED |
string | No | Set to true to also import fixed and dismissed alerts. Default: false (active alerts only). |
YAML Configuration Example¶
executors:
azure_devops_security:
repo_executor: azure_devops_security.py
max_size: 65536
varenvs:
ADO_HOST: "https://advsec.dev.azure.com"
ADO_ORG: "my-organization"
ADO_PAT: "<ado_pat>"
params:
ADO_PROJECT:
mandatory: true
type: string
base: string
ADO_REPO:
mandatory: true
type: string
base: string
ADO_ALERT_TYPE:
mandatory: false
type: string
base: string
ADO_MIN_SEVERITY:
mandatory: false
type: string
base: string
ADO_INCLUDE_CLOSED:
mandatory: false
type: string
base: string
How It Works¶
- Authenticates with the personal access token (HTTP Basic with an empty username)
- Reads the repository details (for the host description) from
{org}/{project}/_apis/git/repositories/{repo}. This is optional and failures are ignored. - For each selected alert type, reads the alerts from
GET {ADO_HOST}/{org}/{project}/_apis/Alert/repositories/{repo}/Alerts, 100 per page, active alerts only unlessADO_INCLUDE_CLOSEDistrue - Maps each alert to a Faraday vulnerability:
- Name:
[CODE],[SECRETS]or[SCA]followed by the rule name - Severity: the alert's severity (
notebecomeslow). Secret alerts without a severity are set tohigh. - Status: active is open, fixed and auto-dismissed are closed, dismissed is risk-accepted
- Details: file location, affected package and versions for dependency alerts, CVEs, CWEs and a link to the alert in Azure DevOps
- Name:
Notes¶
- The whole repository becomes one host with the IP
0.0.0.0and the hostname<project>/<repo>, because Advanced Security alerts belong to source code rather than IP addresses. - Azure DevOps Advanced Security must be enabled for the repository. If the API returns 404, the executor logs it and imports nothing for that alert type.
ADO_MIN_SEVERITYis applied after the severity mapping. Secret alerts count ashigh, so a floor ofcriticalexcludes them.- The organization, project and repository names are validated. Invalid names stop the run.
- The run stops if the token is rejected (HTTP 401). TLS certificates are not verified.
- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor. UseADO_MIN_SEVERITYto filter by severity.